############################################################ # File randomizer for gating experiments # Written by Kyuchul Yoon (kyoon@ling.osu.edu) # The script reads in all the .wav files from the current directory, randomizes them, and # combines them all into one big file that can be burned into a CD ############################################################ # Get the user input form Select files and parameters comment Add some more options? word fileToProcess_(only_extensions) wav word subFolderToProcess soundfile comment A list of filenames of the sound files will be created in a text file natural sampleRate_(in_Hz) 22050 natural intervalBtwSounds_(in_Seconds) 2 comment A sound collection file will be created with the name of the subfolder processed endform # Create silence to be inserted btw/ sounds Create Sound... silence 0 intervalBtwSounds sampleRate 0 # Randomize all the wav files Create Strings as file list... fileList 'subFolderToProcess$'\*.'fileToProcess$' Randomize Randomize numFiles = Get number of strings pause 'numFiles' files identified. Continue? # Printout the list of randomized files. The order should be the same as that in the final CD file for i to numFiles select Strings fileList strFileName$ = Get string... i fileappend 'subFolderToProcess$'.fileList.txt 'i''tab$''tab$''strFileName$''newline$' endfor # Read in all the wav files for iFile from 1 to numFiles select Strings fileList iFileToRead = (numFiles+1) - iFile fileName$ = Get string... iFileToRead Read from file... 'subFolderToProcess$'\'fileName$' Rename... 'iFile' endfor # Create a temporary concatenated sound file for the first sound file select Sound silence plus Sound 1 Concatenate Rename... tempCombined # Combine the first file with the rest of the sound files inserting silences in between. for iCombine from 2 to numFiles select Sound tempCombined plus Sound silence plus Sound 'iCombine' Concatenate select Sound tempCombined Remove select Sound chain Rename... tempCombined endfor # Output the final CD sound file Write to WAV file... 'subFolderToProcess$'.sound.collection.wav ############ END OF SCRIPT ###############