It all started as a day dream on a long road trip – what if a Geiger counter could be used to produce music instead of those hideous clicks, to illustrate the beauty of the radioactive world around us? With the help of the WM Makerspace, an Arduino, a MightyOhm.com Geiger tube, a few hours of coding, a few more hours of expanding and de-bugging, and a daily latte, a great and scary thing has been created.
You can hear the creation at work here.
The short explanation is that the Arduino takes a time interval, in milliseconds, between two successive ‘hits’ in the Geiger tube, and uses that randomness to send a MIDI signal (the language electric keyboards commonly use) to a computer to play a random tone, at a random volume, on a random instrument. Radiation initially used was simple background radiation – cosmic rays, earth’s radioactive elements, anything whizzing by us all the time. Later on, I used a small radioactive sample extracted from a common household smoke detector, held close to the detection tube, in order to get more notes per minute, and to ‘play’ the instrument – if I heard something I liked, I would move the sample away, so that the note held for longer.
The result is a synthetic, avant-garde, beautifully confusing orchestra of sounds, with a little bit of human input to make the builder feel relevant.
A more detail explanation of the project follows the break for those interested.
The project involves three main components:
2. Arduino Code
3. MIDI Signal Structure
First, the hardware used was an Arduino Uno and a MightyOhm Geiger tube. Arduinos can be made to do just about anything under 5 volts, with their extensive open source library and giant online community. The Makerspace has plenty of these just sitting in their boxes, waiting to be made useful! The Geiger tube had a handy output feature, which had three pins: Vcc, Signal, and Ground. The Signal Pin would send out a 100ms, Vcc/2 pulse every time the Geiger tube registered a hit. The Geiger tube typically runs on 2×1.5V batteries, but I rigged it to be powered by the Arduino’s 3.3v output, which slightly overpowers the system, but it still functions well. The signal pin was connected to one of the Arduino’s Digital in/out pins, so that it may be read by the program.
Here’s a link to the Arduino Code
The basics of the code are this:
Every time there’s a Geiger hit, record the time since the last hit. Take this time in milliseconds, divide it by 128, and save the remainder. Do this twice to get two numbers on [0-127] – note and ‘velocity’, defining a MIDI signal.
When two hits have come in, send out three MIDI signals – one to stop the last note that was playing on this channel, one to change the instrument, and one to start playing a new note on that new instrument on this channel. Do this until you’ve used all 9 channels. Now move the ‘note on’ matrix to the ‘note off’ matrix so you stop the previous note next time you play something on a channel. Loop again through the channels.
Midi Signals are pretty interesting. Here’s a little documentation on them: MIDITechspecs. Basically, it encodes every note into just a few bytes of information – much less than an audio recording of any instrument. The simplest note has just two pieces of information: note and velocity. Each of these is presented in a data byte (2^8 = 256), but a single bit is taken to denote the type of byte, meaning only seven bits (2^7=128) are available. The 128 notes run through a sort of super-piano range, and the velocity is analogous to the volume, with 128 being full. In addition to the note-playing bytes, I utilized the necessary note-on and note-off status bytes to initiate sound on a channel, and to replace sound on a channel. Initially, I only used note-on signals, and created a very soul-stabbing piano sound. Another thing to note is that MIDI defaults its channel 10 to be drum sounds, and I could not simply overwrite it with a new instrument, and so my channels used are only 1-9, which creates a decent number of notes without being overwhelming. Instrument change is a status byte like noteOn or noteOff, using one of 128 instruments. I’m a little unsure of how the back-end of MIDI encoding works, but the basics are that there’s a certain combination of frequencies, timbres, and volume variances which sound like each instrument. Given a note and a velocity, a MIDI library will, depending on its definitions, output some music over a speaker. One can download extra MIDI libraries, but Windows (pre-8) and Macs typically have a basic library built-in.
I also had to use an outside software called Hairless MIDI to read from the serial port (USB), and direct information to a MIDI player (VirtualMIDISynth). Once that is complete and it’s all hooked up, the computer’s speakers will play random MIDI tones, generated by the inherent randomness of radiation intervals. If you’d like any more information about the project, offer suggestions, or would like to see the darned thing in action, feel free to email me at email@example.com .