Você está na página 1de 10

AC Waveforms And Synthesis

An important class of waves are those that can be described by a sine or cosine function. These are called sinusoidal or harmonic waves. The equations describing a sinusoidal wave are

v = V max sin( wt + ) where w = 2f The following animation shows how a sine wave is generated. http://www.citejournal.org/articles/v5i3seminal4/sine%20wave.html

The sine wave shown here can be described mathematically as: v = A sin 2 f t where A is the Amplitude (varying units), f is the frequency (Hertz) and t is the time T is known as the time period (seconds) and T=1/f Based on the equation, when t=0; v = A sin 2 f(0) = 0 when t=T/4; v = A sin 2 f (T/4) = A sin 2 f(1/4f) = A sin ( /2) = ; when t=T/2; v = A sin 2 f (T/2) = A sin 2 f(1/2f) = A sin ( ) = 0; and so on. Sound waves are created when a waveform as shown here is used to vibrate molecules in a material medium at audio frequencies (300 Hz <= f <= 3 kHz). If you wish to create a waveform such as the one shown in the figure, you would need to evaluate the function, v = A sin 2 f t, at discrete times, t (shown as the time instants of the red dots), 2

typically at equal time intervals. These time intervals must be "sufficiently" small (Remember the Nyquist criterion) to obtain a "smooth" waveform. This time interval is called the "Sampling Interval" and the process of breaking up a continuous waveform by specifying it only at discrete points in time is called sampling. The sampling interval, shown here is Ts; corresponding to that there exists a "Sampling Frequency", fs = 1/Ts.

Fourier Synthesis: Adding Sinusoidal Waves

Like all waves sinusoidal waves obey the superposition principle. This means that they can be added together to produce more complex waves. Jean Fourier showed that any shape wave can be represented by a sum of many harmonic waves. If the wave has sharp corners or small bumps it requires many short wavelength (or high frequency) sinusoidal waves to construct it. Building waves via this technique is called Fourier Synthesis.

In the above picture, the first two sine waves are added together to produce a third, different wave. The above chart represents an audio signal based on its frequency. This is called a frequency domain graph. The graph above is a frequency domain representation of a square wave. As shown in the chart above, a square wave is the summation of several individual sine waves. A single sine wave would only have one line. This is because sine waves, the simplest waves, have only one frequency.

In the above picture, a sine wave is added to its opposite. The result is silence.
Sawtooth Waves Sawtooth waves, also called saw waves, have a very strong, clear, buzzing sound. A sawtooth wave can be made by adding a series of sine waves at different frequencies and volume levels. The frequency of the first, loudest sine wave is what we hear as the frequency of the resulting sawtooth. This is called the fundamental frequency. Each of the other, progressively quieter, sine waves that make up a sawtooth have frequencies which are integer multiples of the fundamental frequency. These frequencies are called harmonics.

For example, an ideal sawtooth wave with a fundamental frequency of 100Hz would have harmonics at 200Hz, 300Hz, 400Hz, and so on to infinity, with each harmonic quieter than the last. Because the sawtooth wave contains every integer harmonic of the fundamental frequency, it sounds very rich to our ear. The fundamental frequency defines the pitch of the sound, while the harmonics change the character, or timbre, of the sound without affecting the pitch.

The amplitude of a given harmonic in a sawtooth wave is equal to the inverse of its harmonic number. For example, a sawtooth wave with a fundamental frequency of 100Hz and an amplitude of 1 would have a harmonic at 200Hz (100*2) with an amplitude of 0.5 (1/2), another harmonic at 4

300Hz (100*3) with an amplitude of 0.33 (1/3), and so forth. The more harmonics are added in this manner, the more the wave will look like the idealised sawtooth wave.

Square Waves

Square waves have a rich sound that's not quite as buzzy as a sawtooth wave, but not as pure as a sine. Old Nintendo game soundtracks were made almost exclusively from square waves. Like sawtooth waves, square waves can be generated by adding a series of sine waves with decreasing volume. However, the square wave contains only the odd numbered harmonics.

The amplitude of a given harmonic in a square wave is equal to the inverse of its harmonic number. For instance, a square wave with a fundamental frequency of 100Hz would have a harmonic at 300Hz (100*3) with an amplitude of 0.33 (1/3).

Triangular Wave

Triangle waves sound like something between a sine wave and a square wave. Like square waves, they contain only the odd harmonics of the fundamental frequency. They differ from square waves because the volume of each added harmonic drops more quickly.

The amplitude of a given harmonic in a triangle wave is equal to the inverse square of its harmonic number. For example, a triangle wave with a fundamental frequency of 100Hz and an amplitude of 1 would have a harmonic at 300Hz (100*3) with an amplitude of 0.1111 (1/3^2).
Phase Response
1.5

0.5

0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43

Series1 Series2

-0.5

-1

-1.5

Figure 1 Two waveforms of the same frequency in phase Figure 1 shows two sine waves that are in phase. The magnitudes are different so that you can see both waveforms if they were both were the same amplitude the graph would appear as a single sine wave.

1.5

0.5

0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41

Series1 Series2

-0.5

-1

-1.5

Figure 2 Two waveforms of the same frequency 90 out of phase

Figure 2 shows two waveforms of the same frequency but 90 out of phase. Notice that the purple sine wave leads the blue sine wave as shown in Figure 3.

Figure 3 The purple waveform leads the blue waveform

1.5

0.5

Series1 0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 Series2 Series3

-0.5

-1

-1.5

Figure 4 Three harmonics of the fundamental in phase with each other

1.5

0.5

Series1 0 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 Series2 Series3

-0.5

-1

-1.5

Figure 5 Three harmonics of the fundamental out of phase with each other

As an example, the MATLAB code to create a sine wave of amplitude A = 1, at audio frequency of 466.16 Hz (corresponds to A# in the Equal Tempered Chromatic Scale) would be: >> v = sin(2*pi*466.16*[0:0.00125:1.0]); The vector, v, now contains samples of the sine wave, starting at t=0 s, to t=1.0 s, in samples spaced 0.00125 s apart (the sampling interval Ts). This corresponds to a sampling frequency of 8 KHz, which is standard for voice grade audio channel. Now, you can either plot this sine wave; or you can hear it!!! To plot, simply do >> plot(v); To hear v, you need to convert the data contained in v to some standard audio format that can be played using a Sound Card and Speakers on your PC. One such standard audio format is called the "wav" format. Matlab provides a function called wavwrite to convert a vector into wav format and save it on disk. Do >> help wavwrite for more details. Now, to create a wav file, do >> wavwrite(v, 'asharp.wav'); (you can give any file name between the ' ' s) Now, you can "play" this wav file called asharp.wav using any multimedia player. For example, you could use the Sound Recorder program. Start this by pointing to Start - Programs - Accessories Multimedia - Sound Recorder. Open the wav file using the File Menu and press Play. If you have installed a sound card and a pair of speakers on your PC, you should be able to hear a short note. Now that you can make a single note, you can put notes together and make music!!!

Let's look at the following piece of music: AA EE F# F# DD C#C# BB EE DD C# C# (repeat first two lines once)

EE AA B B (repeat once)

The American Standard Pitch for each of this notes is: A: 440.00 Hz B: 493.88 Hz C#: 554.37 Hz D: 587.33 Hz E: 659.26 Hz F#: 739.99 Hz Assuming each note lasts for 0.5 seconds, the MATLAB m-file for creating a wav file for this piece of music would be:
clear; a=sin(2*pi*440*(0:0.000125:0.5)); b=sin(2*pi*493.88*(0:0.000125:0.5)); cs=sin(2*pi*554.37*(0:0.000125:0.5)); d=sin(2*pi*587.33*(0:0.000125:0.5)); e=sin(2*pi*659.26*(0:0.000125:0.5)); fs=sin(2*pi*739.99*(0:0.000125:0.5));

line1=[a,a,e,e,fs,fs,e,e,]; line2=[d,d,cs,cs,b,b,a,a,]; line3=[e,e,d,d,cs,cs,b,b]; song=[line1,line2,line3,line3,line1,line2]; wavwrite(song,'song.wav'); HINT: Before you code the entire song, just code the first line, create a wav file, play it and make sure everything works.

10

Você também pode gostar