############################################################ # File extractor for gating experiments # Written by Kyuchul Yoon (kyoon@ling.osu.edu) # When prompted for selection, user select a section, the direction of extraction # and the number and interval of extraction # The script outputs file extractions as filename-##.wav where ## indicates numbers # This time, extract without windowing the selection ############################################################ # Get the user input form Select files and parameters comment Add some more options? word fileToProcess_(without_extension) soundfile real stepOfGate 0.01 natural numOfExtraction 5 word windType Hamming choice directionToExtract 1 button To the RIGHT button To the LEFT endform Read from file... 'fileToProcess$'.wav Rename... masterFile # Show the Editor window for user selection select Sound masterFile Edit editor Sound masterFile pause Select the interval # Remember the begin and end of the selection beginSel = Get begin of selection endSel = Get end of selection # Depending on the direction of the extraction # Move the end of the selection rightward by the step specified in the beginning if directionToExtract = 1 for i to numOfExtraction Select... beginSel endSel Move begin of selection to nearest zero crossing Move end of selection to nearest zero crossing Play... beginSel endSel # Extract windowed selection... 'i' 'windType$' 1 yes Extract selection select Sound untitled Rename... 'i' endSel = endSel + stepOfGate endfor # Otherwise, move the beginning of the selection leftward else for i to numOfExtraction Select... beginSel endSel Move begin of selection to nearest zero crossing Move end of selection to nearest zero crossing Play... beginSel endSel # Extract windowed selection... 'i' 'windType$' 1 yes Extract selection select Sound untitled Rename... 'i' beginSel = beginSel - stepOfGate endfor endif # Close the Editor window Close endeditor # Write the extracted files with appropriate filenames for iFile to numOfExtraction select Sound 'iFile' if directionToExtract = 1 Write to WAV file... 'fileToProcess$'--to-the-right--'iFile'.wav else Write to WAV file... 'fileToProcess$'--to-the-left--'iFile'.wav endif endfor ############# END OF SCRIPT ################