C H I L D E S Slicing and Splicing

With Paul Boersma's recent additions, it is now possible use Praat to splice together lots of little audio files, such as individual samples of babbling into one large file in a way that allows you to later extract them all again.

Having lots of files concatenated in one large file is particularly nice because it then allows you to create a CLAN file that replays the whole mini-corpus using continuous audio playback. You can take each individual clip and send it to Praat if you wish for further analysis. Also having a big file is often better for data organization purposes.

However, at some point, you may wish to recapture all the little files. You may want to delete some or maybe modify others and doing this in the big file can mess things up. To do this, you can use the Praat TextGrid you produced during splicing to control the "slicing" of the file. Eventually, we will want to provide further CLAN support for this process, so that the time marks created in the TextGrid during the splicing process get nicely sent over to a CHAT file. We haven't done this yet, but we will eventually.

Here is a guide to this process:

Getting Ready

1. Download Praat (Mac, PC, or Unix) from http://www.fon.hum.uva.nl/praat/

2. Put all of your files together in a directory.

3. Make sure that their directory order is the same as the order in which you want to see them concatenated.

4. Make sure Praat has a huge amount of memory. For splicing 223 files that make a 25 MB combined file, I had to give in 100MB. For slicing, I had to give it 150MB.

5. Put the two scripts below into text files such as splice.txt and slice.txt. Put them into the directory with your audio files. Open Praat. Use Control "Open Script" to read in the relevant script. You can also click on a Praat script to open Praat.

Splicing many files together

. Read in the following script (here's a text version) using Control - Open Script and type command-R to run it

  • Create Strings as file list... list *.aif
  • n = Get number of strings
  • for i to n
  • select Strings list
  • name$ = Get string... i
  • Read from file... 'name$'
  • Rename... sound'i'
  • endfor
  • select Sound sound1
  • for i from 2 to n
  • plus Sound sound'i'
  • endfor
  • Concatenate recoverably
  • select Sound chain
  • Write to WAV file... chain.wav
  • select TextGrid chain
  • Write to text file... chain.TextGrid

The result is a single large WAV file with a TextGrid index to the starting and stopping position of its component sounds. At this point, you probably should move these to a new directory, not to confuse things. Praat works with AIFF and other formats too. You may want to change lots of things in this sample script. It is provided only to give you an overall idea of how this works. Please read the Praat manual and a bit of the scripting tutorial.

Slicing a big file (with a TextGrid you created)back into little files

To slice up the big sound into its pieces, start up Praat and run this script (also in the text version).

  • Read from file... chain.wav
  • Read from file... chain.TextGrid
  • plus Sound chain
  • Extract all intervals... 1 yes
  • n = numberOfSelected ("Sound")
  • for i to n
  • id'i' = selected ("Sound", i)
  • name'i'$ = selected$ ("Sound", i)
  • endfor
  • for i to n id = id'i'
  • name$ = name'i'$
  • select 'id'
  • Write to WAV file... 'i'.wav
  • endfor