Realtime sound synthesis

Hey all - I’m wondering about using realtime sound synthesis in my next game, instead of making tons of little ogg files.

I know the basics of FM sound synthesis well enough to write an FM synthesiser but I’ve got no idea how to implement low pass, band pass and high pass filters, nor effects such as ring modulation etc etc. Could anyone point me to the theory or some pseudocode?

Cas :slight_smile:

Why not just use the MIDI synthesiser that is already there?

(Disclaimer: not sure if this is what you want/need at all, but here goes…)

Is it somekind of FIR/IIR filter you want, a google search on “IIR FIR lp filter java” should give you quite a few examples!

MIDI doesn’t do what I want. To get an idea of what I’m after have a look for SimSynth.

Cas :slight_smile:

filtering is fairly easy once you have your filter coefficients, but it’s something that would be much better to do in native code with SSE2 instructions or similar.

Ultimately you will just need to go over the sample data with multiply-add operations and spit out the sum for the new samples.

e.g. S`(n) = s(n-2)*c1+s(n-1)*c2+s(n)*c3+s(n+1)*c4+s(n+2)*c5

depending on the number of taps in your filter you will have more terms in that expression.
Calculating c1,c2,… is the hard part, but you can get tools for that - or just fake it until it sounds good :slight_smile:

OK… I had to bust out on this topic… I have been working on a project fulltime+ for almost a year on creating a component oriented framework for real time synthesis using Java and SuperCollider3. SC3 is the most advanced programmatic real time audio engine I am aware of presently; and I keep tabs on this stuff…

It is mainly an OSX app with ports to Linux and Win32; there is a Win32 build, but it is not being supported much at all… I have to get the feather duster out and get things moving there.

My project is called Scream and is info is located here:
http://audio.egregious.net/scream/

I just put up an updated mini white paper describing my progress and where I’d like to take things… I am presenting a BOF at J1 on Scream and am also in the process of making a neato 3D game demo featuring real time audio spatialized via ambisonics for a n-channel system. I’ll have a 6 channel full range system for J1… Hope I can get things done for that game competition, but things are a little on the custom side right now in regard to Scream integration with SC3. IE I run a PC and Mac and network them and have an RME Hammerfall in each box.

SC3 is a network based audio engine; which makes things really interesting…

Info on SC3 here:
http://supercollider.sourceforge.net
It is open source under GPL; small, but decent community behind it… computer music to the core…

Thank y’all.

Cas :slight_smile:

Just to drop a note… There is a ton of DSP code available for view in the SC3 project. More so than www.musicdsp.org… Check there too for code of course…

Best…