electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  mosc Chez Mosc - Tonite, Twyndyllyngs Live - Back again after a two week tour
Please visit the chat
 Forum index » DIY Hardware and Software » Csound
Cut-n-Paste F-tables?
Post new topic   Reply to topic
Page 1 of 1 [7 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
jbeuckm



Joined: Nov 30, 2008
Posts: 46
Location: minneapolis
Audio files: 4

PostPosted: Thu Apr 30, 2015 9:59 pm    Post subject: Cut-n-Paste F-tables? Reply with quote  Mark this post and the followings unread

I'm trying to generate a few tables by trimming and offsetting parts of a sine, but I don't see how to do it yet.

Here are the tables:

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 21055
Location: The Netherlands, Enschede
Audio files: 158
G2 patch files: 319

PostPosted: Fri May 01, 2015 2:56 am    Post subject: Reply with quote  Mark this post and the followings unread

Untested .. but this would be the idea I guess?


W1 :: y = sin(2.pi.x);

W2 :: y = if x < pi/2
then x - sin(2.pi.x)
else if x < 3.pi/2
then ( pi - x) - sin(2.pi.x)
else 2.pi + x - sin(2.pi.x);

W3 :: y = if x < pi
then sin(2.pi.x)
else 0;

W4 :: y = if x < pi
then W2
else 0;

W5 :: y = if x < pi
then sin(4.pi.x)
else 0;
W6 :: y = if x < pi/4
then x - sin(4.pi.x)
else if x < 3.pi/4
then ( pi/2 - x) - sin(4.pi.x)
else if x < pi
then pi + x - sin(4.pi.x)
else 0;

W7 :: y = if x < pi
then abs( sin(4.pi.x))
else 0;

W8 :: y = if x < pi
then abs( W6)
else 0;


I probably made some mistakes ...

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
jbeuckm



Joined: Nov 30, 2008
Posts: 46
Location: minneapolis
Audio files: 4

PostPosted: Fri May 01, 2015 5:49 am    Post subject: Reply with quote  Mark this post and the followings unread

That looks like a good pass at the math. What I haven't figured out is how to get these into CSound f-tables.

For instance, the below will generate the correct W5 in f5:


f10 0 8192 10 1
f5 0 8192 18 10 1 0 4095

What about the rest?
Back to top
View user's profile Send private message
jbeuckm



Joined: Nov 30, 2008
Posts: 46
Location: minneapolis
Audio files: 4

PostPosted: Fri May 01, 2015 6:38 am    Post subject: Reply with quote  Mark this post and the followings unread

This looks like a good resource for manual table generation: http://www.csounds.com/journal/issue12/genInstruments.html
Back to top
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 21055
Location: The Netherlands, Enschede
Audio files: 158
G2 patch files: 319

PostPosted: Fri May 01, 2015 6:47 am    Post subject: Reply with quote  Mark this post and the followings unread

oh oops .. I had missed the CSound header here .. sorry ... the link seems useful, yes.
_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
jbeuckm



Joined: Nov 30, 2008
Posts: 46
Location: minneapolis
Audio files: 4

PostPosted: Fri May 01, 2015 8:57 am    Post subject: Reply with quote  Mark this post and the followings unread

This works great. Here is an opcode that generates the table for W3:

Code:

opcode GEN_W3, i, 0

    isize = ftlen(1)
    i_index = 0
    i_half_length = isize / 2

    iout_table  ftgen 0, 0, isize, 10, 1

    loop_start:

        iwrite_value = 0

        if (i_index < i_half_length) then
           iwrite_value tab_i i_index, 1
        endif

        tabw_i iwrite_value, i_index, iout_table

    loop_lt i_index, 1, isize, loop_start

    xout iout_table
endop
Back to top
View user's profile Send private message
jbeuckm



Joined: Nov 30, 2008
Posts: 46
Location: minneapolis
Audio files: 4

PostPosted: Fri May 01, 2015 3:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here are the rest. I think they are okay but I get a segmentation fault when I try to display W2.

https://github.com/jbeuckm/CSound-TX81Z
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [7 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Csound
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use