19Re: [praat-users] Mac OS 9 -> Praat crashes
- Aug 31, 2000Chris Darwin wrote:
> Has anyone else had problems with Praat crashing under Mac OS 9 ? It was VERYyour scripts crash because they contain a mixture of old-style variables
> stable under 8.6.
(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
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'
soundID = selected ("Sound", 'ifile')
getnumberofselected numberOfSounds Sound
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)
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.
Institute of Phonetic Sciences, University of Amsterdam
Herengracht 338, 1016CG Amsterdam, The Netherlands
- << Previous post in topic Next post in topic >>