Sine Waves

advertisement
Sine Waves
The French mathematician François Marie Charles Fourier (1772­1837) discovered that any periodic wave can be represented by the sum of diverse sine waves. A sine wave or pure tone is a sound in which the air pressure rises and falls sinusoidally with time. We can see in this Pd patch sineGraph1 how a periodic curve rises and falls with time ­run Pd and open file sineGraph1.pd ­. sineGraph1.pd
In this case this periodic wave vibrates 440 times per second, corresponding to the A above middle­C note of a keyboard. One completed rise and fall of the curve is called a cycle. So we can say either that this wave has a frequency of 440 cycles per second or 440 Hz ­hertz­. The patch resembles those created in the previous section, but with the addition of a time­
domain plot of the signal (every 50 ms graphing the values of the last 999 time samples which have been output). It uses message objects to turn on and off the computation. Close that patch and open sineGraph2 which adds a number box for frequency control. If we increase the frequency four times ­1760 Hz­ we will have a tone two octaves higher than the previous one. Note that there four times as many oscillations in the same number of graphed samples.
sineGraph2.pd
Now, on to sineGraph3 with a vertical slider which lets you graph oscillations from 0 to 5000 Hz.
sineGraph3.pd
There are three attributes to a sine wave: period, amplitude, and phase. We've just covered periodicity. The amplitude “represents the maximum displacement of the varying quantity from its average value” (pg. 39, textbook, John R. Pierce in The Science of Musical Sound).
sineGraph4.pd
You can observe how the change of amplitude does not affect the periodicity ­or number of cycles per second­ of the wave. In the env1 patch you can impose an envelope on the amplitude to vary it between 0 and 0.1 either slowly over 5 seconds, 0.5 seconds, or instantly. A ramp generator object called line~ is used to generate straight line signals that specify a target amplitude value and time to get there. When you open the patch there is no sound until one of upward­going ramps are triggered. Note the click that happens in instantaneous changes.
env1.pd
In env2, line~ gets a different set of messages and three graphs are shown. The first is the sine wave at 440 Hz. The second graph shows us the signal coming from line~ ­ in this case, a ramp down from 1 to 0 in 500 milliseconds, and finally the third graph is the product of multiplying the sine wave by the descending amplitude. env2.pd
In the next, env3, we take a standard approach found in many synthesizers to determine how a note rises and falls in time. The patch uses the adsr envelope generator to control its amplitude. The adsr envelope generator has five arguments: level, attack time (a), decay time (d), sustain level (s), and release time (r). The last four arguments control the envelope of the oscillator. Attack time, decay time and release time are in milliseconds and sustain level is in percent. First of all, with the mouse change increase the dB value of the output~ object and then click on the attack message to trigger the patch. You should be listening a 440 Hz frequency. By clicking on the release message the frequency should fade out. Change to Edit Mode and then change some of the arguments of the adsr envelope to see and listen how they alter the sound. env3.pd
The third attribute of a sine wave is the phase, “the time when the wave crosses the axis when going upward” (see textbook for a longer explanation). The osc~ object is cosine phase, meaning the first sample it emits is its full positive value. And while frequency remains 0 Hz it will continue to emit that value, however any non­zero value will start it rotating through the sine function. Two signals added together will sum their outputs. Two identical signals 180 degrees out of phase (π radians) will exactly cancel out, summing to a constant 0 signal. The “beating effect” of slightly mistuned oscillators is the result of alternating reinforcement and cancellation. Try the next patch and see what happens to the sound when the two oscillators are really closely tuned. Hint: shift+mouse on a number box will move the number by smaller increments, good for hearing beating.
twoSines1.pd 
Download