Csound Csound-dev Csound-tekno Search About

[Csnd] Generalized waveform generator

Date2011-04-14 09:45
FromDavid Banks
Subject[Csnd] Generalized waveform generator
Hi list,

I was wondering, taking the four common waveforms in subtractive
synthesis - sine, triangle, square, sawtooth - is it possible to see
all these as outputs of a *single* formula?  I have always considered
them as discrete entities (and in Csound I usually generate them
through partial strengths, which can be seen as empirically rather
than analytically determined).
However today I was considering to add a waveform selector to a
realtime MIDI instrument and I thought, rather than simply
special-casing on each integer value (1 = sine, 2 = triangle, etc), it
would be cool to see these waves as certain known points in a
continuous parameter space.

I know these waves are related by the number of harmonics they
contain, and I'm pretty sure you can see at least sine and sawtooth as
both ends of a continuous scale, which can be generated by opcodes
such as 'buzz'.  However I'm not sure if the square and triangle waves
can be fitted into this same model.  They both specify by a pattern
for which harmonics are kept, and a "rolloff speed" for each harmonic
(I'm getting a bit beyond my knowledge here).

So I guess my question is:

* Has anyone made this formula?
* How many parameters would be needed to create these waveforms?
* How could I generate this in Csound?

Cheers,
-- 
David BanksĀ  


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2011-04-15 14:37
FromMark Van Peteghem
SubjectRe: [Csnd] Generalized waveform generator
Hi David,

I just saw this video of a VST that imitates a PolyKB synthesizer that 
can do this on . At 1:42 he brings up 
an oscilloscope that shows what happens when the waveform is modulated. 
There is no sine, it starts with a triangle wave that is morphed to a 
saw wave, then a saw wave at double frequency and then a square wave 
(although the square is not clear). All of this seems to be done with 
simple interpolation (I would have thought triangle -> saw would be 
better done with pulse width modulation). Going from sine to triangle 
could of course also be done with interpolation.

So no single formula, I guess that can't be done, but you could easily 
write a UDO that does the interpolation.

Mark

David Banks wrote:
> Hi list,
>
> I was wondering, taking the four common waveforms in subtractive
> synthesis - sine, triangle, square, sawtooth - is it possible to see
> all these as outputs of a *single* formula?  I have always considered
> them as discrete entities (and in Csound I usually generate them
> through partial strengths, which can be seen as empirically rather
> than analytically determined).
> However today I was considering to add a waveform selector to a
> realtime MIDI instrument and I thought, rather than simply
> special-casing on each integer value (1 = sine, 2 = triangle, etc), it
> would be cool to see these waves as certain known points in a
> continuous parameter space.
>
> I know these waves are related by the number of harmonics they
> contain, and I'm pretty sure you can see at least sine and sawtooth as
> both ends of a continuous scale, which can be generated by opcodes
> such as 'buzz'.  However I'm not sure if the square and triangle waves
> can be fitted into this same model.  They both specify by a pattern
> for which harmonics are kept, and a "rolloff speed" for each harmonic
> (I'm getting a bit beyond my knowledge here).
>
> So I guess my question is:
>
> * Has anyone made this formula?
> * How many parameters would be needed to create these waveforms?
> * How could I generate this in Csound?
>
> Cheers,
>   

Date2011-04-21 12:12
FromDavid Banks
Subject[Csnd] Re: Generalized waveform generator
Hi Mark,

On 15/04/11 14:37, Mark Van Peteghem wrote:
> I just saw this video of a VST that imitates a PolyKB synthesizer that
> can do this on . At 1:42 he brings up
> an oscilloscope that shows what happens when the waveform is modulated.
> There is no sine, it starts with a triangle wave that is morphed to a
> saw wave, then a saw wave at double frequency and then a square wave
> (although the square is not clear). All of this seems to be done with
> simple interpolation (I would have thought triangle -> saw would be
> better done with pulse width modulation). Going from sine to triangle
> could of course also be done with interpolation.

Thanks for that, that synth sounds really nice!  I'm not sure how the 
interpolation algorithm would work, but I have been looking at the 
Fourier analyses of the basic waveforms over the past week and it seems 
to be quite feasible to parameterize the four waveforms over their 
respective series, and then the waveform could be generated by an 
inverse FFT.  (Sorry if that's unclear, tbh the maths here is way beyond 
me but the correspondence between forms is strong: 
http://homepages.gac.edu/~huber/fourier/).

Also this seems to be strongly related to additive synthesis, but 
reading the documentation for 'adsyn' and related opcodes didn't seem to 
throw any light on this.  Anyone know if I can accomplish this with 
adsyn?  If not, can csound do that inverse FFT in realtime, or would I 
have to drop down to C to accomplish something like that?

Cheers all,
David



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-04-21 21:33
FromMark Van Peteghem
SubjectRe: [Csnd] Re: Generalized waveform generator
David Banks wrote:
> Hi Mark,
>
> On 15/04/11 14:37, Mark Van Peteghem wrote:
>> I just saw this video of a VST that imitates a PolyKB synthesizer that
>> can do this on . At 1:42 he brings up
>> an oscilloscope that shows what happens when the waveform is modulated.
>> There is no sine, it starts with a triangle wave that is morphed to a
>> saw wave, then a saw wave at double frequency and then a square wave
>> (although the square is not clear). All of this seems to be done with
>> simple interpolation (I would have thought triangle -> saw would be
>> better done with pulse width modulation). Going from sine to triangle
>> could of course also be done with interpolation.
>
> Thanks for that, that synth sounds really nice!  I'm not sure how the 
> interpolation algorithm would work, but I have been looking at the 
> Fourier analyses of the basic waveforms over the past week and it 
> seems to be quite feasible to parameterize the four waveforms over 
> their respective series, and then the waveform could be generated by 
> an inverse FFT.  (Sorry if that's unclear, tbh the maths here is way 
> beyond me but the correspondence between forms is strong: 
> http://homepages.gac.edu/~huber/fourier/).
>
> Also this seems to be strongly related to additive synthesis, but 
> reading the documentation for 'adsyn' and related opcodes didn't seem 
> to throw any light on this.  Anyone know if I can accomplish this with 
> adsyn?  If not, can csound do that inverse FFT in realtime, or would I 
> have to drop down to C to accomplish something like that?

Linear interpolation is easier than that. It's just

   asig = (1-kx)*asig1 + kx*asig2

If kx is 0 you get asig1, if kx is 1 you get asig2. If kx is between 0 
and 1 you get something in between. In the video it looks just like that 
to me. With the opcode ntrpol you can make this even easier.


Mark



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"