# because maybe we don't need a settings file SettingsPath$ = wd$ + "formantSettings.tsv" Wd$ = homeDirectory$ + "/Documents/praatTutorial/sampleData/formantScript/"ĮxitScript: "The input folder doesn't exist" We'll print them and make sure they're working, and ask for permission to overwrite our out file: Let's go through these sections and code, starting with setting up the variables. # in our settings file, reset formant variables. # For each wav file, open the text grid file # Get a list of wav files in the input directory I also recommend that before you make a loop, you get some test code going on a single file. If you break everything down into smaller tasks, you will eventually end up with one big functional program: See if you can fill in this outline with code and do this project yourself. Since I've made this script before I have a more specific idea of what I want to do. Your outline might be different, or more general than mine. Also take a look at the sample spreadsheet in praatTutorial/sampleData/formantScript/output, which is what we're going to generate.Īs always, create a plan with comments, mine is below. Take a look at one of the wav and text grid file pairs in praatTutorial/sampleData/formantScript/data. We can add that functionality in later if we want. While we're going to make a quality script, I'm not going to worry at this point about making it really easy to use for non-scripters. As a bonus, we'll read in a settings file, so that we can customize the values to read the formants for specific individuals. The plan is to loop through every wav file in a directory, open its TextGrid (we assume it has the same name), get F1 and F2 values for every interval, and write it to a spreadsheet. No peeking until you've genuinely tried! (If you STILL haven't downloaded the accompanying files, click on the menu above to go to the download page.) If you find a better way of doing something, share! The final version I have is in praatTutorial/sampleData/formantBatch.praat. I recommend you try to build the script yourself, and then come back and see how I did it. I would definitely use your fancier text editor with syntax highlighting (see this earlier page), and use the workflow we talked about where you only edit in the nice editor, and "Reopen from file" in Praat's scripting editor. Consider this an exam, covering most everything we've learned so far. Long example: Extracting formant values to a spreadsheet
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |