FWIW the default should be to use "open" because that allows the user to map .wav to any applications they desire, you should not be hard- coding that in your code via -a. On a similar note sound could do a better job of finding player since most users that deal with audio/video are likely to already have mplayer installed, so checking for mplayer and play may be a good idea. Finally, playing sound on OS X takes one line of code, so adding a player directly to the package would be trivial (or maybe creating a package that does the playing if desired..).

Cheers,
Simon


On Aug 27, 2008, at 10:17 , Hans-Jörg Bibiko wrote:

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.

Cheers,

--Hans

_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac



_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to