我正在尝试从我的笔记本电脑中调用音乐文件(格式为.mp3)并在R中播放它。我的笔记本电脑有windows 7。我正在使用function system(),但我无法在R中播放音乐。KMPlayer是我笔记本电脑上安装的播放器。我想播放一个名为Don.mp3的音乐,它保存在我的笔记本电脑上的以下路径中:C:\Users\Vahid\Desktop
我的代码如下:
system("KMPlayer/C:/Users/Vahid/Desktop/Don.mp3",wait=FALSE,ignore.stdout=TRUE)但在运行之后,我收到以下错误:
[1] 127
Warning message:
In system("KMPlayer/C:/Users/Vahid/Desktop/Don.mp3", wait = FALSE, :
'KMPlayer/C:/Users/Vahid/Desktop/Don.mp3' not found有没有人可以帮我解决这个错误,然后用R播放我的音乐?
发布于 2020-07-24 00:22:56
您可以使用TuneR包:
library(tuneR)
file <-file.path('C:/Users/Vahid/Desktop/Don.mp3')
mp3 <- tuneR::readMP3(file)
play(mp3)它还允许您绘制音频信号:
plot(mp3)

https://stackoverflow.com/questions/63058112
复制相似问题