This project, “Melody Bakery”, was made from an old toaster. We equipped it with an Arduino Mega, took advantage of the toaster’s convenient, useful physique and transformed it into something totally different with completely new functionalities: A MIDI sequencer loop station, aka. “Melody Bakery”. This device can read a set of eight notes, making up two four-four times at the range of seven notes adding up to one whole octave. Furthermore, you can feed the toaster with a set of an instrument which the notes are to be played with and a background beat to make the produced music loop more enjoyable and usable for playing along with e.g. the bass or the guitar. The notes, instrument, and background loop can then be sent to an audio program on a connected PC.
The idea for this project came into existence when we found this old, non-functioning toaster. Since it didn’t toast bread properly any more, it could no longer be used for its original purpose. However, we agreed that it would have been a pity to throw it out. Therefore, we decided to bring back some live to this toaster again. The motto of this year’s course “reuse, reduce, recycle” supported our idea: To disassemble the toaster and rebuild it as something completely new. Since both our team members play several instruments as amateur musicians, we decided to create a device that has something to do with music and can be used, for example for practicing playing the guitar. In the end, we came up with a midi sequencer loop station that can read notes written on the toaster’s crumb tray.
From the beginning on, we tried to keep the basic concept of the toaster, where you put something into the toaster’s slots and then start a process by pressing down the handle.
Instead of putting bread into the toaster’s slots, we defined one slot as input for the instrument that the notes should be played with, the other slot was destined to serve as input for the background loop sound. For the notes themselves to be recorded, we used the crumb tray at the bottom of the toaster as a note sheet, and magnets on top of the crumb tray as notes. This way, we have a removable note sheet where notes can easily be added, removed, or modified by moving the magnets on the trays top surface. To scan the notes on top of the note sheet, the crumb tray simply has to be pushed into the toaster.
When everything is set, the toaster’s handle can be pressed down, which starts the MIDI-transfer of the notes, instrument, and background loop to an audio program on a PC connected via USB.
Let’s get technical!
The note sheet & note scanner
Let’s start with the feature of our “Midi Toaster” that required by far the most effort.
We decided to read the notes by taking advantage of the fact that white surfaces reflect light a lot better than black ones. Therefore, we painted the toaster’s crumb tray black to serve as the note sheet. Then we put a matrix of white spots on the top of the black tray, where each spot represents one note. One dimension (vertical) serves as the tone pitch and the other one (horizontal) for the temporal distance of the notes. While the first seven light sensors’ job is to read the notes, the eighth light sensor is to read the music’s beat. To make the notes easy to modify, we used small magnets that we covered with white duct tape instead of directly painting the notes onto the tray. This way, you can create a new melody simply by sliding the magnets on top of the tray’s surface.
With a distance of about 1-2 cm above the crumb tray, we attached eight light sensors and eight LEDs inside the tray’s slot. Each light sensor is being backlit by its own LED, which is positioned right next to the sensor. Whenever a white magnet note is positioned right underneath a sensor while slowly pushing the crumb tray into the toaster, the light reflected is a lot higher compared to the light reflected by the dark crumb tray. This way, it was possible to recognize a note as such to be recorded. It was necessary to measure and find the light threshold, above which a spot underneath a light sensor can be recognized as being white.
While pushing the tray into the toaster, the key to getting good results for the note detection was finding the best possible threshold for each individual light sensor. Different light situations forced us to find a more flexible solution than manually calibrating each light sensor in the source code. Therefore, we decided to implement a calibrate button in our toaster, which measures the brightness of the black tray without any white spots underneath. This helped a lot for our goal of making the scanner accurate enough not to skip any notes or not to see notes where there actually are none (e.g. when the light sensor on position three measures a value, it is influenced by the light reflected from neighboring notes on position two and four. In this case, light sensor number three should not deliver a false positive value).
Inside our toaster, an Arduino microcontroller functions as its heart and brain. Every LED, sensor and button is connected to one of its pins. Due to the high number of required analog pins for our project, we had to use Arduino Uno’s bigger brother, an Arduino Mega.
The logic the Arduino Mega runs is declared in our program written in C, which turned out to be around 600 lines of code. One of our program’s responsibility is to transfer the recognized notes, instrument, and loop sound into MIDI signals and send them to an audio program on a PC connected via USB.
Instruments and background loops:
The realization of adding different instruments and background loops was relatively straight forward. We used some card board toasts that we designed in Adobe Illustrator and cut with a laser, and attached some copper bands at different positions at the bottom. When inserted into the toaster’s slots, each toast closes different contacts with their copper bands and therefore can be recognized as different instruments and loop sounds.
Some of our problems and how we solved them:
Finding the right threshold for the light sensors:
Finding the best threshold for every light sensor for recognizing the notes was by far the hardest part of our project.
In the beginning, we planned on making it possible to scan 16 notes on the note sheet. This lead to several misinterpretations of notes by the light sensors. Some notes were skipped and others were read where there actually was just a note on its neighboring position. We then decided to half the number of notes on the note sheet to only eight notes. This lead to much better scanning results. An auto calibration button on the toaster, which we implemented during our testing period, helped a lot for detecting the right note values. Another measure we took in order to get better results while reading the notes was to increase the amount of LEDs lighting up the crumb tray. We doubled the amount from originally four to eight LEDs, so that in the end each light sensor had its own LED.
The toaster’s handle:
When pressing down the handle of the toaster to start the recording, it has to be held down by a magnet until the recording is done. To do so, we had to replace the original magnet which operated with 220 Volts by a magnet that can function with only 5 Volts, as this is the maximum current we can receive from our PC’s USB slot.
This step was unexpected for us and turned out to be quite time-consuming until the magnet held the handle in place just right.
Unfortunately, we had to find out that the Arduino can not directly send MIDI-signals via USB. Therefore, we had to order a MIDI-to-USB-adapter online. Luckily, this adapter cable could be purchased pretty cheap and the delivery only took less than a day..