MONK is a Programmable Digital Synthesizer made from scratch using Arduino and PureData. The Arduino microcontroller acts as an input device, reading the values of six potentiometers and transferring the values via USB to a computer that runs PureData. In PureData, these values are passed to parameters that control sound, so the whole setup turns into a musical instrument. You may programme your own patches to completely change the device’s audio function, or even use it as a controller for other purposes (for example: graphics control or interactive applications). The featured video is a presentation of MONK‘s main patch in action, while this blog post is a presentation of the system’s inner – workings. If you read on, you will find all the necessary information on how to build your own.
The MONK – box:
This is the MONK’s featured case. It is a prototype, made out of thick cardboard, painted black with indian ink and coated with wood-varnish. I know that the choice of materials may seem a little weird, but this is what I had in hand at the time I built it, and it actually did the job! The important thing is that it feels sturdy enough and it holds the potentiometers in place!
If you decide to build your own MONK you may, of course, design your own case, 3d-print it, cnc machine it, laser-cut it, use a prefabricated electronics box, or even go recycle-style and use an old box that you already own.
A look inside:
As you can see in this picture, I have taken some extra-time to tidy up the insides of the box. I made an intermediate (breakout) board on which the potentiometers hook with Molex connectors. This board plugs firmly on the Arduino, and this way it is quite sure that things will stay in place.
This approach, however, is optional. You might as well use a breadboard and some jumper wires to make the necessary connections, and things will probably work just fine, as long as you take care so as not to disconnect something by mistake when opening or closing your box.
Make your own (how to)
The following sections showcase MONK’s inner workings. The article can be used as a tutorial, as it includes all of the necessary directions for someone who might want to build their own and modify it to better suit their taste. Although I tried to make the description as simple and clear as possible, one may find it difficult to follow through, if they have no prior experience with Arduino and / or PureData. If that is the case for you, please do not hestitate to leave a comment or ask for directions / clarification.
Also, please keep in mind that MONK is part of an ongoing project. It may evolve over time, and the best way to stay updated is to keep an eye on my github account, in the “Programmable Digital Synthesizers” repository. This is where the latest source-code, any new example PureData patches as well as circuit-diagrams can be found. The repository is soon going to host some similar projects as well.
MONK‘s hardware setup is pretty straightforward. All you really need to do is hook the six potentiometers to the Arduino correctly, following the Circuit Diagram.
There is no need for an external power supply, as the Arduino will be connected to the computer via USB all the time anyway, and the USB connection will also serve as its power supply.
Before you start Making, make sure that you have all of the necessary parts!
List of hardware parts:
- (1x) Arduino Uno Rev3 (or compatible)
- (6x) Linear Potentiometer, 10KOhm
- (1x) Usb – Cable (for data transfer from Arduino to PC)
- (1x) Breadboard (with enough space to fit the six potentiometers)
- (~ 30x) Male – Male Jumper cables
- (1x) Computer that runs PureData (any operating system will work)
In order to programme, use, or modify MONK, you will need to have some software installed on your computer:
- The Arduino IDE and
- The Pure Dada audio programming language
Both of these software tools are free, open-source and cross-platform (they run on Windows, MacOS and Linux), so you shouldn’t have any trouble getting them to work on your system.
The Arduino IDE is used in order to “upload” the necessary program to the Arduino microcontroller. The Arduino’s programme does some very basic stuff, so you will most probably not need to change (or update it) it for some time.
You may download the latest version of the Arduino IDE here.
PureData audio programming language is used as this project’s audio engine. It runs on the host computer, constantly receiving data (potentiometer readings) from the Arduino microcontroller and utilizing them to make some sounds (depending on which patch you are using).
You may download the latest version of PureData here.
After you have installed the latest version of PureData vanilla, make sure that you also install the comport and zexy externals, which are necessary in order to work with the existing MONK example patches. You may install them by going to Help -> Find externals.
Programming the Arduino
The Arduino microcontroller is used as an input device in this example. It reads the values of the six potentiometers (which are connected to analog pins A0 to A5) and transfers those values to the computer via USB. The following programme takes care of the data transfer, by using a custom protocol. The integer values of the potentiometers are split into separate bytes which will be re-assembled in PureData. You may follow the code to see how exactly this is done.
All you have to do for now is upload this programme to your microcontroller, using the Arduino IDE. Afterwards you can quit the IDE (you will not use it again until you need to update it to a newer version).
Note: The code below is for review purposes, only. Make sure to get the code that you will be using from the “Programmable-Digital-Synthesizers” repository, from this folder.
Making some sound
After you have set-up your hardware and programmed your Arduino, it is finally time to try and make some Sound. Navigate to the “Monk-PureData-Patches” folder and you will see a list of available patches which you may use with your MONK to produce some sound or music.
The following image is a screenshot of the “Monk-Example-1-Monk.pd” PureData patch, which is MONK’s main programme. You may find it in this folder. Make sure, however, that you have the whole folder structure available because all of the examples are using abstractions that are located in the subPatches folder. If you do not have this folder in place, the patches will not work properly (if at all).
What this patch does:
The patch’s short description is that “it lets you control the frequency of two tones simultaneously, thus playing with their harmonic relation”. You may also define the waveform of each tone, as well as modify the mix value between them. For a more detailed reference on how that happens, have a look at the following list.
Parameter control (potentiometers P1 to P6)
- P1: controls the first tone’s frequency
- P2: controls the first tone’s waveform (mixes Saw and Triangle)
- P3: mixes between the two frequencies
- P4: controls the second tone’s frequency
- P5: controls the second tone’s waveform (mixes Saw and Triangle)
- P6: controls the Master Volume