Batch praat script for multiple sections of a sound file

65 views Asked by At

I am trying to take code from the praat manual script for listing F0 statistics https://www.fon.hum.uva.nl/praat/manual/Script_for_listing_F0_statistics.html

I have a folder of audio files that I load into praat, then select "Analyse periodicity" select "to pitch" and "ok."

I want to get 100 ms intervals of each sound file with tmin, tmax, mean, fmin, fmax defined for each interval. The sound file name also needs to be listed.

Here is my script thus far. I keep getting the following error "Unknown variable: sound1 Object "sound1" does not exist. Script line 29 not performed or completed: select sound 1 .. Menu command "Run not completed."

Can anyone help me batch this? Script below:

clearinfo

pause select all sounds to be used for this operation
   numberOfSelectedSounds = numberOfSelected ("Sound")

for thisSelectedSound to numberOfSelectedSounds
    sound'thisSelectedSound' = selected("Sound",thisSelectedSound)
endfor

for thisSound from 1 to numberOfSelectedSounds

    startTime = Get start time
    endTime = Get end time
    numberOfTimeSteps = (endTime - startTime) / 0.10
    writeInfoLine: "    tmin    tmax    mean    fmin    fmax    stdev"
    for step to numberOfTimeSteps
        tmin = startTime + (step - 1) * 0.10
        tmax = tmin + 0.10
        mean = Get mean: tmin, tmax, "Hertz"
        minimum = Get minimum: tmin, tmax, "Hertz","Parabolic"
        maximum = Get maximum: tmin, tmax, "Hertz", "Parabolic"
        stdev = Get standard deviation: tmin, tmax, "Hertz"
        appendInfoLine: fixed$ (tmin, 6), " ", fixed$ (tmax, 6), " ", fixed$ (mean, 2), " ", fixed$ (minimum, 2), " ", fixed$ (maximum, 2), " ", fixed$ (stdev, 2)
    endfor

endfor

# re-select the sounds
   select sound1
for thisSound from 2 to numberOfSelectedSounds

   plus sound'thisSound'
endfor
0

There are 0 answers