From the original SynthMaker forum (2004–2014), with its members’ names and dates.
galaa ·
As I am fairly new to DSP stuff I'd thought I'd ask for a bit of advice.
In a post about portamento stefan gave me some code to create a mono sine oscillator. 🙂
If I wanted to create other mono oscillators whats the best way of going about it.
Can I create lots of separate sine waves and add them togther additive synth style or is there a more effecient way of creating such a thing using code.
I want to be able to create the common waveforms (saw/square/tri/etc) and once I've got the hang of these I'll create others.
stefan ·
if you'd just change the
output = sin1(cnt);
to
output = cnt;
you'd get an aliasing sawtooth.
another way to do different waveforms is to use phase feedback within the oscillator, for instance like this:
By adjusting the feedback you can "morph" the waveform between a sine and a saw. If you instead do a feedback with the phase "squared" you'll get a pulse waveform, like this:
output = sin1(cnt + output * output * feedback);
Too high feedback rates will introduce an instability that is undesired, so keep away from doing that.
You can also create pulsewaveforms by mixing sawtooths (invert one of them and you'll get a pulse with variable pulse width by moving the phase of one of the oscillators)
galaa ·
🙂 🙂 🙂 🙂
where have you been all my life!!!!
Fantastic. Thanks a lot for your help.
Now all I've got to do is pick the code apart and try and figure out what its doing. Can you recommend any textbooks/websites/etc where a DSP newbie can learn all about this kind of thing
stefan ·
Recently this huge gem was posted on kvr
http://math.uga.edu/~djb/html/music.pdf
it's an awesome resource and getting updated when needed etc. great book. for free, whic is totally "wtf".
galaa ·
Thanks I've downloaded it.
It's massive!!! Gonna take a while to read through that!!!! 😀
galaa ·
stefancrs wrote: You can also create pulsewaveforms by mixing sawtooths (invert one of them and you'll get a pulse with variable pulse width by moving the phase of one of the oscillators)
How would I create a piece of code that enabled me to vary the phase of one of the sawtooths. I am using the following code you posted:
I am just guessing, but would I define the 'cnt' variable as having a non-zero starting value.
stefan ·
galaa wrote:
stefancrs wrote: You can also create pulsewaveforms by mixing sawtooths (invert one of them and you'll get a pulse with variable pulse width by moving the phase of one of the oscillators)
How would I create a piece of code that enabled me to vary the phase of one of the sawtooths. I am using the following code you posted: