More on soundrecording and playback

Carsten Levin carstenlist at itinfo.dk
Thu Aug 29 16:47:00 CDT 2002


Philip Usher wrote
> if you want to play an external aif sound file then:
> create a player object... i.e. "player 1"
> click on the player tab in the properites palette for player 1 and set the
> filepath of the player to the external sound file
> to play the sound from a script, use the command "start player 1"

No, an aif file would play perfectly well just with this:
play audioClip "path/filename"

no need to create a player.

And while your method (clicking and choosing in a players properties) is
great, it wouldnt work in our case ... we need to create the sound file with
new names and to play them ... and we actually do so without any problems in
Mac OS 9 using the two scripts shown under this text ... with the external
recordsound to do the actual recording. The playback is done just by the
scriptline <play audioClip "path/filename">

And according to the scripting guide (se record sound and play audio) the
same should be possible with the recording/playing technology build into
Revolution 1.1

OUR OLD EXAMLPE (only Mac OS ... not windows and Mac OS X)
--glbstilfilsti contains the path to our rev application. glblydnavn
contains the actual name of the file ... and .aif is added by the script.

  on srtrecordsound
  global glbstilfilsti
  global glbLydnavn

if platform() is "MacOS" then
      get extInit(MacinfoBA,3050298)
        put  glbstilfilsti & "ress/sounds/opgavelyde/" & glbLydnavn & ".aif"
into tempLYD
    ext_recordSound tempLYD,1
    play tempLYD
    wait until the sound is done
  else
    answer "Optagelse af indtalt lyd kan kun ske under Mac OS" with OK
  end if
end srtrecordsound 


on srtplaysound
  global glbstilfilsti
  global glbLydnavn
  put  (glbstilfilsti & ("ress/sounds/opgavelyde/") & glbLydnavn & (".aif"))
into tempLYD
  play audioClip tempLYD
end srtplaysound

Best regards

Carsten




More information about the use-livecode mailing list