This is the first draft of an Autonomous Bassline Generator. The melodies are generated by a mathematical algorithm using the value of the Melody control as a seed. So it’s deterministic, not random.

An ATtiny44/84 chip generates Pulse-Width Modulated waves, into an analog resonant band-pass filter, whose frequency is modulated by a photocell. The ATtiny also is flashing an LED to the envelope of the notes, so you can either point the photocell at this LED to get cool old-skool analogue filter sounds, or point it at light/darkness in the room to control it manually. There’s Tap Tempo, as well as IR send/receive for syncing up to other devices!

I’ve sinced added some more features to this, I’ll post a video soon

This is for an up-coming workshop series with the Church of the Friendly Ghost at the Salvage Vanguard Theater in Austin. It’s called “Handmade Music Austin”. We’ll have some more copy on it soon… Eric Archer and Bleep Labs are also making compatible devices…

**The Algorithm:**

The Melody control gives us an 8-bit number (0-255).

Let’s just assume our melody length will be 8 notes (it’s actually more interesting to use longer and variable-length melodies, but let’s keep it simple for now)

Step 1: Represent the 8-note melody by a string of 8 zeros

0 0 0 0 0 0 0 0

A zero means silence, and higher numbers mean higher notes. So an ascending scale would be 1 2 3 4 5 6 7 8. I happened to tune my device to a major scale, but anything could be used.

Step 2: Look at the first bit.Â If it’s a “1” then add 1 to every other note in the melody.Â So we have:

1 0 1 0 1 0 1 0

Step 3: Look at the second bit. If it’s a “1” then add 1 to every *third* note. So we have:

1 0 1 0 1 0 1 0Â (from first bit)

1 0 0 1 0 0 1 0 (from second bit) = 2 0 1 1 1 0 2 0

Starting to look like a melody?

Step 4: Keep repeating this process, taking the *nth* bit and adding 1 to every *(n+1)* bits. To avoid always adding a 1 to the first bit, the algorithm starts each bit-adding where the last bit-adding process left off, and just wraps around to the start of the melody when it gets to the end.

2 0 1 1 1 0 2 0 0 1 0 0 0 1 0 0 (start at second note, where we left off last) = 2 1 1 1 1 1 2 0 0 1 0 0 0 0 1 0 = 2 2 1 1 1 1 3 0 ...etc

There’s a little more to it, but that’s the jist.

## 2 thoughts on “Autonomous Bassline Generator”

Comments are closed.