Skip to content
Back to formatted view

Raw Message

Message-ID: <5F8E993D-7BCA-4F5B-9ADF-CFF3DFAEEF84@eva.mpg.de>
Date: 2008-08-27T07:13:19Z
From: Hans-Jörg Bibiko
Subject: sound::setWavPlayer()
In-Reply-To: <7A609297-FEB6-4C6A-8556-BD25DB3784DA@virginia.edu>

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