Arduino Sound Program
- Due Mar 10, 2015 by 11:59pm
- Points 100
- Submitting a text entry box or a file upload
For this assignment you should write three different Arduino programs that make sounds/music. Each program should use a different technique for making/composing/generating music of some sort. The programs should be submitted to Canvas. Your Arduino circuit will be demonstrated in class or to the TA.
The slides on programming are here: Programming1.pdf Download Programming1.pdf
For making tones, we'll use the "tone" function in the Arduino programming language. You can read about that here. Links to an external site. On that page there are also links to example programs using the tone function.
Here's a long, detailed, description of what you should do for this assignment: Arduino-Tone.pdf Download Arduino-Tone.pdf
I've made a very simple tone example for Arduino. This example comes in two parts: SimpleTone.ino Download SimpleTone.ino is the example program, and pitches.h Download pitches.h is the "header file" that has the names for the standard notes. This is optional, but sometimes useful. To use these with your Arduino program, find the location for your Arduino library (in Documents on my Mac, likely in My Documents on a Windows machine). Inside the Arduino folder make a folder called SimpleTone. Put both of these files in that folder and you should be able to load and run the program from your Sketchbook inside the Arduino editor. Details are also in the programming slides: Programming1.pdf Download Programming1.pdf
Here are a couple other variations on the SimpleTone examples: SimpleTone1.ino Download SimpleTone1.ino SimpleTone2.ino Download SimpleTone2.ino. These files also use the pitches.h Download pitches.h file.
The RandomMelody.ino Download RandomMelody.ino example extends the toneMelody example that's in your Arduino program under Files-Examples-Digital-toneMelody. It uses the same arrays in the toneMelody example, but also uses the random() function to choose notes and durations randomly.
The Calibration.ino Download Calibration.ino example shows how to calibrate your CdS light sensor using the Serial print function, and the tonePitchFollower2.ino Download tonePitchFollower2.ino example shows how to use that CdS sensor to make a "Theremin-like" sound. Note that the tonePitchFollower2.ino Download tonePitchFollower2.ino example has a map() function that works best if you know the max and min values that you're likely to get from your sensor. Use the Calibration.ino Download Calibration.ino program to get these numbers!
Good luck - have fun - try things out - explore - and let me and/or Nick know if you have questions or problems!