[R-SIG-Mac] sound::setWavPlayer()
Hans-Jörg Bibiko
bibiko at eva.mpg.de
Wed Aug 27 09:13:19 CEST 2008
Hi,
first setWavPlayer() expects an UNIX shell command. To open it with
e.g. QuickTime one should use this:
setWavPlayer('open -a \"QuickTime Player.app\"')
[Ignore the error message]
Then the tricky point is that QuickTime cannot open temp files written
by the play() function (?maybe access rights; or the sound lib is
written with Windows-like paths?)
Thus I wrote my own play() function
myplay <- function(s, ...) {
f <- paste(tempdir(), "/Temp_Sound.wav", sep='')
if (file.exists(f)) {file.remove(f)}
saveSample(s, f)
play(f, ...)
}
Now if I invoke myplay(s) QuickTime opens that temp file and I can
press SPACE to play. If you want to play the sound automatically you
can set this in QuickTime's preferences 'Automatically play movies
when opened'
Other possibilities would be:
- look for a command line program for Leopard which can play wav files
- write an AppleScript script which takes the argument to open/play it
with QuickTime; save that script and set setWavPlayer('osascript /PATH/
TO/SCRIPT')
--Hans
More information about the R-SIG-Mac
mailing list