Lab 9: Sound files
This lab is due on Sunday, April 27, 2014. The last day we will be helping you (whether by
email or in person) is Friday, April 25th. Late homeworks will not be accepted so finish early.
As usual, please write up this lab in a report. This report contains a summary of the lab,
the scripts you used, images if required, and answers to the questions asked with a short
description on how the results were generated.
Each task has equal weighing for the grade.
In this lab, we will do some experiments with sound using R.
We will start by emulating what we have done in class. To this end, please
do the following tasks:
Task 1
Create a recording, using Audacity or some other means, of three sets of words. The
first are adjectives, the second are nouns, and the third
are verbs in the past tense. Each recording should have at least 5 words. Word should be separated from
each other by a silence (more than 0.3 second in length (this can be checked using Audacity if you are
not sure.)
Task 2
You will find on web a sound
recording made by Gordon Erlebacher. Include the words of this recording in your report. You are to replace the second and third words (which are of type adjective), word four (noun), word five (verb), and word eight (noun) by words selected from your own list.
Task 3
To achieve this, use the functions contained in the script "breakup_sound.r" (look at the file and try to figure out how the functions work and what they do based on what we did in class.) In the script,
you will find a function breakUpSoundWave that takes three arguments (filenmame, threshold (between volume and silence segments) and number of samples per segment ((download breakup_sound.r). You are to compute the number of samples per segment so as to break up the sound wave into pieces (each piece with a number of samples equal to samples.per.segment. You calculate the number of samples based on the return value of the function loadSample (look up its documentation for help if necessary.) You can also get a list of the functions in the sound
library by executing the command in RStudio library(help=sound), to figure out how to
write wav files, if needed.
Task 4
Recombine the words (after substitution) into a single sound file, and read it into Audacity. Listen to the sound file. Please comment on it, regarding whether it sounds natural, stilted, and any other characteristic you can think of. What might you use such an approach for?
Task 5
Use Audacity to create a clip of between 0.3 sec and 0.5 sec of pure silence (you can find generate silence in the menus), , save it into a wav file, and
create a second sound file in which you insert this clip between each of the words in the sound file that contains
a combination of the instructor and the student's words. Combine these words into a single sound file and
email the file to the TA. Your name should be a part of the sound file name. If you are adventurous, add noise
to this silence (you'll find a noise generator in the same menu as the silence generator.
Task 6
Next week (maybe today), we'll have available to us the modified sound files of most of the students. Download five of these sound files from the web or GoogleDrive (based on instructions provided by the TA), and calculate the
average volume of each of these sound waves. We will define the average volume as the standard deviation of the sound
wave file (recall: the sound wave oscillates and takes positive and negative values).
Therefore, the mean values should be rather small. Record these in your report as well.
Task 7
Take the original sound file (with words from two people), decrease its sampling rate from its original value (which you'll state in your report), to 8000 samples per second (found under Tracks menu), save the file, and calculate the voaverage volume. Repeat this with 2000 samples per second. What conclusion do you draw. Listen to these two files and ccompare their sound characteristics.
Task 8
Add noise to your sound file (using R and only using a single channel) and report the maximum noise level you
can add before the words are no longer recognizable (describe the R code that you use in your report).
Appendix
Here are some hints for the lab. Everybody records with a different sound level. So you must play with the threshold.
If the threshold is too low, you'll have fewer words returned to you. If the threshold is zero, you'll get one
word returned to you. On the other hand, if the threshold is too high, you'll get nothing returned from the function.
The solution presented is imperfect.
Cosider loading the words you get back into Audacity to play them. Ultimately, it is the only way to make sure you
have chosen the parameters correctly. YOu can do so using a combination as loadSample and
as.Sample.
Every task must be addressed in your report. R code that takes more than a few
lines can be included in a separate file or at the end of the report.
Any report which is more than 20 pages in total is clearly too long. I only
expect working code to be included; please do not include all your code
versions, or output of your code if it fills page after page. Instead, use
the commands head judiciously to limit the output to a few
lines, just to demonstrate that you understand, and of course, provide
any answers to the questions posed. Make sure you include the question being
answered so that the TAs understand what you wrote.
Make sure you email your sound wave to the TA at the end of the first lab, or a few days later.