DSPRelated.com
Forums

TB303 digital filters?

Started by Nicholas Nash January 16, 2004
Hi,

I'd be very grateful for some help with the following problem.

I know almost nothing of DSP but need to learn enough to code my own
software synthesizer which is capable of generating some basic sounds
- enough for some simple music. I'm not looking any sound in
particular, just some I can use for some music (probably acidhouse or
something). It is essential that I synthesize the samples in code
though. I don't have time to look into the theory of DSP (although
without constraints on my time this would be infinetely preferable)
much because this is only a small part of a larger project I'm working
on.

From my investigations the popular Roland TB303 seems to be a very
simple synthesizer, and perhaps a good start would be to emulate it in
software (with a GUI for the basic controls etc). This is what I'd
like help doing.

I'm not interested in the design or analysis of digital filters (no
time). From what I've seen of digital filters you have some initial
signal x(t) and then you compute a new signal y(t) which seems to
often be a linear combination of terms of x, e.g. y(t) = x(t) + a*x(t
- T) for a very simple filter. Can anyone tell me what the digital
filter equations are for the TB303? I've looked at the spec. but I
don't know enough to be able to derive these equations from
descriptions like "2 pole low pass filter with slope 18dB" or
something. Is it possible to just give me these filter equations
including all the various parameters like resonance etc?

Any other ideas on just getting some niceish sounds would be greately
appreciated.
I've implemented the basic Karplus-Strong algorithm with a flanger
effect but it's a bit limited and I need a larger range of sounds.

-Nick
Nicholas Nash wrote:

> Hi, > > I'd be very grateful for some help with the following problem. > > I know almost nothing of DSP but need to learn enough to code my own > software synthesizer which is capable of generating some basic sounds > - enough for some simple music.
Some very nice music came out of the computer's built-in\ speaker back when the latest OS was DOS 4.0. It was done by turning the speaker on and off with BIOS calls and timing loops. The waveforms were all square, with selectable duty cycle to yield different timbres. Using programming tricks I never knew, some songs included chords. The first time I heard this done well, it ran on a TRS-80. What do you want your filters to do?
> I'm not looking any sound in > particular, just some I can use for some music (probably acidhouse or > something). It is essential that I synthesize the samples in code > though. I don't have time to look into the theory of DSP (although > without constraints on my time this would be infinetely preferable) > much because this is only a small part of a larger project I'm working > on.
It's hard to write code to do something you haven't defined, using techniques you don't understand.
> From my investigations the popular Roland TB303 seems to be a very > simple synthesizer, and perhaps a good start would be to emulate it in > software (with a GUI for the basic controls etc). This is what I'd > like help doing. > > I'm not interested in the design or analysis of digital filters (no > time). From what I've seen of digital filters you have some initial > signal x(t) and then you compute a new signal y(t) which seems to > often be a linear combination of terms of x, e.g. y(t) = x(t) + a*x(t > - T) for a very simple filter. Can anyone tell me what the digital > filter equations are for the TB303? I've looked at the spec. but I > don't know enough to be able to derive these equations from > descriptions like "2 pole low pass filter with slope 18dB" or > something. Is it possible to just give me these filter equations > including all the various parameters like resonance etc?
Look for Robert Bristow-Johnson's Filter Cookbook on the Harmony Central site. You may find a link to it at http://www.dspguru.com.
> Any other ideas on just getting some niceish sounds would be greately > appreciated. > I've implemented the basic Karplus-Strong algorithm with a flanger > effect but it's a bit limited and I need a larger range of sounds. > > -Nick
Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
I'm not sure what TB303 is but since you are creating sounds it doesn't seem
like you have to worry about filtering. Filtering is often on the receiving
end.

In any case, on the PC you can generate simple sine waves at the frequency
of the tone you want. However, that gives a very pure tone. Almost identical
to an Ocarina (at least I have looked at the waveforms generated by the MIDI
Ocarina instrument on the SoundBlaster Live card and its about as close to a
sine wave as you can get).

Then the "DSP" work is quite simple. Just generate a sequence of 8-bit or
16-bit tones at the desired frequency at the sample rate you want.

Very simply
x(t) = sin(2*pi*t*freq/samplerate)

Of course, that's a costly way to do it since the sine function is
numerically very expensive.

A way around this is to use the good old trig identity

sin(a + b) = sina cosb + cosa sinb
cos(a + b) = cosa cosb - sina sinb

where 'a' is the value now and 'b' is the increment experienced each
samplerate. That way you only have to do one sine and cosine computation to
start the sequence (real easy if you start them at zero) and then you have
all the subsequent values using the recursion. Lot cheaper.

Of course you will have to precalculate a cosb and sinb term for each tone,
but that is also only done once during initialization.

As far as feeding this information to the sound card; well, that's much more
of a pain.

Brian


Hi,

You won't get the TB303 sound just by designing filters. The uniqueness in
TB303 is mostly due to transistors (their non-linearities). If that is what
you are after you should read about physical modeling techniques. Take a
look at the Rebirth program from Propellerhead.

Cheers
Thomas



"Nicholas Nash" <nash@cfxweb.net> wrote in message
news:35976de6.0401160833.76dd1e1f@posting.google.com...
> Hi, > > I'd be very grateful for some help with the following problem. > > I know almost nothing of DSP but need to learn enough to code my own > software synthesizer which is capable of generating some basic sounds > - enough for some simple music. I'm not looking any sound in > particular, just some I can use for some music (probably acidhouse or > something). It is essential that I synthesize the samples in code > though. I don't have time to look into the theory of DSP (although > without constraints on my time this would be infinetely preferable) > much because this is only a small part of a larger project I'm working > on. > > From my investigations the popular Roland TB303 seems to be a very > simple synthesizer, and perhaps a good start would be to emulate it in > software (with a GUI for the basic controls etc). This is what I'd > like help doing. > > I'm not interested in the design or analysis of digital filters (no > time). From what I've seen of digital filters you have some initial > signal x(t) and then you compute a new signal y(t) which seems to > often be a linear combination of terms of x, e.g. y(t) = x(t) + a*x(t > - T) for a very simple filter. Can anyone tell me what the digital > filter equations are for the TB303? I've looked at the spec. but I > don't know enough to be able to derive these equations from > descriptions like "2 pole low pass filter with slope 18dB" or > something. Is it possible to just give me these filter equations > including all the various parameters like resonance etc? > > Any other ideas on just getting some niceish sounds would be greately > appreciated. > I've implemented the basic Karplus-Strong algorithm with a flanger > effect but it's a bit limited and I need a larger range of sounds. > > -Nick