1 Introduction

One of the most useful software packages in a phonetician’s toolkit is Paul Boersma and David Weenik’s Praat. It allows its users easy access to sophisticated analytical techniques for speech sounds (among a variety of other useful features), including formant and pitch tracking, spectrogram visualization, and sound file annotation.

Yet, a great deal of Praat’s power lies in its scriptability. Routine tasks can be automated through Praat’s built-in scripting language, and new functionality can be added as well. For instance, all annotated sections of a sound file can be automatically extracted via a simple script, instead of the user needing to go through and extract each annotated segment by hand. Similarly, formant values can be extracted in the same way. As research trends more and more toward using large data sets, this capability in Praat has become invaluable.

The scripting language itself and the basics of how to use it are well documented in Praat’s scripting manual. However, many common tasks in research are outside the scope of the documentation for the scripting language. And to those less familiar with working through a problem in Praat’s scripting langauge, even to those who can code proficiently in other programming languages, it can seem daunting to be starting from ground zero. And that is where this book seeks to come in.

1.1 A note on the status of this book

This book is currently in development. What this means for you as a reader is that it may not cover as many use cases as you would like. Some chapters may also be incomplete, as I will be jumping around in the content creation process. And, this also means that some content may move around. I will make every effort to name the sections wtih appropriately descriptive titles so thigns are easily discoverable, though I may fall short of that goal as I continue writing.

Additionally, though I strive to make sure all the code contained in the book runs and runs correctly, I may miss something as I go through. In such a case, please contact me with a report of where the error is and I’ll get it fixed. :)

1.2 What this book is

This book is intended to be a cookbook for the Praat scripting language. By that, I mean that it will contain recipes, if you will, on how to accomplish common tasks in Praat. Organized by task, these code recipes should provide a starting point for researchers when beginning a new Praat scripting project, as well as demonstrate how to accomplish speicifc tasks in Praat for those who may be less familiar with problem solving or for those of us who just seem to forget how to do something in the language from time to time.

The code contained in this book is made available for you to use verbatim or in a modified form, free-of-charge, and without attribution, for any purpose. While you are not restricted from citing this book when using the code inside it, the idea behind providing these code recipes is to provide a resource for researchers and students to get going with their research and move on from the drudgery that can come from reinventing the wheel. Additionally, many of the recipes and snippts will not be of sufficient length that they can be considered original, and may indeed be the only straightforward way of doing something, to which I have no intention of laying any sort of copyright or usage restriction claim to.

1.3 What this book is not

This book is also not a textbook. The emphasis is on getting your scripts going, not teaching. You may very well learn while reading it, but that is a side goal of the book.

This book is not an introduction to Praat scripting. It will assume that you are familiar with at least basic Praat scripting. It is also not an introduction to coding. It will assume you have basic coding skills and vocabulary. If you encounter something you are unfamiliar with, you are encourage to do you own research or ask a friend, colleague, or mentor. Beyond the Praat script you’ll encounter, there will also be many excerpts containing Python code being used in conjunction with certain Praat capabilities. To understand them, you will need familiarity with the Python programming language. However, they do not provide extra functionality beyond what the Praat portions themselves will provide, so they could be considered optional.

This book is also not a place where you will learn how to make large, complex scripts in Praat. As with a recipe, you may learn how to make one dish, but you will have to learn on your own how to composde a full meal, as it were, from the components contained within the book. On a similar note, it is not a book on best experimental and research practices. You are expected to know and understand what resources you want to get from your Praat script to answer your research questions. You are also expected to know and understand what pitfalls await you based on what information you’re extracting from your speech/acoustic signals.

Finally, it is not exhaustive. There are many use cases that I will be unable to foresee. The hope is that there will be something similar enough to what you want to do contained here that you only need to tweak it a bit. Of course, I am always open to suggestions as to content to include, but not everything is feasible to include here.

1.4 Essentially…

This book is about coding patterns that you can use for yourself.