PC-350: Arduino Synthesiser

Contents

Aim

To create a device that takes a users input and based upon that input play sounds. I want this ‘synthesiser’ to be simple to play, requiring little or no skill. Therefore, allowing the user to experiment with the sounds they are producing instantly as opposed to learning the technicalities of it first.

Research

Experimental Musical Instruments

“The EMI project aims to create and experiment with more suitable instruments that will not be a boundary for the performers who do not have any traditional musical background. […] Nontraditional and computer based applications simulate the possibilities of creative freedom in music and enlarge this creative freedom into open form musical activities” – M.Koray Tahiroğlu, Experimental Musical Instruments

The Experimental Musical Instrument project in summary uses the Arduino and pureData to create musical instruments. The Arduino is used to measure physical activity through sensors, buttons, etc. pureData is used to generate the sound using the data collected by the Arduino. They say that some instruments last the test of time while others just disappear and that Experimental Musical Instruments can too last the test of time; even if these instruments are free of the traditional tonal structure and interface of other instruments. This freedom of use and sound could even lead to more creativity.

The Experimental Musical Instruments should be powerful enough for the performer to really enjoy playing the instrument. This can mean that the interface can be very simple but pureData takes that input and turns it into a very powerful sound. This response from the instruments leads to the user enjoying the results a

nd therefore wanting to explore everything they can do on the instrument.

I want to create sound straight from the Arduino rather than use pureData or Max/MSP. The reason for this is because I want the device to be standalone and not require a computer to run. This makes the device more physical instead of having the computers existing hardware generate the sounds. This is my preference, however, and I expect the sounds produced using pureData are of high quality. I like their philosophy that lies behind the instruments that allows anyone to play instruments and produce interesting sounds easily. This creates more performers and doesn’t alienate people like traditional instruments might.

PC-350 Arduino Synthesiser

Interfaces

Arduino and Nintendo Wii Nunchuck

This is a tutorial explaining how to get the X and Y axis values and the X, Y and Z accelerometer values from a Nintendo Wii Nunchuck into the Arduino. I like the idea of using the motion of the arm as an input for the device and the implementation is very simple. There is even an adaptor that allows you to use the nunchuck without any modifications to it. The nunchuck costs £10 to £15.

Arduino and Nintendo DS Touchscreen

I found a very thorough tutorial written by ‘kousaku’ explaining how to connect a Nintendo DS touchscreen to the Arduino and read the X and Y values of the touch. It also explains how touchscreens work. This version of the tutorial (link) is a translation of it into English. However, the original version has clearer diagrams and photographs.

I prefer the idea of a touchscreen as opposed to a nunchuck because there are only the X and Y values to compute and a screen is a more familiar interface for users. In addition, I have found many resources explaining how to get it to work correctly and an existing project that uses the technology.

Sound Out

The Arduino cannot play high quality sounds straight ‘out the box’. There are several methods of producing sound from the Arduino:

  • Bit-Banging This sends an electrical signal straight to the speaker pin, it generates square tones that are very harsh.
  • Hardware PWM uses timers and PWM to create reasonable quality audio (could be used for playing recorded sounds).
  • R2R/Hardware DAC uses resistors or a chip. It creates high quality waveforms (and audio).
  • Voltage Controlled Oscillators uses PWM to control oscillators that play sounds, it produces nice smooth waveforms.
  • MP3 Decoder Chip this is a chip that reads and plays mp3s.
  • Controlling a computer this is using the Arduino as the sensor and sending the data to the computer and have the computer do the hard work of sound generation (using pureData/MaxMSP for example). This method is used in the Experimental Musical Instruments mentioned above.
  • Physically play an instrument using motors/servos to play keys on a piano or hit a cymbal.

These methods are listed in the article ‘Arduino Sound’ at uchobby.com. You can find part one here , part two here and part three here.

FreqOut from the Arduino playground is a simple implementation of a tone library. It defines notes as frequencies and allows them to be played through a speaker. In order to play tones on the Arduino, you need to use timers to space out the notes. Otherwise you end up with lots of notes being played at once.

This tutorial explains how to create a very simple synthesiser using an LDR, a speaker and the Arduino Tone library. The Arduino tone library looks very useful and makes it incredibly simple to produce tone using the Arduino. All you need to do is plug in the speaker to a pin on the Arduino with a resistor and then use tone1.play(NOTE_A4); to play that note.

User Scenario

These are some examples of the types of people that may use my device:

  1. Someone who is curious about what the device does. This type of person will see the device and possibly ask to try it out. They could be any age or type of person as long as they are curious enough to act on their thoughts.
  2. A musician or performer could use the device in a live performance. This type of person will be limited to people who like performing. The age of the person could be any age but I would imagine it would be between 18 and 30.
  3. A musician could use the device in a song or recording. The type of person that would do this would be an experimental musician due to the fact that the device is not a traditional musical instrument. The age group could be any age but as before, I imagine it would be around 18 – 30.
  4. An Arduino enthusiast might enjoy using the device because they are interested in Arduino and want to see it working and how it works. This person could be any age but would have to be an Arduino user.

Development

I have decided to use a Nintendo DS touchscreen as the main interface for the device. I could use any touchscreen with a four-wire set up but I have decided to use the Nintendo DS screen due to its size (3 inches). I want to use the Arduino Tone library to generate the sounds based on the position of touch on the touchscreen. I also want to include a volume control and a headphone jack in the device for increased functionality.

Requirements & Analysis

Components

  • Nintendo DS touchscreen (Link)
  • Potentiometer for volume control (Link)
  • Headphone jack (Link)
  • Speaker (Link)
  • Solder and Soldering Iron
  • Arduino, Breadboard, Wires and USB cable

What I Need to Do

  • Connect the speaker to the Arduino and control it programmatically
  • Connect the touchscreen to the Arduino and get the readings from it to the Arduino
  • Connect the volume control and headphone jack
  • Fine tune the program to get the best sounding results

The program

This is pseudo code explaining how I think the program powering the device will work:

1
2
3
4
5
6
7
Load the Arduino tone library
Set up touchscreen and speaker pins
If touchscreen is pressed:
  Take touchscreen X and Y and play a tone on the speaker using the tone library

Design & Implementation

The speaker

Firstly, I got the speaker working with the Arduino. To do this I used a PNP general purpose amplifier in order to boost the signal loud enough for the speaker I was using. It was a fairly simple circuit and I followed my previous tasks to figure out how to wire it up correctly. Below are the schematic and breadboard of the Arduino:

To test the speaker is working correctly, I found a program in the Arduino playground called PCMAudio which plays back a very small sound clip (the Mac start-up sound). I made sure all the pins were correctly defined in the code and uploaded it to my Arduino and all worked fine.

Next I decided to look at how I could generate sound from the Arduino by sending signals straight to the speaker pin. I wrote a simple program that sends 0 – 255 to the speaker with a delay of 100ms between each send. This produces a tone output that rises in pitch. I also implemented a random tone function that sends a random value between 0 and 255 to the speaker with a delay of 500ms between each send. This produces a blippy jumpy sound of random beeps. Finally I removed the delay of 500ms to experiment with the results and found that this produces static from the speaker like on a radio or TV. A link to my code is below, please note that only one of ‘Tone’, ‘Random tones’ or ‘Static’ can run at once.

PC-350 Arduino Synthesiser SchematicView the code

The touchscreen

I purchased 2 DS touchscreens from eBay along with some P6 connectors. The P6 connectors hold the ribbon cable that comes out of the touchscreen, this tutorial recommended that I bought the connector. However, I found that the connectors were far too small to solder wires on to, the wires I had were at least double the connectors size. Instead of using the connectors I decided to solder the wires straight onto the ribbon. To do this I had to cut the ribbon connector into four sections and then attach a wire to each of the four sections.

The four wires on the touch screen correspond to the Top, Left, Bottom and Right of the screen (from left to right). Using this image as a reference, I wired up the touch screen to the Arduino. I kept my set up from before with the speaker, so the touch screen went onto that. The four wires of the screen need to go to four digital pins so they can be turned on and off. In addition to this, the Top and Right wires need to also go to two analog pins so their readings can be read. Below is the schematic and breadboard setup:

 

For more detail: PC-350: Arduino Synthesiser

 

 


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top