On Windows, playing tuneR's Wave objects is no problem: just say "play(aSound)". But on LINUX and Macintoshes running OS X, you must tell R what program to use for playback, and exactly where on your system the program is. This writeup covers only OS X.
We know of three programs that can be used to play tuneR Waves on OS X. By far the best working seems to be a program whose origin is completely unclear; it was sent to us as just "play", but to avoid confusion, we've renamed it to "playRWave". To use it:
play(aSound, "/Library/Audio/playRWave") # for case (a) above play(aSound, "/Users/donbyrd/Library/Audio/playRWave") # for case (b) aboveOr, call setWavPlayer once at the start of every run of R in which you'll be playing Waves, just after the "library(tuneR)" statement, like this:
library(tuneR)
setWavPlayer("/Library/Audio/playRWave") # for case (a) above
setWavPlayer("/Users/donbyrd/Library/Audio/playRWave") # for case (b) above
If playRWave doesn't work for you, the alternatives we know of are Apple's QuickTime Player and the open-source media player VLC. QuickTime Player is preinstalled on every Mac, and its path is nearly always "/Applications/'QuickTime Player.app'/Contents/MacOS/'QuickTime Player'". However, it usually gives a couple of scary-looking error messages every time it's used; you must hit the escape key to get R to continue after using it; and it opens (and leaves open) another QuickTime Player, always called "tuneRtemp.wav", each time it's used. This is all pretty confusing! But then, QuickTime Player wasn't designed to be run from a user-written program.
As for VLC, in our limited tests in early 2007, it seems to behave exactly the same way as QuickTime Player, which is disappointing and somewhat surprising; we'd be interested in reports about it.
Last updated: 7 Sept. 2007
Comments to: donbyrd(at)indiana.edu
Copyright 2007, Donald Byrd
Spring 2007 Music Informatics School of Informatics Indiana University