Skip to content

dlukes/PraatEdit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PraatEdit v0.1.1

Credits

Code written/cobbled together from snippets found on the Web by David Lukeš, 2013. You may redistribute and modify it all you like, provided that you make the source code of your modified versions openly available on the Web. Giving credit is appreciated but not required :)

Disclaimer

PraatEdit is not in any way associated with the program [Praat] (http://www.fon.hum.uva.nl/praat) or its makers, Paul Boersma and David Weenink. Its shortcomings and failures are entirely my own and should not reflect negatively on the great piece of software that is Praat.

This project was undertaken as part of an introductory course on Java, by someone who has little to no prior experience with GUI programming. I know I got in way over my head, and the code is correspondingly ugly, non-idiomatic or just plain wrong in places. If you edit it using NetBeans and its helper features, it's marginally less of a mess, but one can't hide it's more of an overgrown hack rather than a full-fledged, well-behaved, cleanly architectured project. Still, if you find PraatEdit to your liking and it works for you, great! Please just remember that, as the GNU GPL says, the program is provided "'as is' without warranty of any kind, expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose."

Warning

PraatEdit is a toy text editor, not an industrial strength one like Vim. It's meant for editing small Praat scripts, a couple of hundred lines is the largest file I've tried to open. Don't try to open humongous files in it, they'll definitely take too long to parse, and who knows, worse things yet might happen.

Description, Features & Known Bugs

PraatEdit is a simple script editor with syntax highlighting (sort of) for the Praat speech analysis software environment. It is meant as an alternative to the built-in editor, and thanks to Paul Boersma's program sendpraat, it also allows the user to directly execute their Praat script from within the application, provided that an instance of Praat is running. Other features and/or known bugs include:

  • keyboard shortcuts for commenting out/uncommenting or indenting/unindenting a piece of code
  • auto-indenting
  • search and replace with regular expressions, but be careful and save often, I didn't have the time to test it extensively yet (Regular expressions work only in Find box. Furthermore, currently, the Replace box doesn't support capturing parentheses. It does support the following escape sequences: \n, \r, \t.)
  • tabs are automatically replaced with spaces (yep, that's not a bug)
  • switch between UTF-8 and your current locale as read/write encodings (the recommended setting is to work with UTF-8 exclusively; if you change the encoding, you need to reopen your current file for the change to take effect)
  • typeface settings can be changed (only) by editing the appropriate line in the config file (.praateditrc in your home directory)
  • settings persistent across sessions
  • undo/redo support is currently crude, but hey, it can only get better; the rule of thumb is: don't rely on it too much and don't hold Ctrl-Z/Ctrl-Y down, press it each time individually (I know it's tedious), and PraatEdit shouldn't hang on you
  • (known disadvantage) as of now, a larger script might take a while to load (2-3s), partly due undoubtedly to some suboptimal code, partly to the fact that the syntax highlighter currently parses the whole file before displaying it; I'd really like to get around to fixing that, but I can't promise anything

Setup

  1. Download the repository in a zipped file either by pressing the ZIP button with a cloud at the top of the page, or clicking here.
  2. Extract the PraatEdit-master/dist subdirectory to the folder of your choice on your hard drive. NOTE: You need the whole folder, i.e. including any subfolders. If for some reason, you are stuck with Java [1.]6 on your computer, use the dist-java6 folder instead.
  3. If you don't want to play around with the source code, you don't need any of the other files.
  4. If you want to send your scripts to a running instance of Praat to execute, consult the section Sendpraat.
  5. Run the program by double-clicking on PraatEdit.jar in the dist folder, or by opening a command line, changing directory to the folder where PraatEdit.jar is located and executing java -jar PraatEdit.jar. (If double-clicking doesn't work by default on your platform, Google should be able to help you out.)

Troubleshooting

Some problems, especially after downloading a new version of PraatEdit, might be solved by deleting the old .praateditrc in your home directory, thereby resetting PraatEdit to its "factory" defaults. (Apologies for having to re-configure your preferences afterwards, but the customization options of PraatEdit being limited, I hope it's an acceptable drawback.)

  1. Don't like the default typeface, or worse, Courier New is being replaced by a proportional font on your system? Open the configuration file (.praateditrc in your home directory) in your favorite text editor and change the name of the font on the line starting with "FontName" to one you like and know is installed on your system.
  2. Praat giving you a cryptic error message when you try running your scripts? Chances are PraatEdit thinks your Praat configuration directory is elsewhere than it really is; please set its location manually via the Preferences->Set paths... dialog. (This directory is called Praat on Windows and .praat-dir on Linux, and is normally located in your home folder.)
  3. PraatEdit not working/crashing gracelessly? Try upgrading to a more recent version of Java (and make sure Oracle doesn't smuggle the obnoxious Ask Toolbar into your browser in the process). PraatEdit was tested on Ubuntu 12.04 and Windows 7 with Java [1.]7. If for some reason you are stuck with Java [1.]6, switch to the Java [1.]6 build of PraatEdit contained in the dist-java6 folder.
  4. The text of your script looks weird, with interspersed spaces, unrecognized characters etc.? First, try to change the input/output stream encoding under Preferences->Read/Write Encoding and reopen the file. If that doesn't help, your script was probably saved in UTF-16, UTF-32 or some other unusual encoding. Please convert it to ASCII, UTF-8 or your current locale. You can also re-save it in ASCII/UTF-8 using Praat's built-in editor.
  5. If your OS is a flavor of Linux and double-clicking PraatEdit.jar doesn't start the program, make sure the file's executable flag is on (chmod a+x PraatEdit.jar in the file's directory in the terminal).
  6. Should one of your files be corrupted following an unexpected crash, the first thing to do is to go to the backup version you're keeping (aren't you?). The next thing to do is to check the directory where the corrupted file was stored for a backup file written by PraatEdit. Its name is the same as the original file, with an extra tilde ("~") appended.
  7. Experiencing behavior that you're pretty confident is not a feature, but a bug? Let me know via github (preferably with exact steps to replicate)!
  8. Do let me know in particular if you notice a possible improvement/correction regarding syntax highlighting. I'm not an expert on the arcana of the Praat scripting language, so this can easily happen, and chances are it'll be a quick fix.
  9. Something really weird going on? Run PraatEdit from the commandline, round up any error messages that may appear and let me know about them via github.

Sendpraat

For PraatEdit to be able to send the contents of your script to Praat to run, you need to have the program sendpraat located in your home folder (in addition to Praat itself, of course). To ensure that, follow these steps:

  1. Download Paul Boersma's program sendpraat.
  2. Make sure the program is called precisely sendpraat (or sendpraat.exe on Windows); if not, rename it to sendpraat (or sendpraat.exe on Windows).
  3. Put it in your home folder (e.g. /home/username/ on Linux or C:\Users\username\ on Windows).
  4. You can also put it elsewhere, but in that case, you have to set the location of sendpraat accordingly via the Preferences->Set paths... dialog, so that PraatEdit knows where to find it.
  5. On Linux, make sure that sendpraat has the executable flag on (e.g. by running chmod a+x sendpraat in your home directory).
  6. In any case, make sure that the name of your script doesn't contain any spaces, otherwise sendpraat won't be able to handle it correctly.

Note for programmers

If you're considering modifying PraatEdit to improve its performance, that would be great, but let me kindly suggest a better use of your time: write a Praat syntax highlighting file for Vim, and a function which sends the content of the buffer to Praat via sendpraat. And let me know when it's available, 'cause I'd love to use it! There's no need to reinvent the wheel (I did it because I needed a class project), and Vim's the best wheel around, as we all know ;)

About

An alternative script editor for the Praat speech analysis software environment, written in Java. NOT AFFILIATED with the creators of the original & great Praat.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages