Playing basic sound bits
Playing a sound requires a sound source and a speaker. Of course, it also requires a listener who is able to hear sounds.
Natively, Arduino is able to produce 8 kHz and 8-bit audio playback sounds on small PC speakers.
We are going to use the tone()
function available natively in the Arduino Core. As written at http://arduino.cc/en/Reference/Tone, we have to take care of the pins used when using this function, because it will interfere with PWM output on pins 3 and 11 (except for the Arduino MEGA).
This technique is also named bit-banging. It is based on I/O pin toggling at a specific frequency.
Wiring the cheapest sound circuit
We are going to design the cheapest sound generator ever with a small 8-ohm speaker, a resistor, and an Arduino board.
The connections made here ensure an audible sound. Let's program the chip now.
The corresponding circuit diagram is as follows:
Playing random tones
As a digital artist and...