############################################################### # File extractor simulator 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 script is for checking various parameters # Basically the same as the "gating-exp-extractor.praat" file, but with some commeting outs # Window types: Rectangular, Parabolic, Gaussian1, Hamming ############################################################### # 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 Parabolic 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 pause 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 pause beginSel = beginSel - stepOfGate endfor endif # Close the Editor window #Close endeditor #select Sound masterFile #Remove # 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 ################