Audio record in R

后端 未结 2 871
南旧
南旧 2021-01-27 02:06

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} :

2条回答
  •  花落未央
    2021-01-27 02:26

    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)
    }
    

    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.

提交回复
热议问题