gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > Run-time synthesis techniques

#25227 - tepples - Thu Aug 19, 2004 2:26 am

It's possible to make tracked music tiny by mathematically modeling the physical characteristics of musical instruments and then generating waveforms at run time. If you're bummed out about the 512 KByte limit on compo entries, this might help.

Preliminaries
You'll need to know a thing or two about digital signal processing, such as FIR filters and IIR filters. Read through bores.com and musicdsp.org to familiarize yourself with the topic. You may find these cookbook filter implementations useful.

Horns
A brass horn such as a trumpet or a freedom horn is a sawtooth wave fed into an IIR low-pass filter with a variable cutoff frequency. You'll want to slightly modulate the frequency of the sawtooth wave.

Clarinets, flutes, saxophones, and the like are made similarly but with different waveshapes and configurations of filters. Experiment!

Plucked strings
To make a decent guitar or pizzicato violin sound, use the Karplus-Strong algorithm. Start with an impulse; look at the first period of your existing sample to get an idea for a suitable impulse shape. Then apply a subtle FIR low-pass filter to that impulse to get a new impulse. The filter should have gain greater than 0.8 but less than unity; the greater the gain, the slower the decay. Store each impulse one after another for a few iterations, and then loop the last impulse.

A piano is a quick-decaying plucked string layered over a slightly detuned plucked string with a slower decay.

You can make a drum sound by starting with a shorter impulse and then gradually increasing the length of the impulse each time through the algorithm until you hit a maximum.

Etc.
If you can't figure out how to synthesize a waveform for an instrument, you can always try a general waveform codec such as 8ad or GSM.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#25829 - crossraleigh - Sun Aug 29, 2004 4:00 am

Just to add a link to the ones already in Preliminaries: The tutorials at http://www.dsptutor.freeuk.com/ were much easier for me to understand (and navigate) than the BORES courses.

#103261 - keldon - Wed Sep 20, 2006 12:32 pm

Man this has got to be one of the must useful posts EVER! Google didn't find the info on DSP for me, but I always remember this post.