Hardware Reference
In-Depth Information
Figure 5-1: Sound waves of varying frequencies and amplitudes
Figure 5-1 shows three piano notes: low, middle, and soprano C. Each one
shows the given frequencies at both low and high amplitudes. As an example,
to understand frequency and amplitude, focus on middle C. Middle C has a
frequency of 261.63 Hertz (Hz). In other words, a speaker, a guitar string, or
a piano string would complete 261.63 oscillations per second. By taking the
reciprocal of that value, you can find the period of the wave, which is easy to
see in Figure 5-1. 1/261.63 equals 3.822 milliseconds, which is the width of one
complete oscillation in the graph. Using the Arduino, you can set that period
for a square wave and thus adjust the tone of the note.
Importantly, the Arduino (excluding the Due's true DAC) cannot actually
make a sinusoidal wave that you might observe in the real world. A square
wave is a digital periodic wave—it also oscillates between a high and a low
value, but it switches instantaneously, instead of slowly like a sine wave. This
still creates a pressure wave that results in sound, but it isn't quite as “pretty”
sounding as a sinusoidal wave.
Search WWH ::




Custom Search