“权限被拒绝";播放WAV文件时 [英] "Permission denied" when playing WAV file
问题描述
我正在尝试使用tuneR包在R中播放wav文件.我不知道该函数的背景,但是似乎它试图将wav文件保存到它无法访问的临时文件中.我正在执行以下操作:
I am trying to play a wav file in R using the tuneR package. I don't know the background of the function, but it seems that it tries to save the wav file to a temporary file that it doesn't have access to. I am doing the following:
> # install package if you don't have it
> install.packages("tuneR")
> library(tuneR)
> # load some WAV file
> mySound = readWave("Beethoven.wav");
> # plot it to see if things are working:
> plot(mySound)
> # play the sound
> play(mySound)
sh: /var/folders/qv/sw8_92hn4qg0rb5w40gz9mf40000gn/T//RtmpKU9kVN/tuneRtemp.wav: Permission denied
很显然,它无权访问此文件夹.如何更改此文件夹或授予R访问此文件夹的权限?
So clearly it doesn't have access to this folder. How can I either change this folder or give R access to this folder?
我正在使用RStudio版本0.98.501的MacOSX 10.7.5.
I'm working on MacOSX 10.7.5, with RStudio Version 0.98.501.
推荐答案
使用OSX时,一个简单的解决方案是在/usr/bin中使用内置的命令行音频播放器afplay.(请参阅: http://hints.macworld.com/article.php?story=20081002080543392)
When using OSX a simple solution is to use the a built-in command line audio player afplay in /usr/bin. (see: http://hints.macworld.com/article.php?story=20081002080543392 )
因此使用:
setWavPlayer('/usr/bin/afplay')
这篇关于“权限被拒绝";播放WAV文件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!