Bugs in scripting language or me?

Mietta Lennes


Are there any known bugs in the Praat scripting language? I think the
comment lines may sometimes prevent the execution of some command
lines... at least one of my scripts suddenly started working after I
removed a couple of comment lines from the middle of the script! Or
maybe Praat just found my comments offensive :)

I am currently trying to write a script that should detect possible
pauses in a Sound file (containing speech) on the basis of intensity
values. I want to automatically add a boundary to a corresponding
TextGrid object wherever a pause is detected. My naive "pause
detection" seems to work. However, Praat refuses to move B, E or the
cursor in the Sound editor window and I never get to set the
boundaries. When I run my script, it stops after a Sound editor
window has been opened and when the script should move the cursor to
the time point where I want the first boundary to fall. The error
message is something like "Command 'Move cursor to...' not available
for the current selection". My script line seems perfectly fine to
me, e.g.:
select Sound 'windowname$'
Move cursor to... pausestart
--(where pausestart is the variable containing the starting point of
the pause)

I've tried all kinds of debugging with echo messages and stuff. I've
tried moving the cursor either in a Sound editor, LongSound editor,
or an IntensityTier window, but nothing works. Could this be a memory
problem? Or should I get rid of the comment lines again? It's
probably just my own blindness and stupidity and I'll find my mistake
next week, but if anyone can give me clues of where to look for bugs,
I'd be very, very relieved!



Paul Boersma <paul.boersma@...>

Dear Mietta,

there is no bug in you, since for a human reader,
the intention of your script is clear:

select Sound 'windowname$'
Move cursor to... pausestart
the stupid Praat script interpreter, however, has to know which
window should execute each command. All of your three commands
are sent to the Objects and Picture window, which cannot
execute the third command. The third command has to be executed
by the editor window called "Sound 'windowname$'",
which you have just created with the "Edit" command.
You will have to specify this editor window as the new command context:

select Sound 'windowname$'
editor Sound 'windowname$'
Move cursor to... pausestart
The reason for this explicit specification of the context is
that there could be more than one editor window on your screen
at the same time.

For more information on the "editor" and "endeditor" directives,
see chapter 7 of the Scripting tutorial.

one of my scripts suddenly started working after I
removed a couple of comment lines from the middle of the script!
sounds funny. Please send me that script, and I'll look at it.

Best wishes,

Paul Boersma
Institute of Phonetic Sciences, University of Amsterdam
Herengracht 338, 1016CG Amsterdam, The Netherlands