Difference between revisions of "CSC111 Lab 5 2014"
(→Copying Parts of the Waveform) |
(→Copying Parts of the Waveform) |
||
Line 102: | Line 102: | ||
[[Image:QuestionMark1.jpg|right|120px]] | [[Image:QuestionMark1.jpg|right|120px]] | ||
Add a for loop that copies all the samples of "remember" and duplicates them in the waveform, so that when you play it you hear two "remember" words. | Add a for loop that copies all the samples of "remember" and duplicates them in the waveform, so that when you play it you hear two "remember" words. | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | {| style="width:100%; background:silver" | ||
+ | |- | ||
+ | | | ||
+ | ===Challenge #2=== | ||
+ | |} | ||
+ | [[Image:QuestionMark2.jpg|right|120px]] | ||
+ | Modify your program so that it transforms the waveform in such a way that when you play it at then end of the transformation it will play "Remember, always!" | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | {| style="width:100%; background:silver" | ||
+ | |- | ||
+ | | | ||
+ | ===Challenge #3=== | ||
+ | |} | ||
+ | [[Image:QuestionMark3.jpg|right|120px]] | ||
+ | Modify your program so that it transforms the waveform in such a way that when you play it at then end of the transformation it will play "Remember" with an echo! (Remember, member, mber, ber...). | ||
+ | Be sure to make me listen to this new waveform before you move on to the next part! | ||
+ | <br /> | ||
<br /> | <br /> |
Revision as of 20:45, 25 February 2014
--D. Thiebaut (talk) 18:16, 25 February 2014 (EST)
Contents
JES
Download JES
- Download JES 4-3 to your computer from https://code.google.com/p/mediacomp-jes/downloads/list.
- If you are running Windows, pick jes-4-3.exe. Once downloaded, click on the exe file to start JES.
- If you are running Mac OS X, pick jes-4-3-mac.zip, click on the downloaded zip file. Then click on the extracted file to start JES.
Download a Sound File
- Download the following file to your computer:
Writing Your First JES Program
- Open JES
- Type the following program in the top window:
file = pickAFile() sound = makeSound( file ) blockingPlay( sound )
- click on "Load Program" and save the program in the folder of your choice (a good place would be where you saved the Force.wav file).
- When prompted to enter a file in the Pick A File window, navigate through your folders and pick force.wav or Force.wav, which ever way you named it.
- Make sure the speakers are on so that you can hear your computer play the file. Don't worry about making sounds in this lab: this is what this lab is about!
Visualizing the Waveform of the Sound File
- Once you have played a sound in JES you can access its waveform using the Sound Tool of the MediaTools menu at the top of the window (or the screen).
- Open the Sound Tool. This is what you should see:
- Move the cursor around the waveform and click on different buttons (Play before, Play after, Play selection, etc.)
Clearing Part Of The Waveform
- Position the cursor in the waveform as shown in the image above, just before the words "the force" are uttered by Sir Alec Guinness. Note the index of the sample where the cursor and assign it to a variable in your JES program, as shown below. Just replace the ... with the actual number
file = pickAFile() sound = makeSound( file ) blockingPlay( sound ) # get start index for clearing startIndex = ... # index just before "the force..."
- Now that you have the beginning index of the phrase "the force will be with you, always", you can clear it by setting all the samples to 0, as follows:
# clear all the samples from startIndex to end: for i in range( startIndex, noSamples ): setSampleValueAt( sound, i, 0 ) # play sound again blockingPlay( sound )
- Add this new code to the end of your program and run it. It should just play "Remember" and nothing else. Look at the new waveform of your sound with the Sound Tool (close it first to get rid of the original waveform and reopen it).
Copying Parts of the Waveform
- The goal of this part is to copy the samples corresponding to "Remember" so that the waveform becomes "Remember Remember".
- You need two functions to perform this operation:
value = getSampleValueAt( sound, i )
- which gets the sample at Index i and stores it in the variable value, and
setSampleValueAt( sound, i, value )
- which sets the sample at Index i to value.
Challenge #1 |
Add a for loop that copies all the samples of "remember" and duplicates them in the waveform, so that when you play it you hear two "remember" words.
Challenge #2 |
Modify your program so that it transforms the waveform in such a way that when you play it at then end of the transformation it will play "Remember, always!"
Challenge #3 |
Modify your program so that it transforms the waveform in such a way that when you play it at then end of the transformation it will play "Remember" with an echo! (Remember, member, mber, ber...).
Be sure to make me listen to this new waveform before you move on to the next part!