Topics

Mac OS 9 -> Praat crashes

Chris Darwin <cjd@...>
 

Has anyone else had problems with Praat crashing under Mac OS 9 ? It was VERY
stable under 8.6.

=============================================
Chris Darwin, Experimental Psychology,
University of Sussex, Brighton BN1 9QG, UK
Phone: +44-1273-678409; FAX: +44-1273-678611
Email: cjd@...
Home Page: http://www.biols.susx.ac.uk/Home/Chris_Darwin/
=============================================

Paul Boersma <paul.boersma@...>
 

Chris Darwin wrote:

Has anyone else had problems with Praat crashing under Mac OS 9 ? It was VERY
stable under 8.6.
your scripts crash because they contain a mixture of old-style variables
(which could contain strings as well as numbers) and new-style variables
(where hello$ is a string and hello is a number).

Specifically, string variables (with the $ appended) should not
be used with the getnameofselected and copy commands.
I deleted that old-style syntax from the scripting tutorial,
but kept it in the script language because I promised that old scripts
would still run in the future.

Basically, the following two commands will work:
getnameofselected soundName Sound 1
and
soundName$ = selected$ ("Sound", 1)
The second way is clearer and is the only one in the tutorial now.
The following does not work:
getnameofselected soundName$ Sound 1
Unfortunately, this syntax may lead to a crash (it should not; it's entirely my fault).

The "copy" command should not be used at all:
copy name'i'$ sound$
This also crashes if combined with string variables. The copy command
is superfluous now, because the following clearer syntax also works:
sound$ = name'i'$

With these changes, your scripts stopped crashing at my MacOS 9.
To be consistent, you could also replace
getidofselected soundID Sound 'ifile'
with
soundID = selected ("Sound", 'ifile')
and
getnumberofselected numberOfSounds Sound
with
numberOfSounds = numberOfSelected ("Sound")

Sorry about this. I will erase the "copy" command from the tutorial.

*************************

By the way, the SWS script contains an error, which will show up
when multiple objects have the same name:

snd$ = selected$ ("Sound", 1)
#...
select Sound 'snd$'

In order that the second statement select the same object as was selected
before, you should use the ID instead:

snd = selected ("Sound", 1)
#...
select 'snd'

It is alright to refer to created objects (in your script: spectrogram and formant)
by name, because "select Formant 'snd$'" will always select the most recently
created Formant object.

*****************
--

Paul Boersma
Institute of Phonetic Sciences, University of Amsterdam
Herengracht 338, 1016CG Amsterdam, The Netherlands
http://www.fon.hum.uva.nl/paul/

Paul Boersma <paul.boersma@...>
 

In Praat 3.8.70, the old (disfavoured) commands "getnameofselected",
"copy", "getstring", and "getinfostring" also work with
string variables, e.g.
copy hhh$ ggg
getnameofselected soundName$ Sound 1
getstring label$ = Get label from interval... 1 1

So Chris Darwin's "hybrid" scripts will not crash from 3.8.70 on,
and actually run as expected.

Available once we can access our web site again.
--

Paul Boersma
Institute of Phonetic Sciences, University of Amsterdam
Herengracht 338, 1016CG Amsterdam, The Netherlands
http://www.fon.hum.uva.nl/paul/