Floppy Drive Orchestra

Last year, I came across several videos of people making floppy drives into a sort of musical instrument. I thought it sounded and looked incredible, and thought about trying it myself. There’s a few libraries and even full-on repositories of code for making musical floppy drives, but I wanted to do it from scratch. I already had a Raspberry Pi to use so I started with that, even though most people used either Arduinos or hand-made circuit boards.

Before I continue, I’ll give a quick explanation of how music can be made with floppy drives. Floppy drives have a read/write head in the middle of them which is connected to a stepper motor. This head can move forward and backwards one step, which is equivalent to moving one track on the disk. This movement is quite noisy, and so by stepping the motor at the frequency of a musical note you can create an audible tune from it. Using the electrical output of a GPIO header on my Raspberry Pi, I was able to signal the drive head to move back and forth whenever I desired.

 

img_5069

First off, I got a bunch of old computers from the local thrift store and salvaged any floppy drives I could get from them. I kept the towers and their various contents for later projects.

 

img_5078         img_5076

Next, I connected the floppy drive to an ATX power supply that I had harvested from one of the computers I got from the thrift store. I only needed to use one wire to trick the power supply into thinking it was powering an actual computer and then everything worked perfectly. I’ll be making a post on my blog later about hot-wiring an ATX power supply and building a control interface for one.

 

img_5074
I short-circuited pin 12, labeled ‘Drive Select B’, to turn on the floppy drive and enable usage of its motor.

 

 

I wrote the first attempt of the Florchestra in Python, where only one note could be played at a time but on several floppy drives at once. Above is an example of this that I uploaded to YouTube.

This worked good for a little bit, until I realized it didn’t sound very interesting with only one ‘voice’ in the music. I began the task of programming in a sort of multi-track solution to this – and immediately ran into a problem. Upon testing it out, the code ran so slowly that the high frequencies of each note weren’t able to be played, and instead came out as a grinding, jumpy sort of noise. Disappointed, I spent weeks researching how I could fix this until I had noticed the two key problems in my design: firstly, as Python is an interpreted language it doesn’t run nearly fast enough to handle sending an electrical signal once every 1,000 microseconds while also juggling what note each frive should play and when. Secondly, I realized that because a Raspberry Pi has a Linux operating system in the background, my code does not have precedence. There are plenty of system calls and background OS things that take up CPU cycles and can push parts of my program onto later CPU cycles. I had tried a second approach by using a system timer that gave me an accuracy up to 20 microseconds, where it would just go off at the frequency of the musical note and send an electrical signal. Only problem was that as previously stated the OS can and does delay things like that in favor for the kernel and other ‘more important’ processes that I frankly don’t need.

Since I didn’t want to spend the time and money ordering an Arduino online, and definitely didn’t want to squeeze every ounce of life out of myself by writing an OS specifically customized just to sending signals to floppy drives, I decided to try two different things.

1.) I switched over to C++ from Python. I used the wiringpi library for GPIO control.

2.) I split the work onto two different computer chips (since I had just gotten a new Raspberry Pi from winning a programming competition) – one for parsing a musical piece, and the other for receiving a musical note and sending out a signal at its corresponding frequency to the specified floppy drive.

img_5072
On the left is the conductor, which reads MIDI files as well as real-time MIDI from my electric piano. The right screen shows the player, which has an engine that toggles each pins voltage on and off according to each frequency.

This actually worked amazingly well and I settled on using it for good. The two floppy drives communicate with a serial connection on two wires strung between two pins on each Pi’s GPIO header. One instruction consists of a byte of data: 5 of the bits determine which note out of a range of 32 will be played (the 0th note is silence), and the other 3 bits determine which out of 8 possible floppy drives to play the note on. The decoupled nature of the two computer chips means that I can put any code I want on the conductor as long as it sends a valid 1-byte instruction to the player. This let me program both a MIDI file parser and a real-time MIDI parser while not changing a single thing on the player.

 

img_5070

The last thing I added to the project was a set of LED lights where each one corresponds to a floppy drive playing a note. Off means no note is being played, and on means a note is being played. Simple enough. In the end, this project turned out incredibly well and looked pretty nice with the addition of the lights. Each of the 6 floppy drives can play their own note, meaning that songs can get pretty complex and sound rather interesting.

Here’s a few links for you guys:

Check out the GitHub repo

Watch my florchestra videos

Average Wizard

Hello there! My name is Wes, but I go by Average Wizard on here. I'm a 17 year old dude going for my Bachelor's in Computer Science. I do technological projects from time to time, and sometimes musical stuff as well.

Leave a Reply