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

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Aug 27 16:17:58 CEST 2008

On 27.08.2008, at 15:43, Michael Kubovy wrote:

> (1) Using Quicktime:
> > require(sound)
> > setWavPlayer('open -a \"QuickTime Player.app\"')
> ....
> > myplay(s, stay=TRUE)
> This opened QuickTime Player and loaded Temp_Sound.wav. However, I  
> had to click on the play button to hear it.

As I mentioned before you can preset autoplay in QuickTime's  
preferences and you can use the default 'play(s, stay=TRUE)'. There is  
no need for myplay if you set stay to TRUE.

> (2) Using the terminal-callable 'play' program.
> I downloaded it from http://www.hieper.nl/html/play.html and  
> installed it and then checked its availability:
> % which play
> /usr/local/bin/play
> > setWavPlayer('play')
> [1] "WAV file player 'play' linked successfully."

Yes. 'play' can be invoked without stay=TRUE.

BTW with Audacity it works as well if stay=TRUE.

I rewrote the R code for findWavPlayer(), play.default(), and  
play.Sample() to interact with Mac better.
Furthermore if options()$wavplayer is not a 'open -a' command the  
chosen shell command runs in the background, thus you can with R  
further without waiting for e.g. 'play'. This behavior led me to  
introduce a new MacOSX function called 'stopPlay()' which kills the  
shell process (if not 'open -a'). Additionally I changed these scripts  
to use only one temp file. To work with it with QuickTime I also  
included an Applescript to control QuickTime.

I will post my changes to Matthias Heymann who is the maintainer of  
that package.



More information about the R-SIG-Mac mailing list