Loading ...
Sorry, an error occurred while loading the content.

19Re: [praat-users] Mac OS 9 -> Praat crashes

Expand Messages
  • Paul Boersma
    Aug 31, 2000
      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/
    • Show all 3 messages in this topic