Making stimuli
Insert instructions for scheduling in the P-lab / using that equipment
We use Audacity to edit sound files for my experiments. There are four ways we typically edit my sound files. Select the best sample of a given stimulus, Remove background noise, Add or remove silence if necessary, and Export as a
.wav
file.First, select the file that you want to work on.
Right click to open the sound file you want to work on with Audacity.
With the sound file open, listen to each of the recorded examples of the sound and select the one that sounds best to you.
To select in Audacity you just click and drag around the sound that you want. In this example, I've selected the first one. Make sure that you get at least a little bit of the silence around the sound. You will need it to remove background noise later.
With the best sound selected, hit
cmd + c
to copy it to the clipboard. Open a new audacity file by hitting cmd + n
. Then paste the selected sound file into the new audacity file with cmd + v
.To remove background noise, we first need to zoom in to our sound stimulus. Use
cmd + 1
to zoom in. (Note that cmd +3
zooms out and cmd + 2
returns the sound stimulus to its original size.)Next we need to select a part of the silence to give Audacity a "noise profile". Do this by clicking and dragging around the silence that you want to select.
Click
Effect > Noise Reduction
to open the "noise reduction" dialog box.With your silence already selected and the "noise reduction" dialog box open, click the
Get Noise Profile
button.Next, go back to the sound stimulus and select the entire audio sample.
Select
Effect > Noise Reduction
again to return to the "noise reduction" dialog box. This time select OK
.You can adjust the dB of noise reduction, the sensitivity, and the smoothing. For my experiments, the default selections are appropriate. For reference, those default selections are:
- Noise reduction (dB) : 12
- Sensitivity: 6.00
- Frequency smoothing(bands): 0
To remove silence (or any section of the stimulus), select the portion of want to remove and click
delete
.To add silence, place the cursor where you want to add the silence. Here I've chosen the end of the stimulus.
Select
Generate > Silence...
from the Audacity menu.In the "silence" dialog box, enter the amount of silence you want to generate. Here I have entered 30 seconds of silence.
Click
OK
to finish generating silence.To export the final stimulus, select
File > Export Audio...
or File > Export Selected Audio...
if you have selected a smaller portion of a file to export.Enter a file name and select
WAV
format.Select
Save
. You can enter meta-data if you wish to. I often leave this part blank.Click
OK
to finish exporting your stimulus.To synthesize sounds, you can use the
say
command in the terminal. For example, to synthesize a single sound, you would typesay -v Alex -r 250 "say this please" -o ~/Desktop/say-this.wav --data-format=LEF32@32000
Each parameter in this command are:
say
is the command for Text-to-speech-v Alex
use voice (-v
) Alex-r 250
use a rate of 250 ms"say this please"
is the text you want to synthesize-o ~/Desktop/say-this.wav
is the path and name of the file you want to save--data-format=LEF32@32000
is the format of the data (required forWAV
files)
When I want so synthesize a short list of words or sentences with exactly the same parameters, I use my synth-a-little.py python script.
The parameters in the script are:
path
is the name of a folder I want to create to save my sound files invoice
is the voice I want to userate
is the speech ratewordList
is a list of words or sentences that I want to synthesize
To download the script, navigate to the directory you want to save the script in. For example, the Desktop.
cd ~/Desktop
then use
curl
to download the script.curl -o synth-words.py https://raw.githubusercontent.com/kschuler/helpers/master/synth-a-little.py
To run the script, first edit synth-a-little.py with the parameters you want to use. Then navigate to the script's directory. For example, if you saved
synth-a-little.py
on your Desktop you would navigate to the Desktopcd ~/Desktop
And then run the script using
python synth-a-little.py
When I need to synthesize a long list of sounds, or a list of sounds with different parameters, I use my synth-a-lot.py script. This script reads parameters from a
.csv
file for each individual sound file.Instructions coming soon...
When you are looking for images to use as stimuli, generally any open-source image search tool works well. You can see some sources we recommend on the Favorite tools page.
Removing background from images
To remove background images, I like to outline the part of the image that I want and use the
clip
tool. I created a short (silent) YouTube tutorial to show you how to do this. Click the image below to watch it.Re-sizing images
Using Inkscape
To re-size images with Inkscape, you can create a background of your desired size and export it with your image. I created a (silent) YouTube tutorial for how to do this. It is available by clicking the image below.
Using Preview
It is also reasonably simple to edit images using
Preview
on a Mac. To begin, open the file you want to edit with Preview
. Click and drag around the image to select the area you want.You can further adjust by clicking and dragging the blue circles. Once you have the selection square the size you want, drag the square to adjust the position. Then you can hit
cmd + k
to crop the image. Once the image is cropped, hit Tools > Adjust size...
.In the
Adjust size
dialog box, close the lock icon by clicking on it. This locks the aspect ratio to make sure the image does not get distorted. With the lock closed, adjust the size of the image. When the lock is closed, you only need to adjust one dimension (height or width). The other dimension will automatically adjust to preserve the aspect ratio.Instructions coming soon...
Last modified 6mo ago