################################################################ # longSoundSplitter -- linux version # Written by Kyuchul Yoon ( kyoon@ling.osu.edu ) # Lets you select boundaries btw/ tokens and cuts/saves each token as a separate file # in a subfolder (tokens/) # There should be a subdirectory tokens/ # The only difference with the Windows version is the directory separator, "/" instead of "\" ################################################################ # Specify files and folders form Select files & folders word longSoundFile_(without_extension) diphones_words word tokenFolder_(should_be_a_subfolder) tokens word filePrefix_(should_be_a_country_name) kr integer startingFileNum 1 integer numOfTokensToCut 10 endform Open long sound file... 'longSoundFile$'.wav View # Repeat the token extraction process as defined by the numOfTokensToCut in the dialog box for i from 1 to numOfTokensToCut editor LongSound 'longSoundFile$' # User selects the appropriate token pause Select the token to cut # Extracts the selection to the Praat Object Window Extract selection fileNum = startingFileNum + (i - 1) # Check the file number to insert appropriate '0's in the file name if fileNum < 10 zerosToFill$ = "000" elsif fileNum <100 zerosToFill$ = "00" elsif fileNum < 1000 zerosToFill$ = "0" else zerosToFill$ = "" endif # Writes the selection to the subdirectory defined by tokenFolder in the dialog box Write selection to WAV file... 'tokenFolder$'/'filePrefix$'_'zerosToFill$''fileNum'.wav endeditor # Sync the name of the extracted object in the Praat Object Window select Sound untitled Rename... 'filePrefix$'_'zerosToFill$''fileNum' endfor #Re-write the last sound file, this time with the ending time of the selection, which is where you should start next select LongSound 'longSoundFile$' editor LongSound 'longSoundFile$' endTime = Get end of selection Write selection to WAV file... 'tokenFolder$'/EndTime_'endTime' endeditor Remove # End of script #