From the original SynthMaker forum (2004–2014), with its members’ names and dates.
Neptune ·
Hi,
again i got stuck in solving an issue:
The osc i am using is more or less the wiki saw (up/down) with phase.
I have modified it just a little bit.
Now the result is (kind of funny) that when i reduce the volume to 0 it becomes a unipolar square... 😮
I cant find the problem.
Can a guru please have a look.
Thank you
Neptune
trogluddite ·
I think the problem is in the output lines, e.g...
out1 = (volume*p1) - (p1 > 1) & 2;
The brackets around (volume * p1) stop the volume from changing the 'anded' part.
re-arranging the brackets like this should do the trick...
out1 = volume * ( p1 - (p1 > 1) & 2 );
You can think of brackets as as being like the way you use modules and sub-modules in SM - the bit in brackets is like a 'sub-equation' that only sends out one number to the rest of the line.
cyto ·
It took me awhile to figure out what you were doing, but I finally got it (and it is very clever BTW 😉 ). Trog is exactly correct. That'll fix your problem. One thing that I did notice though while I was looking over your code was the following line(s):
a1 = a1 + (frequency*SR/2)*f1;
I'm not quite sure why you divide the "SR" value (which is precalculated at 2/sampleRate) by 2. I would think it should instead be...
a1 = a1 + (frequency*SR)*f1;
Or am I missing something?
in either case, you could just put one line at the beginning of the code...
frequency = frequency*SR
//or frequency = frequency*SR/2
and then for each wave have...
a1 = a1 + (frequency)*f1;
That'll save a couple of cycles at least.
-cyto
Neptune ·
Thank you very much trog & cyto!!
Learned again a lot!
Wrote something here? To have a post removed or your name hidden, write to [email protected].