Sound arguments with sonic eloquence
Hacking the humanities with
Jim Brown and Eddie Lee
December 5, 2013

sound_arguments.zip
Audacity download
Audacity 2.0.3 download for OS Mavericks

Shiny Server

To run the Shiny Server tool,

0. Unzip the downloaded files.

1. We must first change the directory in which R will look for the appropriate files. After opening R, type "getwd()" (without the quotation marks) and hit Return to get the current working directory. Copy the downloaded folder into this directory. Since the files are in the folder "sound_arguments" inside the current directory, we need to set the current directory by typing "setwd("sound_arguments")", keeping the inner quotation marks.

2. Install the Shiny library with "install.packages("shiny")" and follow the directions in the pop up menu. Afterwards, type "library(shiny)" into the R terminal and hit Return to load the library.

3. Enter command "runApp()" and a window should open in your browser.

4. Wait for the default file, "Sibilance," to load before continuing. 5. On the left hand panel, we have a number of settings to fix. After altering the settings as desired, hit "Load" to apply these settings. Again, give the program time to work especially on older laptops.

Known bugs:
Sometimes the audio file will fail to load properly and the oscillogram is empty. To reload the file again, we have to load a different audio file and then return back to the original file that we wanted. Sorry!

README

Main file is sonic1_v2.R which draws functions from ListenFcns.R, Filter.R, and AudioGenFcns.R. To run the code, follow the steps below.

0. Unzip the downloaded files.

1. We must first change the directory in which R will look for the appropriate files. After opening R, type "getwd()" (without the quotation marks) and hit Return to get the current working directory. Copy the downloaded folder into this directory. Since the files are in the folder "sound_arguments" inside the current directory, we need to set the current directory by typing "setwd("sound_arguments")", keeping the inner quotation marks.

2. Open the file "sonic1_v2.R".

3. Each section in this code is demarcated by "# \# ----...", where \# is an integer representing the section number. Each section runs a separate part of the analysis. Lines beginning with a pound "#" are comments, which means that they are treated as text by R's compiler, i.e. comments about the code or code to be ignored by the novice user.

4. To run the code, first copy and paste the library and file sourcing lines (lines 21-24) into the R terminal and hit Return.

5. In lines 28-30, we can set the file that we wish to load into the program and where in the file we wish to look.

6. To set the name of the file, replace the text between quotation marks in line 28 with the name of the file. This file must be an MP3, and leave out the file type appendix ".mp3".

7. The variables "timestart" and "timestop" will specify in seconds where in the audio file we wish to start and end our analysis. Setting "timestop" to "NA" means that we will go all the way to the end of the audio file. Be careful not too set the time interval too long. Depending on your computer, you may not have enough memory or computing power to do the analysis in a reasonable amount of time. An interval of 15 seconds or less will probably work for everyone.

8. In section 2, we load the audio file. We can set "ampthresh" that specifies the strictness of the amplitude filter. A larger value means it will remove louder sounds from the audio file. We can use this to identify pauses in speech that might have low, background noise.

9. In section 3, we compute the spectrogram. The settings are the same as with the Shiny Server tool.

10. In section 5, we plot the spectrogram. The settings are the same as with the Shiny Server tool.

11. In section 6, we use the Harmonic Product Spectrum algorithm to compute the fundamental frequencies. We also remove some of the rapid fluctuations in the found fundamental frequencies to fill in parts of speech that might be noisy or be non-tonal sounds.

12. In section 7, we output the extracted fundamental tones to an audio file titled "out_out.wav".