Using Praat scripting, how can I split a wav file by silence and then concatenate the speech clips into smaller wav files?
<p>I'm working on a Praat script to:</p>

<p>1- open a wav file </p>

<p>2- split the wav file based on silences</p>

<p>3- concatenate the intervals based on duration, so that the new wav segment files are &lt;= 15 seconds each </p>

<p>4- write new wav segments to separate wav files</p>

<p>I've made some progress on getting this script to work, but I'm having 2 major problems:</p>

<p>1- after i concatenate the segments to create the first 15 sec clip my output stops, therefore I'm missing part of the wav file in the output</p>

<p>2- the clips are being concatenated in reverse order</p>

<p>Here is my script so far. Please help! I'm a novice in scripting in Praat, and I'm totally stumped..</p>

<pre><code>Read from file... Desktop/englishTest.wav
name$ = selected$("Sound", 1)
outputDir$ = "Desktop/praat_output/"
To TextGrid (silences)... 100 0 -25 0.3 0.1 silent sounding
plus Sound 'name$'
Extract intervals where... 1 no "is equal to" sounding

n = numberOfSelected("Sound")

for i to n
    soundObject'i'=selected("Sound", i)
endfor

topSound = soundObject1
select topSound
durTop = Get total duration

i = 2
for i to n
    select soundObject'i'
    dur = Get total duration
    if durTop + dur &lt;= 15
        select topSound
        plus soundObject'i'
        topSound = Concatenate
        select topSound
        durTop = Get total duration
    else
        select topSound
        Save as WAV file... 'outputDir$''name$'_'i'.wav
        topSound = soundObject'i'
        durTop = dur
    endif
endfor
</code></pre>