I am building a script in R for selecting WAV files. However, in the last few lines, when I try to use the Wave function of the tuneR package to determine the audio file configuration it does not recognize the function. I need this function to be able to save my final file to the output directory, how do I get this?
library(seewave)
library(tuneR)
library(warbleR)
library(monitoR)
input_dir <- setwd("D:\\teste")!
output_dir <- setwd("D:\\teste_saida")!
setwd(input_dir)
lis.files<-dir(".", pattern="wav")
list.sample.lucas<-sample(lista.arquivos)
list.sample.lucas.01<-list.sample.lucas[1:4]
for (i in lista.aleat.lucas.01){
audios <- readWave(i, from = 0, to = 60, units = c("seconds"), header = FALSE, toWaveMC = TRUE)
audios2 <- Wave(left=channel,rigth = channel, samp.rate=audios@samp.rate, bit= audios@bit)
file_novo<-paste("Lucas_01_", lista.aleat.lucas.01, sep="")
setwd(output_dir)
writeWave(audios2, file_novo, extensible = TRUE)
setwd(input_dir)
}
audios2 <- Wave(left=channel,rigth = channel, samp.rate=audios@samp.rate, bit= audios@bit)
Error in (function (classes, fdef, mtable) unable to find an inherited method for function ‘Wave’ for signature ‘"function"’
I hope to be able to list my wav files, randomly select 2 files and save as WAV file in the output directory.