开发者

Making audio drivers available in R?

I'm trying to use the following sound package in R: http://playitbyr.r-forge.r-project.org/gettingstarted.html

After installing the package and its dependencies, when I try to run

sonify(iris, sonaes(time = Petal.Length, pitch = Petal.Width))

(per the example given on the page), I get this error:

Error in play.default(x, rate, ...) : no audio drivers are available

An开发者_如何转开发yone know what I should do? I googled around a bit, and it looks like maybe I need to call set.audio.driver(name), but I'm not sure what to put as an argument.

(In case it matters, on Mac OS X Snow Leopard.)


On ubuntu, you can get the portaudio headers with

sudo apt-get install portaudio19-dev

Then, reinstall the audio library. Make sure you see

checking portaudio.h usability... yes
checking portaudio.h presence... yes

During compilation of the audio package.


Try

library(audio)
audio.drivers()
play(sin((1:10000)/5),10000)

to see if you have audio drivers. If you don't, or do not hear anything, perhaps set.audio.driver(name) or load.audio.driver(path) could help.

This page has some advice for Linux users, but says it works for Windows and OS X.


On Linux you simply need to install the Portaudio first. Download it, extract, and then follow the installation instructions. After that you need to reinstall the audio package (it needs to be recompiled to see new drivers) with simply typing install.packages('audio') again under R.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜