The FaderPhone microbit musical instrument

Today I made a (sort of) electronic musical instrument with a BBC microbit and an old BBC radio studio fader.

It’s wired up like I did previously, only I used pin 1 in place of pin 0 – as pin 0 is used for connecting the speaker.

Here’s the Python code, all 8 lines of it – perhaps someone musical can give me better arpeggiator numbers!

from microbit import *
import music

while True:
    fader_reading = pin1.read_analog()
    display.scroll(str(fader_reading),wait=False)
    music.pitch(fader_reading, 100)
    music.pitch(fader_reading+100, 100)
    music.pitch(fader_reading+200, 100)

UPDATE

I’ve now wired up the green cue switch to change the tempo and tweaked the arpeggio notes a bit. The cue switch on the BBC DK4/19 mixing desk was insanely clever. This totally analogue desk let you assign any source to any channel using a rotary selector. The cue switch would then put the appropriate green cue light on if a microphone was selected, start a tape machine if a tape machine was selected, fire off a cart if a cart machine was selected, or signal an outside source (e.g. give a remote studio a red light and put their desk in transmission mode).

Anyway, I digress… I’ve also made the A and B buttons on the microbit stop and start the thing as it does get annoying very quickly.

The circuit now looks a bit like this:

Here’s the new Python code:

from microbit import *
import music
c = 131
e = 165
g = 196
duration = 150
started = False

while True:
    if button_a.was_pressed():
        started = True
    while started:
        if pin2.read_digital() == 1:
            duration = 100
        else:
            duration = 150
        fader_reading = pin1.read_analog()
        music.pitch(fader_reading, duration)
        music.pitch(fader_reading+c, duration)
        music.pitch(fader_reading+e, duration)
        music.pitch(fader_reading+g, duration)
        if button_b.was_pressed():
            started = False
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>