if you recorded the GUI-action Spectrogram settings. Free choice of the editor is nice (especially since the Praat script editor is pretty simple) but much more important is the freedom to edit everything in a Praat script: But it is possible for example to adjust some parameters in a script that was mailed to your smartphone and send it back. You don't even need Praat to edit Praat scripts! Usually, that's a bad idea because you want to test your scripts frequently during development and of course you need Praat to run scripts. The Praat script editor obviously is the first choice to handle Praat scripts but principally you can use any text editor you like for editing. First, because Praat scripts are plain text files. ![]() Flexible macrosīut Praat scripts are much more versatile than simple macros. Praat also provides you with a macro recording mechanism (the command history which is introduced in Session 1), accessible within the Praat script editor (also introduced in Session 1). You can save the script for later use or to distribute it among your students or colleagues (to make their lives easier or to make sure that they perform an analysis exactly the same way as you intended). You can collect any amount of Praat GUI actions in a Praat script and replay them as often as you like. The benefit of macros is threefold: recurring tasks become less tedious, much faster and more reliable. you don't need to worry about typos or missed clicks during later iterations. So, with a macro you can automate a complex task and rerun it reliably, i.e. If you replay the macro, each recorded action is executed one after the other in the order you recorded them. GUI actions are actions you perform in the graphical user interface of an application, like pointing and clicking with the mouse or pressing keys on the keyboard. text processors, Photoshop etc.) allows you to record a series of GUI actions and to replay them as often as needed. An application that supports macros (e.g. We'll come back to this issue as soon as our scripts grow and include loops and other fancy stuff.What is a Praat script? One starting point is to think of Praat scripts as macros. Indent lines within loops, conditionals, and similar blocks (forms, procedures etc.).Separate code blocks (sequences of statements dedicated to the same subtask) with empty lines (and consider introducing them with a comment).I recommend you commit yourself to two rules right at the beginning of your scripting career to make your scripts better (not only look better): Praat allows generous usage of whitespace: We can insert empty lines everywhere we want and we can indent lines with spaces or tabs whenever we want. Whitespace is applied in order to visually reflect the structure of scripts. Another great tool complementing comments to achieve better readability is whitespace. Readability of scriptsĬomments are a great tool to improve readability of scripts (for humans). Delete the hash to listen to the tone again. Now the tone is opened immediately after creation. Leading whitespace (space/tab) in front of the hash symbol is allowed, but nothing else.Ĭreate Sound as pure tone "tone", 1, 0, 0.4, 44100, 440, 0.2, 0.01, 0.01 To function like this, the hash symbol must be the first symbol in that line. Lines starting with the hash symbol are not executed when you run the script, they are just ignored and execution is continued in the next line. The comment indicator in Praat scripts is the hash (#) symbol. That's a very common and useful practice during the testing/debugging of scripts. Reactivation is just a matter of deleting the comment indicator. This allows us to deactivate statements without deleting them. This is best done as a comment section at the beginning of the script.Īnother more practical benefit of comments is the possibility to comment out statements. If you distribute your scripts among your colleagues or offer them for download it's imperative to include at least some usage information and requirements. That's the moment when you'll be grateful for any comment that tells you what the script actually does. ![]() ![]() More often than not you'll ask yourself what a given line or sequence of lines contributes to the script. This could be useful for yourself if you revisit a script you coded months ago and try to adapt it to your current task. So, what's the benefit of comments? First, with comments you can explain your script. Comments are lines which are ignored during the execution of the script. Syntactic Structure Comments & WhitespaceĪs any other scripting/programming language the Praat scripting language allows comments.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |