在右音频记录 [英] Audio record in R
问题描述
我与R中一些音频和声音包的Windows(我的是Win7的X64)播放。还有,当我试图使用记录从麦克风录制的一个问题(){}音频:
I am playing with some audio and sound packages in R for Windows (mine is Win7 x64). There is a problem when I tried to record from microphone using record() {audio} :
- 这可能只记录一次,然后无法记录更多一些,直到重新启动整个控制台
- 声音一旦被记录下来,它可以被保存,但不能播放()
- 从上面记录的文件不能被读取的音频,但由于不完整的波形文件 调谐器
-
和下面的文件名不工作
- it could record only once then cannot record some more until restart the whole console
- once sound is recorded, it could be save but cannot play()
- file recorded from above cannot be read by audio, but tuneR due to 'incomplete wave file'
and the following "filename" does not work
文件名= paste0('ABCD','。WAV)
save.wave(X,文件名)
filename=paste0('abcd','.wav') save.wave(x,filename)
直到直接将命令类型类似,这使得难写一个脚本记录/功能
until type directly to the command like, this makes hard to write a record script/function
save.wave(x,'abc.wav')
我想,如果你遇到了同样的问题问在Win人使用的音频包和另一个操作系统。谢谢你。
I want to ask anyone used audio package in Win and another OS if you met the same problem. Thanks.
推荐答案
我刚写了记录功能。它的工作原理,但运行时间后,该程序已被关闭,然后打开R-又说:
I just wrote a function for record. It works but after a running time, the program has to be closed and then open R again:
audiorec=function(kk,f){ # kk: time length in seconds; f: filename
if(f %in% list.files())
{file.remove(f); print('The former file has been replaced');}
require(audio)
s11 <- rep(NA_real_, 16000*kk) # rate=16000
record(s11, 16000, 1) # record in mono mode
wait(kk)
save.wave(s11,f)
}
的GUI仍是一个问题。我试着用Win7的其他电脑,但遇到了同样的错误。有一些错误,我还没有想通了。
Still a problem of GUI. I tried with some other computer using Win7 but met the same error. There is some bugs, I haven't figured it out.
这篇关于在右音频记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!