|
From a Praat script you can call system commands. These are the same commands that you would normally type into a terminal window or into the Window command line prompt.
Some system commands are identical on all platforms (Macintosh, Windows, Unix):
system mkdir sounds
which creates a new directory sounds in the directory of the script. Some other system commands are different on different platforms. For instance, to throw away all WAV files in the script's directory, you would write
system del *.wav
on Windows, but
system rm *.wav
on Macintosh and Unix.
The script will stop running if a system command returns an error. For instance,
system mkdir sounds
will stop the script if the directory sounds already exists. In order to prevent this, you can tell Praat to ignore the return value of the system command:
Thus, to make sure that the directory sounds exists, you would write
system_nocheck mkdir sounds
homeDirectory$ = environment$ ("HOME")
Here is a Praat script that measures how long it takes to do a million assignments:
stopwatch
for i to 1000000
a = 1.23456789e123
endfor
time = stopwatch
echo 'a' 'time:3'
© ppgb, January 6, 2008