LAB 23 – Modifying All Samples in a Sound (part 1 – Manipulating Sounds)

Lab Exercises

Topics

n      To create and manipulate media like sounds

n      To understand how we digitize sounds

 

Exercises

8.1 How Sound is Encoded

8.1.1 The Physics of Sound

8.1.2 Exploring Sounds

 

n      Attach a microphone to your computer

n      Open the Windows-MediaTools folder

n      Open the SqueakVM.exe application

n      This will start Squeak with the media tools loaded

n      Click on the Sound Tools window

¨     It will expand

n      Click on Record Viewer and Record

¨     And do high and low sounds in the microphone

n      Notice that high sounds have more cycles per second

n      Click on Quit to exit Squeak

 

8.1.3 Encoding Sounds

 

8.2 Manipulating Sounds

8.2.1 Opening Sounds and Manipulating Samples

 

i) Type the following:

> String fileName1;

> fileName1 = FileChooser.pickAFile();    // note that this pops up a window to select a .wav file

 

> Sound soundClip;

> soundClip = new Sound(fileName1);

> soundClip.play();

 

What happened?

 

ii) Now type:

>  System.out.println(soundClip);

 

What was displayed?

 

iii) Now type:

> soundClip.explore();

 

What happened?

 

iv) Now type:

> soundClip.blockingPlay();

 

What happened?

 

v) Now type:

> soundClip.write(“C:/temp/newSound.wav”);

 

What happened?

 

vi) Now type:

> SoundSample [] sampleArray = soundClip.getSamples();

> System.out.println(sampleArray.length);

 

What happened?

 

vi) Now type:

> System.out.println(soundClip.getSampleValueAt(5));

> System.out.println(sampleArray[5]);

 

What happened?

 

8.2.2 Using Media Tools for Looking at Sounds

Use the remaining time to explore the Sound Editor in the MediaTools Application.

 

Nothing to submit through the DropBox in WebCT.