Вы находитесь на странице: 1из 22

Looking less often

Activity 70S: Software Based


Teaching Notes | Key Terms | Key Skills Quick Help

Sampling waveforms successfully To make an accurate digital reproduction of a sound you need to sample often enough. This activity looks at the effect on the waveform of reducing the sampling time. You can also hear the effect. You will need a PC running Audacity Open the audio file in Audacity Sampling waves 1. Launch the sound processing software. You will make three new tracks, each containing a 1000 Hz tone that lasts for two seconds, but with different sample rates. Here is how: Set the Project rate to 44100 kHz, using the button in the bottom left hand corner of the Audacity window. Use the Generate > Tone menu, then in the dialogue box choose a sine wave a frequency of 1000 Hz, an amplitude of 1 and a length of 2.0 seconds. Now set the Project rate to 16 000 kHz, using the button as before. Then use the menu item Project > New Audio Track to make a new track. Fill this with a second-long sample of 1000 Hz, as before. Now set the Project rate to 8000 kHz, using the button as before. Again use the menu item Project > New Audio Track to make a new track. Fill this with a second long sample of 1000 Hz, as before. Now you'll have the three tracks. 2. Use the Play button to play the resulting sounds, one track at a time, using the Solo button to switch on that track pane, or by using the Mute button to switch off each of the other tracks. (If you have altered any settings make sure you are in waveform view: use the track drop-down menu next to the name of each sample, to check or change this.)

Advancing Physics

3. Magnify the view by clicking on the Zoom In button. Note the differing number of points to define each cycle. Each point is a sample.

4. Magnify a few more times so that you can estimate the number of samples per second on each of the three views. Discuss the effect of the sample rate on what you see and what you hear. 5. Use the menu Edit > Select > All to select the entire duration of all three tracks. Then alter the pitch to 6000 Hz using the menu Effect > Change Pitch and type 6000 into the to box. For your own peace of mind, check that 2

Advancing Physics

the number of samples per second at this new setting is unaltered. 6. Again play back each of the tracks independently. Discuss the effect of the sample rate on what you see and what you hear. You should notice much more difference between the sampling rates for this higher frequency. Try to account for this difference. 7. Explore your explanation by altering the frequencies of the samples, as in step 5 above. 8. You can easily generate your own tones and experiment with reducing the number of samples / second. Use File > New, and choose a high sample rate to start off with. Use the Generate menu and choose Tone. 9. You might like to record a sample at different sampling rates, if you have a microphone. Start a new file with File > New. Then set the project rate using the pop-up menu in the bottom left-hand corner. Rather low rates (say around 2000) make it easy to hear the effects. Then press the record button to make a new track. Sampling frequently enough 1. To get a faithful reproduction of a waveform you must sample often enough. 2. Reducing the sampling rate can affect the amplitude, quality and frequency of the sampled signal. 3. High-frequency components suffer most when the sampling rate is reduced.

Filtering sounds
Activity 160S: Software Based
Teaching Notes | Key Terms | Key Skills Quick Help

Now you hear it, now you don't Here you can make a sound with two frequencies, hear them both, and then get rid of one of them. You will need a PC running sound processing software Making and manipulating sounds Start up Audacity, the sound processing software provided. 1. Make two tracks, each of 2 s duration, one a 600 Hz sine wave and the other a 6000 Hz sine wave, using the menu item Generate > Tone twice, with amplitude settings of 0.5 on each occasion and altering the frequency setting between the two. Be sure to click outside of the first track before generating the second, so that you do not replace one tone with another. 2. Use the Mute and Solo buttons, to hear both tracks together and separately. You might like to use the Zoom-in button to see the detail of the waveform.

Advancing Physics

3. Now select both tracks by clicking on the track control panes on the left, which go grey. Then combine the tracks, using the menu Project > Quick Mix. Again zoom in to see what you have created: both waveforms added together. 4. Use the Audio Track drop-down menu to switch to Spectrum. Now you will see two bright bands across the screen, one for each frequency that we have combined. You might like to use View > Fit Vertically to get better vertical resolution. Play the track again, to convince yourself that you have the same sound. 5. Now to remove the high-frequency component. From the Effect menu choose FFT Filter. In the resulting dialogue box, drag the filter graph by its square handles to accept frequencies below about 1000 Hz and diminish frequencies above that.

Advancing Physics

Applying the filter makes the top band much weaker. Play the sound again. You might like to apply the filter a few more times, to see the top band being eroded (Effect > Repeat FFT Filter). 6. The new frequency analysis has only one intense band, the lower of the two that were present before filtering. 7. Check up on the sound by pressing the Play button. Just the low pitch tone is left. Use the Audio Track drop-down menu to switch to the waveform view, and zoom in until you can see the waveform, which has lost its previous sharp wiggles. 8. To compare with the original waveform, click outside the track, and then use Generate > Tone, again with a 600 Hz frequency and amplitude of 0.5. Inspect both tracks on Waveform and Spectrum views using the Audio Track drop-down menu. 9. Try the same procedure with other mixed tones. You have seen 1. That your ear can tell two tones apart if they are different enough in frequency. 2. That a complex waveform can be built up from component frequencies. 3. That a complex waveform can be filtered to remove frequencies.

Hearing impairment: Using a digital filter


Activity 190S: Software Based
Teaching Notes | Key Terms | Key Skills Quick Help

Advancing Physics

Listening to sounds with a reduced bandwidth gives an insight into problems experienced by the deaf The healthy human ear is able to hear sounds with frequencies from a few tens of hertz to between 15 and 20 kHz. This range is greatly reduced for people who have hearing difficulties and this demonstration will give you some idea of what such a partially deaf person might hear. Even a healthy ear will have to deal with sounds of a restricted bandwidth when using the telephone or listening to messages from an answering machine. You should understand why these devices produce such a poor quality sound after listening to the demonstration. You will need a PC running sound processing software pre-recorded .wav files of speech (You can open the file speech.wav) (and perhaps music) Listening to filtered speech A filter is a way of removing some frequencies from a signal; a low-pass filter allows low frequencies through but cuts off high frequencies. You may have used an electronic circuit to do this: the same effect can be achieved with a computer program operating on digitally recorded sounds. By looking at such a filter in operation, you will notice how speech and / or music gets progressively more difficult to understand as the cut-off frequency is reduced. 1. The computer program Audacity has a facility which allows digital audio files to be filtered. You should start by running this program on a PC. If you have a pre-recorded digital file (e.g. lc.wav) this can be opened as well; if not, then you will have to record a few seconds of speech before you start. Once you have Audacity on the screen you should press the Record button to start and the Stop button once you have a recording a few seconds long. It is a good idea to save this file before altering it. Pressing the Play button allows the file to be heard, while it can be displayed either as a waveform or spectrum (select these alternatives from the track drop-down menu.) Play the recording a few times so that you know what the unfiltered sound is like.

2. Now that you are used to the starting sound, you can use the low-pass filter to gradually reduce the cut-off frequency from about 4 kHz to a few hundred hertz. Use Effects > Low Pass Filter to achieve this. Telephones 6

Advancing Physics

do not reproduce frequencies above 3400 Hz so it might be a good idea to start with this value as a cut-off. Click OK to apply the filter. 3. When the revised waveform or spectrum is played you should listen carefully and try to identify any differences in what you hear. The Edit menu allows you to Undo the filtering, so you can always retrieve the original waveform and listen to it again. By zooming in on the same section of filtered and unfiltered waveforms you will be able to see that the high-frequency components in the original signal have been removed (i.e. the signal is less jagged). 4. You will probably not have noticed much difference in what you hear with the cut-off at 3.4 kHz so now is the time to reduce the cut-off frequency. Try working down, in four steps, through 1500 Hz, 1000 Hz and 600 Hz to around 300 Hz. As you do, the recording is less clear and you will have some difficulty with the final two. Imagine what it is like for someone who hears sounds like this all the time! You have seen 1. How reducing the bandwidth of an audio signal with a low-pass filter makes it increasingly difficult to hear what is being said.

Cleaning up a sound
Activity 210S: Software Based
Teaching Notes | Key Terms | Key Skills Quick Help

A complex of sounds Being able to see a recorded sound as a complex of frequencies helps to suggest strategies for identifying and highlighting the sound you intended to record. In this activity you manipulate a sound file that contains wanted and unwanted signals. You will need a PC running Audacity a sound file containing a whistle with a radio playing in the background Identifying and isolating sounds This is a compressed view of the waveform of the recording. It is several seconds long and contains a whistle, which is the signal you want to isolate, together with the sound of a radio playing in the background.

Advancing Physics

Another way to look at the signal is the 'spectrum view'. This shows you a map over time of the frequencies present in the signal. Switching to this view allows you to see much more clearly what do and do not want in this signal. The whistle is the bright 'tick' in the middle of the recording. Compare these two views for a while.

The spectrum view has a time scale across the bottom and a frequency scale up the side. You can also look at a section of the spectrum, done here for the sample 1.51.7 s, during which the whistle has just begun:

Here the horizontal axis shows frequencies and the vertical axis the intensity at each frequency. The spectral view shows that the background radio is mainly producing relatively low frequencies. A simple way to take out the radio is to reduce the amplitude of all frequencies below about 1000 Hz to zero. A high-pass filter can do this for us. The filter is set as required by typing in the cut-off frequency, so reducing low frequencies to zero, but to pass higher frequencies. This neatly produces the whistle with little background radio. More processing can reduce the noise further. So to work 1. Open the file 'whistle over radio' with Audacity. You are likely to see a waveform view of the recorded signal.

Advancing Physics

Open the audio file in Audacity 2. Click on the Play button and listen to the sample rather carefully. You will hear a radio in the background and a whistle over it. 3. Drag over the section that you think is the whistle. Click the Play button again this will play just the selection. Repeat these two steps until you have the whistle selected. 4. Zoom in on the waveform by clicking on the Zoom In button. Eventually you will see a familiar picture:

5. Below this display there is a slider bar, drag it to scroll through the sample. Note that both the frequency and the amplitude of this complex waveform change. 6. Choose from the menu View > Fit in Window, so as to view the full waveform again. 7. Now we will look at the frequency spectrum of the recording. Select the whole recording and then use Analyze > Plot Spectrum. This produces a new window of intensity / frequency for the whole sample not helpful! 8. Select a 0.1 s interval in the Waveform window. Play the selection and analyse the frequency for this interval, as in step 7. Repeat for a number of 0.1 s intervals within the whistle. You should notice a pattern between what you hear and the peak on the frequency spectrum. For 1.81.9 s you hear 1027 Hz as the most intense frequency and see this:

Advancing Physics

9. Use the Audio Track drop-down menu to switch to Spectrum. You can select portions of the whistle by dragging again. By looking at the Frequency Analysis window and the axes of the spectral view carefully, you will see what the view represents. Choose a number of 0.1 s intervals as in step 8; generating new graphs as in step 7. Think carefully about what the colours show. 10. To start separating out the whistle select, by dragging again, the part of the recording before the whistle starts. Use the Edit menu and choose Cut to remove this selection. Repeat for the part of the recording after the whistle. 11. A horizontal line at 750 Hz would separate the whistle from the radio. Use Effect > High Pass Filter to get to a dialogue box which allows you to reduce all the amplitudes below 750 Hz. 12. Click OK! 13. Play the whistle and feel satisfied! 14. If you feel like more exploration you might like to try to isolate the voice on the radio. You can 1. Look at a recorded signal as time and frequency views and relate the two. 2. Process a signal to remove a band of frequencies.

Building up a sound
Activity 220S: Software Based
Teaching Notes | Key Terms | Key Skills Quick Help

Synthesising a complex waveform Fourier showed that a waveform of any complexity can be broken down into a mixture of waveforms which are pure tones that is, waves which can be described by simple sines and cosines. In this activity you build up a complex waveform from a series of simple tones. Tone telephones use such mixtures of tones to signal the different dialling numbers. 10

Advancing Physics

You will need a PC running sound processing software Making waves 1. Launch Audacity. 2. Make three tracks containing pure sine waves, using Generate > Tone, with the following frequencies and amplitudes: 1000 Hz, 1.0; 3000 Hz, 0.33; 5000 Hz, 0.2. 3. Select all three tracks by shift-clicking on the track panes on the left. Each pane will go grey when selected. Then combine the tracks using Project > Quick Mix. 4. Play the resulting sound. Make sure you are in Waveform view, using the Audio Track drop-down menu. Zoom in and out to inspect the waveform.

5. From just three sine waves you have generated something close to a square wave. You have made a 1000 Hz square wave by adding to the original 100% of 1000 Hz the extra frequencies: 33% of 3000 Hz and 20% of 5000 Hz. You should be able to add another frequency to make the resultant waveform even more square. If this has all gone too fast for you, start again and add the three component waves in one at a time using the same process. You can then see the pattern building up. 6. Now see how such a compound waveform can be analysed. Select part of the waveform, then use the Analyse > Plot Spectrum feature. The spectrum is laid out before you. You see the components that you have added to make up the complex wave. As an extension at this stage try changing the number of points (102416 384) that the software uses to calculate the spectrum. There is a pop-up menu to allow this in the Frequency Analysis window. 7. Time to experiment. You can build up many complex shapes by adding simple waveforms. As a further extension you can define a filter to simplify one of your complex waveforms by removing some components. From the Effects menu choose FFT Filter. Drag the line down to diminish the amplitudes of a range of frequencies and drag the line up to augment a different range. You might like to try this several times with different parts of the waveform by highlighting. You will get artefacts effects which are not really there produced by the analysis program! Complex from simple 11

Advancing Physics

1. You have seen how to build up complex resultant waves from simple component waves. 2. Waves that look complex in the Waveform view may look simple in the Frequency view. 3. Manipulating waves in the Frequency view is often much easier than in the Waveform view.

Spectra of pulses
Activity 240S: Software Based
Teaching Notes | Key Terms | Key Skills Quick Help

Pulses spread the spectrum Digital systems transmit information in on / off pulses. But the brief time for which a pulse exists spreads the spectrum, making digital communication demanding on bandwidth. Here you can see these effects qualitatively. You will need a PC running Audacity prepared pulsed sound file (from the CD-ROM) Open the audio file in Audacity Pulses: to hear and analyse 1. Press Play to play back the file. You hear sets of pulses which get shorter and shorter from one set to the next. 2. Notice that for the longer pulses you hear a distinct clear tone during a pulse. But when the pulses get shorter, the impression of a tone vanishes and you hear a buzz or clicks. The pulses last for too few cycles of the tone for the pitch of the tone to be established by your ear. This is one sign that the frequency range (bandwidth) is spreading as the pulses get shorter. 3. Check that all the pulses do actually consist of bursts of 1000 Hz tone, whatever your ear tells you. Do this by selecting a part of a pulse in the Waveform view (using the track drop-down menu), and zooming in. Zoom back out to find the next set of pulses. 4. Select the whole of a pulse. From the Analyse menu, choose Plot Spectrum. Select different bursts of tone and repeat. The appearance of the spectra is likely to vary with the selections, and will not always be easy to interpret because of difficulties of matching the window of time over which the spectrum is analysed with the time when a pulse is on. However, as you go from longer to shorter pulses, look for a broadening in the spectrum. You have 1. Heard the way a tone becomes less clear as it is pulsed rapidly. 2. Perhaps seen the spectrum of a pulse of tone broadening as the pulse becomes shorter.

Pulse length and frequency spectrum


Activity 250S: Software Based 12

Advancing Physics

Teaching Notes | Key Terms | Key Skills

Quick Help

Fast signalling uses up bandwidth Every signal occupies a range of frequencies, its bandwidth. Bandwidth is a valuable commodity, which governments and regulating authorities have to share out amongst many competing communicators, and still leave space for people like radio astronomers who need to look at signals from the universe. The more rapidly you want to communicate, the more bandwidth you use up. You will need a PC running sound processing software the three sound files with prepared waveforms provided below Open the audio file 030043f1 in Audacity Open the audio file 030043f2 in Audacity Open the audio file 030043f3 in Audacity Chopping up sine waves into pulses A digital signal can be sent by switching a high-frequency oscillation on and off, making pulses of sinusoidal oscillations. Cutting the pulse off sharply after only a few oscillations spreads the frequency. If the pulse is to be zero at the beginning and end, there need to be other oscillations present which combine to give zero amplitude at the beginning and end of the pulse. A start on adding other frequencies which combine to give zero at the pulse edges is to add those which make one more, or one less, complete cycle in the pulse length. Then there is half a cycle left over, or half a cycle short, at each end. This makes these waves get out of step with the original one just at the pulse edges. Pulses and bandwidth on the computer 1. Launch Audacity with the prepared files. Copy the three files (Open the file; Select > All; Copy; switch to the target project window; click outside any existing track; Edit > Paste) in order so that they all appear in one Audacity window (continuous, 10 ms pulses, 5 ms pulses). All have a base frequency of 1000 Hz. That is, if you zoom in, you will see that the oscillations are all at 1000 Hz. However, only the top track is continuous: the bottom pair both have ratios of tone to silence of 1: 5, with 5 ms and 10 ms pulses respectively. Use the Zoom In and Zoom Out buttons to verify this. Use the mute and solo buttons on the track controls to listen to each of the tracks by themselves.

13

Advancing Physics

2. Think for a bit. What do you expect the different tracks to look like in Spectrum view? Now use the drop-down track menus to check your ideas. 3. To further check what is going on, select a small part of the continuous track and plot the spectrum of frequencies present, using Analyze > Plot Spectrum. What would you expect to see for the pulsed tracks? Select just one pulse in each case and then plot new spectra, as before. 4. The expected width of the central peak in the spectrum is 1 / pulsewidth. The pulses are 5 ms and 10 ms wide, so the expected width is 200 Hz and 100 Hz each side of the 1 kHz peak. Look at the spread of frequencies to see if this general pattern is followed. 5. Make shorter and longer pulses on a new track (use Generate > Tone and Generate > Silence alternately). Does the spectrum broaden for shorter pulses and get narrower for longer pulses? Sending bits produces frequency spread 1. You have seen how switching a waveform on and off broadens its spectrum. 2. You have seen how the narrower the pulse, the broader is the spectrum and the greater its bandwidth.

Bits per second and frequency spectrum


Activity 260S: Software Based
Teaching Notes | Key Terms | Key Skills Quick Help

Simulating giving a channel a hard time 14

Advancing Physics

If you are sending bits, the toughest thing you can ask a channel such as a microwave link to cope with is alternating 0s and 1s, like this: 101010101010101010101010101010101010101010101010101010101010101010101010101010 These make the channel switch voltage back and forth at the fastest possible rate. That is, a signal like this will require the highest frequency components of any such signal. No time to rest between bits! Such a signal is a square wave:

You can make such a signal, and see what happens if you try to squeeze it through a channel with a narrow frequency range. You will need a computer running Audacity What to do 1. Launch Audacity. 2. Make a new square wave, 500 Hz, 1 s long, using Generate > Tone. 3. Use the track drop-down menu to look at this square wave as a waveform and as a spectrum. 4. Select a significant duration of the waveform then use Analyse > Plot Spectrum to see the whole string of spikes in the spectrum. 5. Now is the time to simulate squeezing this signal through a channel with too little bandwidth. You'll be surprised at how little bandwidth is enough to keep it recognisable. From the Effect menu choose Low Pass Filter and set it to reject all frequencies above 2000 Hz. When this filter has simulated the effect of a channel that cannot pass frequencies greater than 2000 Hz, what will the square waves look like? They are still 'there', but have changed quite a bit. 6. A simple gate circuit could still get back the original square signal. This much frequency range, twice the repetition rate of pairs of alternating 01 bits (four times the rate of transmission of bits) is enough, if not by much. Look at its 15

Advancing Physics

spectrum. You will see just the first two peaks. 7. Try reducing the filter level to about 800 Hz to let only the fundamental through. You should get a sine wave. Is this enough to recover the original signal? You have seen 1. How switching a waveform on and off produces a signal occupying a wide frequency range. 2. How cutting off the high frequencies changes the waveform. 3. That a channel carrying a bit stream must at least pass signals up to a frequency approximately equal to the rate of transmission of bits, if the bit stream is to be recoverable.

Looking at and listening to noise in signals


Activity 270S: Software Based
Teaching Notes | Key Terms | Key Skills Quick Help

Communications engineers are always looking for ways to reduce noise added to signals. Telephone calls can be almost inaudible because of noise introduced in transmission. The flickering white spots on a TV screen when not tuned to a TV channel are noise. Short-wave radio is often very noisy, but FM radio, digital radio and CDs are much less subject to noise. It is important that the amplitude of the signal is considerably larger than the amplitude of the noise present. This experiment uses sound- and noise-generating software for you to listen to what noise sounds like, and what effect it has when added to a signal. One important kind of noise is called white noise. This consists of random fluctuations over a wide range of frequencies. It sounds like a continuous hiss. It is present in all electrical circuits due to the random thermal motion of the free electrons. An extension lets you look at other colours of random noise pink and brown noise which sound more pleasant and natural. They can be used in sound effects for rustling wind or splashing waterfalls.

comparing spectra of different noise types 0 10 20 30 40 50 60 0 5


You will need a PC with a sound card running Audacity sound manipulation software 16

white pink brown

10 15 frequency / kHz

20

25

Advancing Physics

Create a signal and some noise 1. Run the Audacity software.

Generate two tracks, one of a 440 Hz sinusoidal signal, and one of white noise. To do this, click Generate > Tone > Waveform > Sine > 440 Hz (concert tuning pitch A) for the first track. Then click Generate > White Noise for the second track. Listen to signal mixed with noise 2. Use the cut tool to limit the tracks to about 5 s of playing time. 3. Press play, when you can mix and listen to the two tracks simultaneously. 4. Alter the Gain slider control in the audio track window to vary the amount of noise added (from 36 dB to +36 dB in 3 dB steps; press SHIFT for fine control). You can hear the effect of different amounts of noise on the pure tone. 5. Try zooming in on the waveforms with the View > Zoom-in button. You will see the regularity of the sine wave and the randomness of the white noise after zooming in about 10 clicks ( 210 = 1024) as shown below.

See the combined signal and noise wave-form 6. To see the combined waveform of the mixed track press Edit > Select All and then Project > Quick Mix and zoom in on the new combined waveform. The noise superimposed on the pure sine wave should look like this: 17

Advancing Physics

7. Finally, try decreasing the Gain of the signal, using the track Gain slider controls, until you can only just distinguish the signal (the pure tone) from the noise.

If the signal is decreased further it becomes completely lost in the noise. Spectrum of white noise 8. It is instructive to look at the random waveform and sound frequency spectrum of white noise. To do this select a few seconds of white noise and press Edit > Select All then View > Plot Spectrum.

18

Advancing Physics

The spectrum is flat: that is, all audible frequencies are equally powerful. Extension 1: Add noise to your own message 9. Try recording your voice into an Audacity track, then mix it with white noise at different levels and play back until your speech information is lost to a new listener. Remember that you know what you said! Extension 2: Noise added to a square wave 10. You can repeat the whole process of combining noise and signals, but now generating a square waveform for the signal. This gives you a good visual model of what happens when different noise levels are added to a digital signal.

19

Advancing Physics

If a larger amplitude of noise is added, the original signal is badly corrupted and starts to become lost. It sounds pretty awful too!

Extension 3: Pink and brown noise 11. Files of pink and brown noise are also included on the CD if you would like to investigate how they sound and what their frequency spectra are. Their waveforms and frequency spectra are illustrated below.

20

Advancing Physics

21

Advancing Physics

Open the audio file in Audacity (white noise) Open the audio file in Audacity (pink noise) Open the audio file in Audacity (brown noise) You have seen and heard 1. The effects of increasing noise added to a signal. 2. The degradation of information when the signal is too small compared with the noise. This happens in many systems over long distances because the signal strength tends to decreases but the effects of noise accumulate. 3. The waveform and spectrum of random white noise.

22

Advancing Physics

Вам также может понравиться