Arduino is an open source hardware project based on single board microprocessors. It is cheap and easily found online, this means that it is a favourite of DIYers and home inventors for projects ranging from simple motion sensors, all the way up to drones and robotics. A question, which I've been investigating for the past few months, has been whether the Arduino can be used to build your own synthesiser. The short answer is that it can, but my investigation continued when I discovered that it can be quite hard, and inaccessible to a complete novice, this feature is my best attempt at providing answers to people wanting to get started with Arduino and build a synth for themselves.
A word of warning here, a lot of what is to come is still fairly complicated, and so I recommend you familiarise yourself with how synths work, and some audio basics before you dive in. As such, many of the resources which I link to, are chosen because they give a lot of background understanding, I recommend you read through all of the links to get a working grasp of the projects, and use this article as a guide on where to look, as much as a tutorial in itself.
The very first thing you'll need to consider is that the Arduino doesn't have a headphone jack. This means that it cannot send audio straight away. What we need is a DAC (Digital to Analogue Converter) I have found two methods of outputting audio from an Arduino: PWM, and an R2R resistor ladder. Both of these require a knowledge of soldering and basic electronics. A third option, not in the spirit of the project, yet still available, would be to use an Audio Shield for Arduino, a device which you place on the pins to do it for you.
The simpler method is to use one of the Arduino's PWM output pins fed into a low pass filter. This is by far the simplest method, yet it only outputs 1-Bit audio, and so is perhaps not the best for sound quality.
The better method which I have found is to use a Resistor Ladder (R2R) as a voltage divider to make a much better sounding 8-Bit DAC.
Image from Hackaday.
Amanda Ghassaei's Instructable on building an R2R Arduino DAC is an extremely valuable guide here, but to sum up:
- Each pin outputs 0-5V.
- The Arduino is programmed to send the digital signal via 8 of the pins.
- The pins can either be 0V (binary 0), or 5V (Binary 1) so there are two positions.
- With 8 pins with an option of 2 values each, you have 28 = 256 options/levels.
- These use a Resistor Ladder to divide the voltage such that 0-5V has 256 increments on the output.
Big Note for Consideration: Not all Arduinos run on 5V, some have progressed to 3.3V and it is, therefore, paramount to check which voltage your device runs on.
The output of the Resistor Ladder can then be attached to the signal pin of an audio jack, and the grounds connected.
The second thing you'll need is the code for the Arduino to actually make a sound. Mozzi is a sound synthesis library designed to be used in the Arduino IDE - the development environment which you create the code in.
Mozzi is a valuable tool as it contains much of the code prewritten, so for the complete novice, it is ideal. The coding part is certainly more difficult than the hardware part, and so I recommend you get familiar with it over several days. There are plenty of tutorials online for this depending on your personal level of Arduino experience.
The Arduino can be controlled with various inputs. The most simple way of doing this would be to incorporate push buttons such as the arcade push buttons to control the frequency of the notes. All of this will require basic Arduino coding and is easy enough to do with small Arduino kits which include the needed buttons in addition to guides on programming them in as inputs.
Image from this helpful tutorial.
More complicated control can be added, such as a MIDI input, which will require an understanding of how MIDI works. This has the payoff of much better control, and the ability to use a MIDI keyboard or sequencer to control the signal.
I will link to the easiest guide which I have found to get this working, but the more complex circuitry is recommended, notably using an optocoupler, to isolate the grounds. For schematics and guides at this level, this link will come in handy.
4. Extra Considerations
The Arduino is certainly not the most powerful, or even most optimised component for building a synth, however, it is a great intermediate-level device for building up with. It will provide rudimentary sounds, up to basic wavetable synthesis and can be combined with other hardware components for better effects.
I recommend that you don't try and use the Arduino as your sole processor for all of the synth's parameters, the more processing power that is required, the more the sound can deteriorate, and the clock speed does become a major limitation.
This is where optimised coding can come in handy, instead of using the Arduino to calculate every discreet sample value in real time, it is normally better to include tables, such as those present in the Mozzi libraries, and other libraries.
Adding filters can be done in the Arduino, but with an understanding of components and schematics, you can create analogue filters with a bit of reading up, which will free up processing, and may well sound better.
5. Other Musical Applications
The Arduino can be made into a sequencer, with a recent video by Look Mum No Computer showing how easily it can be done.
Aside from this awesome piece of kit, the applications are pretty much endless depending on the coding ability and inspiration of the creator. I recommend you look up and play about with various people's projects to try and get an understanding of what is possible, then when you come up with something new, make sure to write about it online so others can learn!
Become a Patron!