platzhalter back to start platzhalter
platzhalter aboutplatzhalter studio and gearplatzhalter musicplatzhalter platzhalter contact platzhalter

'TinyRhythm'

Multichannel Midi-Triggerinterface with onboard digital drumsynth

Bassdrum 2 - an attempt to simulate the 808 bassdrum with a tiny13

<< back to Tiny Rhythm overview

 

Ok, i dont want to compete with the original. This is just for learning and to see, how far i can push this.

Some words from an amatuer about the original 808 bassdrum

At first: This is not a bible, it's just what i understood about the schematics of the original 808-bd so far. I try to explain a bit how it works for people who are interested but even less educated about electronics than i am :) so please forgive me and correct me if i am telling crap.

Ok, now on: the heart of the BD consists like most of the old analog tonal druminstruments of an active (with an opamp) resonant-t-filter which is set into a damped oscillation by a very short triggerpulse. The incoming energy causes the resonant filter to swing a bit, like hitting a metal-triangle. Ideally a sinewave should come out on the other side. But it is a swinging filter with a special resonant frequency and with different electronic parts, each with its own character and behaviour ... i am not sure but i bet it has some very tiny overtones somewhere. Some of the output-energy is fed back to lengthen the decay.

Nothing special so far, just an ordinary damped sine oscillator. But NOW the magic comes:

The t-filter consists of 2 serially aligned capacitors which feed back the output to the negative input of the opamp. In between these serial capacitors is a resistor going to mass. These 3 parts are mainly responsible for the base frequency or - in other words - the wavelength. Altering the resistor between the capacitors alter the frequency - thats exactly what the bassdrum does for a VERY short period of time.

Now, the triggersignal not only shoots into the t-filter, it is also guided to a chain of 3 transistors which - at the end of the chain - meet this frequency-responsible resistor mentioned above. Now when the trigger hits the circuit, this chain of transistors manipulate for a short time the potential between t-filter-center and mass and - cite taken from the original 808 manual - 'This changing frequencies will sound a punchier crisp bass' - hm, is that good english? I guess their engineering capabilities were by far better :).

 

 

 

Theory - How to simulate this in a microcontroller?

Hm, well, i dont know. At the moment this is just theory, i am still experimenting...

1. At first we need a good sinewave, not a triangle, a sinewave. I try to make this with a lookup-table. That's a simple list of values, describing the shape of a sinewave. To save flashram we can take just a fourth of the complete wavecycle and mirror it mathematically in horizontal and vertical direction.

2. Then we need two envelopes: one for the Amplitude (or 'Volume) and one for the short frequencylift at the beginning. Well counting from 255 to 0 IS indeed an envelope, but its a linear one. Charging or discharging a capacitor inside an analogue envelope works logarythmic. Means: if discharged, a capacitor looses (in consideration to time) a lot energy at the beginnig and less in the following milliseconds, or seconds :)

So i guess i need a digital logarythmic envelope. My mathskills are not big enough to program this on the fly and my tiny13 doesnt offer such a formula on the first sight. So i decided to make another lookup-table with precalculated values. When you look down on this page you will find two flashtools to calculate such lookuptables for sinewaves and logarythmic envelopes.

3. The third element i need is a Digital-To-Analog-Converter to get the beautiful sinewave out of my µController. We havent got much pins left, just one or two. I decided to convert it to analog with a PWM-Timer and a steep lowpassfilter.

 

functinal diagram of this module

click it to get it in highres in new window

Practice - result differs from the plans, but it's cool

PWM

First i had to put up the lowpassfilters to see what the controller puts out on its pins. This was easy and satisfying. Its just a 100k-pot going to an opamp and a small capacitor in between. To the right you see three settings for the pot on the envelope output. If you set the resistance of the pot to small, the lowpassfilter lets through to much overtones. As you see in the upper pic, the envelope is VERY sharp, but we also see (and hear) the steps of the timer-pwm. If you set the resistance to high, the lowpass gets so low that it softens the envelope to much as seen on both lower pics. The perfect setting lies somewhere between the upper and the middle pic.

SINEWAVE

The sinewave with lookuptable first worked perfect for its own. But in combination with all the other duties the tiny13 has to do in every mainloop-cycle there was a glitch in every wavecycle. I didnt find out where this came from, something timingcritical, dont know. One main issue is, the C-compiler has an optimization which can do weird things to your code. But i definately NEED this optimization to get all my tasks in 1 kb the tiny13 offers. After hours of unsuccesfulness i decided to drop the lookup-sine and make a simple triangle to overcome the problem. I also had some trouble with space for code and didnt want to abandon on features like looooong decay or frequencybend. The triangle saved some space.

ENVELOPE

Strangely the envelope lookup-thing worked perfect, even the sine-lookup didnt. I had to change some parameters of the envelope manually to make the values fit for the VCA not to close to early (VCA closed around 35, not at 0). But the generators down on this page were quite interesting to experiment with. As you see to the right, the PWM-Lowpass has large influence on the envelopeshape. I set a pot on the front to slightly alter the value of the PWM-LP-filter. This softens or emphasizes the attack.

 
 

How it sounds

Its cool, better than i expected. It has somewhat more fundament than my first bassdrum so i decided to make this the main Bassdrum. An intersting thing is, the trinagle still has some aliasing overtones giving the sound kind of 'hybrid charm'. When the frequency bends, the overtones also change.

examples following

 

Tools

I programmed two handy flashtools for public use. Little µControllers dont have a Math.sin(PI/2)-Function. They need to store the shapes values in a lookuptable.

Use this to precaculate sinewave-values:

Use this to precalculate envelopes:

simple schematic for the pwm-lowpassfilter

platzhalter