Tuesday, April 22, 2008

SOUND RECORDING, PLAYING & PROCESSING USING LabVIEW

Recording Sound

In this experiment, we record sound in LabVIEW. In the next experiment, we play back thesounds we have recorded, and listen to the differences in the types of recordings.

1. On the Desktop double click on the LabVIEW Sounds folder. Double click on theRecord Sound icon. The front panel of the sound recorder opens up.

2. Print out the VI as described in the Printing VIs section above.

3. On the front panel, find the Sound Quality and Bits Per Sample. If you click on thelittle arrows next to it, you can change the Sound Quality between mono and stereo,and the Bits Per Sample between 8 and 16.

4. Select 8-bit mono.

5. Run the VI by clicking on the looped arrow button in the top left of the window. Thebutton changes appearance to indicate that the VI is running. The palette, the rowof icons on the top bar of the screen, also changes as the VI switches from the editmode to the run mode. Notice also that the stop button appears in the panelpalette.

6. We start recording. Make sure your microphone and speakers are turned on.

7. Click on the Record button, and start speaking into the microphone. Hold themicrophone close to your mouth to get the best recording. Notice your voice on thecorresponding graph (8-bit mono and stereo, 16-bit mono and stereo) as you arespeaking into the microphone.

8. Click the Stop button to stop recording. A window appears, asking for the name youwant to save the recorded wav file as. Save it in the LabVIEW Sounds folder as8bitMono. If you are not already in the LabVIEW Sounds folder, search for it on theDesktop.

9. Stop the VI by clicking on the red stop button next to the looped arrow used to startrunning the VI on the panel palette.

10. Follow the previous steps 3 through 9 to get recordings for 16-bit mono, 8-bit stereo,and 16-bit stereo. Make sure to select the appropriate Sound Quality (mono orstereo), and Bits Per Sample (8 or 16) before running the VI. Save theserecordings as 16bitMono, 8bitStereo, and 16bitStereo respectively.

11. Examine the block diagram of the VI by selecting Show Diagram from the Windowmenu. Observe the different objects in the diagram window. Each front panel hasan accompanying block diagram, which is the VI equivalent of a program. The block diagram is constructed using the graphical programming language G, as mentioned before. Notice how the components of the block diagram are wiredtogether to show the flow of data within the block diagram.

12. To change back to the front panel of the Record Sound VI, select Show Panel fromthe Window menu.

Playback Sound

In this experiment, we play back the sounds we have recorded, and listen to thedifferences in the types of recordings. In particular we look at the differences between the8 and 16-bit mono vs. the 8 and 16-bit stereo.

1. On the Desktop double click on the LabVIEW Sounds folder. Double click on thePlayback Sound icon. The front panel of the sound recorder opens up.2. Print out the VI as described in the Printing VIs section above.

3. Run the VI by clicking on the looped arrow button in the top left of the window.

4. Click on the File button. A window appears asking you to select a wav file to play.Select 8bitMono in the LabVIEW Sounds folder by double clicking on it. If you arenot already in the LabVIEW Sounds folder, search for it on the Desktop.

5. Click on the Play button. The wav file you have selected plays, and appears on thecorresponding graph. The text box above the Record, Play and Stop buttons alsoshows the channel (mono or stereo), the sampling rate, and the bits per sample (8or16) of the wav file being played.

6. Click the Stop button to stop playback.

7. Repeat steps 4 through 6 to listen to the other recordings (16bitMono, 8bitStereo,and 16bitStereo).

8. Stop the VI by clicking on the red stop button next to the looped arrow used to startrunning the VI on the panel palette.

9. Examine the block diagram of the VI by selecting Show Diagram from the Windowmenu. Observe the different objects in the diagram window.

10. To change back to the front panel of the Playback Sound VI, select Show Panelfrom the Window menu.

Filter Sound

In this experiment, we play back the sounds we have recorded, but send it through a filter,which alters the sound, and listen to the difference between the filtered and unfilteredsound.

1. Run the Playback Sound VI by clicking on the looped arrow button in the top left ofthe window.

2. Click on the File button as before, and select the 16bitMono wav file by doubleclicking on it.

3. By clicking on the Filter On/Off button you enable or disable the filter. Turn the filteroff, and click on the Play button. Click the Stop button to stop playback. Now turnthe filter on, and click on the Play button again. Notice the difference in sound.Also notice how the sound waveform changes on the far right graph.

4. By clicking on the Filter Type, you can change the type of filter used. These arecommon filters that are used in electrical engineering. We will not go into detailabout the different types of filters, as it is beyond the scope of this lab, but onlynotice how they change the sound.

5. Play around with the different filters, and see how they compare, and also how theycompare with the unfiltered sound (by enabling and/or disabling the filter). Makesure to click the Stop button before clicking on the Play button.

6. Also open some other wav files located in the LabVIEW Sounds folder and playaround with them, again making sure to click the Stop button before clicking on thePlay button. NOTE: only wav files with 16-bit mono sound formats can be filtered inthis experiment!

7. Stop the VI by clicking on the red stop button next to the looped arrow used to startrunning the VI on the panel palette.

8. Print out the VI as described in the Printing VIs section above.Close all VIs by selecting Close from the File menu of the front panel. Closing the VI fromthe diagram will close the diagram only, not the entire VI. Do not save any changes. Clickon “EXIT” in the LabVIEW window.

No comments: