‘Micro sequencer’ an Arduino musical instrument

Introduction

Micro sequencer plays a sequence of 4 randomly chosen tones on Arduino. Tempo (playback speed) and tone length (more like a tremolo) can be controlled via two analog inputs. Four buttons control the octave of the tones where another button is used to generate a new random set of tone sequence. The sequence can be stored in the non volatile memory by pressing another button.

Circuit

The board is shown in the picture above. Its better to build the circuit on a bread board before soldering it on a piece of strip board. The schematics for the micro sequencer is shown below:

As shown above 6 push buttons are used on digital inputs (pull up resistors, R1-R6 can be any value from 1K to 10K ohm) and two potentiometers are on Analog inputs (potentiometers can be any range from 1K to 50K ohm).
If you intend to increase the number of buttons or analog inputs simply copy the same component and connections and change the code accordingly. You can use a variety of sensors (LDRs, IR/Ultra Sonic distance meters, Force sensors, etc.) instead of the potentiometers.
Code

This program uses the tremolo effect that has been developed by  Jaxon BK.
Program reads the inputs listed below and plays back a sequence according to the inputs on digital pin 9 of Arduino. The music signal needs to be amplified with a small amplifier like an LM386 amplifier.

Button 1: Generates a new random tone sequence (keep pressing until you hear a beep)
Button 2: Store the sequence to the non-volatile memory (keep pressing until you hear two beeps)

Button 3-6: Holding these button will affect the octave of the tones being played at that moment. (3 Lowest, 4  Low, 5 High, 6 Highest octave)
Analog input 0: Controls the tempo (playback speed)
Analog input 1: Controls the tremolo (similar to length of playback of the note)
The tone values are also printed on serial port of the Arduino board when button 1 or 2 are pressed. So if you would like to see the frequencies you can open the Arduino serial monitor. Saved data will be loaded upon reset. So, each time you power on or reset your Arduino the saved tone sequence will be loaded from the non-volatile memory.
Do not leave the button 2 unconnected! otherwise the program might try writing to the non-volatile memory all the time.  Pull these pins high if you do not intend to place a switch in your final circuit.

Download the code from here.

More info
Here is a simple guide to music and music alphabets. Here you can read about mapping of frequency to notes.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s