DIY HACK - HOWTO make some sounds with Arduino! Sound Part 3 - Playing a Melody

Check out the Part 3 of “HOWTO make sounds with Ardunio” and learn to play melody.
Bit-Banging Sound
To bit-bang sound we toggle an output pin at the desired frequency. To play a musical note, we need to use specific frequencies and play the sound for a specific amount of time.Generating the desired frequency big-bang style means figuring out what the period or cycle time of the desired frequency is. This is easy to calculate, it’s the reciprocal (1/F) of the frequency. As we found in part 2, 1KHz is 1000 cycles per second. So, one cycle takes 1 one-thousandth (1/1000) of a second or 0.001 seconds (1 millisecond). We need to toggle the pin at this rate so we want to keep it low for 1/2 the time then high for 1/2 the time. Therefore we want to set the I/O pin low for 500uS, then high for 500uS and do this over and over for as long as the duration requires.
Related Posts:

HOWTO make Beer Thermostat with Arduino

Here’s a cool audio and video controller DIY using Arduino.
DIY HACK PROJECT - Audio Spectrum using an Atmel AVR MCU!

Click Here to View in Full Screen Mode
Wow, check out this cool audio spectrum analyzer you can make using an Atmel AVR MCU! Well, I’ve always wanted to make one of these but finally found it at HackedGadgets!
This is an experimental work to monitor a spectrum pattern in radio band, and is a continuous project from Audio Spectrum Monitor. To analyze the spectrum of an input signal, I chose an Atmel AVR microcontroller that used in the Audio Spectrum Monitor to process FFT. When think it easy, it can be thought that sample an input RF signal directly and analyze it will do. However, you will able to recoginize that there are some techinical difficulties from following reasons.















