Author |
Message |
jbeuckm
Joined: Nov 30, 2008 Posts: 165 Location: Stockholm
Audio files: 9
|
Posted: Thu Apr 30, 2015 9:59 pm Post subject:
Cut-n-Paste F-tables? |
|
|
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:
|
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Fri May 01, 2015 2:56 am Post subject:
|
|
|
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
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
jbeuckm
Joined: Nov 30, 2008 Posts: 165 Location: Stockholm
Audio files: 9
|
Posted: Fri May 01, 2015 5:49 am Post subject:
|
|
|
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
|
|
|
jbeuckm
Joined: Nov 30, 2008 Posts: 165 Location: Stockholm
Audio files: 9
|
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Fri May 01, 2015 6:47 am Post subject:
|
|
|
oh oops .. I had missed the CSound header here .. sorry ... the link seems useful, yes. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
jbeuckm
Joined: Nov 30, 2008 Posts: 165 Location: Stockholm
Audio files: 9
|
Posted: Fri May 01, 2015 8:57 am Post subject:
|
|
|
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
|
|
|
jbeuckm
Joined: Nov 30, 2008 Posts: 165 Location: Stockholm
Audio files: 9
|
|
Back to top
|
|
|
Sinusoidal
Joined: Jul 06, 2015 Posts: 3 Location: Chungju, South Korea
|
Posted: Mon Jul 06, 2015 11:24 pm Post subject:
|
|
|
You could also use GEN 19 to generate DC-offset, phased, partial waveforms and then splice them together with GEN 18.
This makes W2 in Ftable 5
f1 0 8192 -19 0.25 1 0 -1
f2 0 8192 -19 0.25 1 0.25 -1
f3 0 8192 -19 0.25 1 0.5 1
f4 0 8192 -19 0.25 1 0.75 1
f5 0 8192 -18 4 1 0 2047 3 1 2048 4095 2 1 4096 6143 1 1 6143 8191
At least it should. I didn't try it out.
You can also make the rest of the waveforms with GEN 18 using those first four partials.
Edit: Tested it. GEN 19 uses degrees for phase instead of 0-1. So, replace those 0, 0.25, 0.5, 0.75 with 0, 90, 180, 270. |
|
Back to top
|
|
|
|