GPU audio generation with TOPs

Here’s a thing I’ve been messing with for a while after some conversations with Felix. Recently at the SIGGRAPH 2008 touch users meeting, Jim also showed some wild sound synths using textures.

anyway, here’s a simple additive synthesizer that uses sine waves to make a fundamental wave and 29 harmonics in a harmonic series.

Things to take a look at:

Open up TOP_oscillator1:
‘ramp1’ uses ease-in ease-out to get half a sine curve in the ramp
‘wave_transform’ gives us the second half of the sine wave
The 16 bit RGBA representation can handle negative numbers also, but those parts of the texture appear black although they are really a ramp in the negative half of the wave
transform1 uses 1/$OPD as its u scale value so that each new sine wave has a simple whole-number ratio to the first (scaling the textures 1/1, 1/2, 1/3, 1/4 etc. is the same as defining frequencies as Æ’1, Æ’2 , Æ’3, Æ’4 etc.)
oscillators 2-30 are clones of oscillator1, so any changes inside oscillator1 will apply to all the others next time you load
The composite TOPs are used to multiply the texture by a constant. The constant is faded from white to black to change the level of the wave - the same trick is used for panning except for the level TOP to flip the second channel

After converting the resulting TOPs to CHOPs, an audio frequency oscillator is used to select the index for a lookup of the mix of all the sine waves

Oh yeah, the ‘squash’ effect is not being used. To enable it, adjust the Range values in /project1/oscilator_bank1/math1

you can also get variations by changing the waveform of the lookup oscillator.

Have fun! Any suggestion as to how to speed this up would be most welcome.

I made a controller for this using a particle system but that will have to come later.

The CPU still seems prety busy but it might be some of th eother crap that’s running in the background
but I will try using hundreds of oscillators to see if it grinds to a halt.

Rod.
t077_additive_synth_Bigger.37.toe (34.3 KB)