[R-SIG-Mac] sound::setWavPlayer()

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Aug 27 09:30:50 CEST 2008

On 27.08.2008, at 09:13, Hans-Jörg Bibiko wrote:
> 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, ...)
> }

Stop. I've just read the source code. On Mac you should write:

setWavPlayer('open -a \"QuickTime Player.app\"')
play(s, stay=TRUE)

If stay = FALSE the temp file will be deleted immediately after  
creation (?)

BTW the error message after setWavPlayer results by the issue that the  
test wav file is in some sense corrupt.
Furthermore findWavPlayer() is not up-to-date, thus it couldn't find  
an adequate player for Leopard ;)

I will contact the maintainer.


More information about the R-SIG-Mac mailing list