Here’s a free (if you’ve got access to a Mac), quick method for creating spoken experimental stimuli, which I’ve implemented in this project and now use regularly in my lab. Hat tip to Richard Morey for suggesting this and writing a few lines of code that saves many hours of tedious voice recording.
- Create a plain text file with the texts you want to create .wavs for entered on separate lines. Line break after each word or phrase that you want to generate a sound file for. Name your text file “words.txt”. It should look something like this one we recently used to generate audio files for a digit span task:
- Open iTerm, and navigate to the folder where your “words.txt” file is located. Here’s a lesson on how to navigate via command line. TLDR: the “cd” (current directory) command is what you need. cd .. will move you to the directory one above where you are. The “ls” command lists the folders in the current directory.
- Type the following into iTerm:
In a few seconds, the directory containing “words.txt” will also include a .wav file for each entry from “words.txt”.
This code uses the MacOS voice “Kate” (a female voice with a British accent). You can replace “Kate” with any voice available on your system by removing “Kate” from the code and typing your preferred voice instead.
Text-to-speech isn’t perfect. You want to check that your .wav files sound like the text you meant for them to sound like. Different voices sometimes pronounce the text in different ways, so one solution to weird-sounding speech is to try another voice. You can also try alternative spellings to get the right pronunciation.