wav file in a folder, and create a TextGrid with an interval tier named "segments" and a point tier named "points", and save them to the same directory. Let's use this newfound knowledge to open every. WavList = Create Strings as file list: "wavList", inDirWild$ Lastly, you'll have to add your wildcard if you only want files of a certain extension: That means we'll get a file called "Desktopjazz.wav" in my home folder! Here's my preferred way, since I don't have the habit of prepending slashes to names of files: If I chose the desktop, I would get this: If you look closely at the result, it's not what we want, since we're missing a slash. The path that it returns doesn't have a slash at the end, so we'll have problems if we do this: InDir$ = chooseDirectory$: "Choose the folder containing your wav files" Remember the chooseDirectory command from the last lesson, that lets the user choose a folder for us? Enter this and run it: WavList = Create Strings as file list: "wavList", inDirWavs$ Wd$ = homeDirectory$ + "/Documents/praatTutorial/sampleData/" Note the variables I set up for the path here: wav files in praatTutorial/sampleData/fileLooping. We can do this with a "wildcard", which is a character that will match anything, and in this case is the asterisk "*". It's typically much easier and safer to open, for example, all of the. One potential issue with this is that we got all of the files in that folder. Try it out and come back to see my version below.ÄownloadsList = Create Strings as file list: "downloadsList", wd$ Using this information, figure out how to write a script that gets a list of files in your Downloads folder, and prints their names to the info window. Look at the available commands in the buttons on the right in the object window. Click on View & Edit, see what's in there. Take a look at the strings object it created for you. The first argument is the name of the Strings object you will create, and the second is the path to a folder. Try it out with the mouse to see what arguments the command needs, and what it returns to you. ![]() ("Create Strings as directory list" will give you a list of folders). To get a list of files in a directory, use "Create Strings as file list", which is a command in the "New" dropdown menu. If you want to run your script on every item contained in a folder, you need to loop over its contents. Since you already know how to read files, and you know how to loop, this should be cake.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |