1

I am attempting to cut .wav files according to start and end points I have assigned to each .wav file in a dataframe. I have tried using a for loop to read in each .wav file then run the function that cuts that .wav file.

Unfortunately I can't seem to get the code to work.I get the following error:

Error in if (from > to) stop("'from' cannot be superior to 'to'") : 
  missing value where TRUE/FALSE needed

Any tips would be very appreciated!

The source code is from here: https://cran.r-project.org/web/packages/warbleR/vignettes/warbleR_workflow_03.html

Here is my code:

for i in dframe$sound.files{
writeWave(seewave::cutw(readWave("i"), 
                        from = dframe$start[i], to = dframe$end[i], 
                        f = 44100, plot = FALSE, output = "Wave"), filename = "i-1.wav")}
  • I was getting this error and solved it using `floor` at the end time. Try this: `from = dframe$start[i], to = floor(dframe$end[i])` – Icaro Bombonato Dec 06 '19 at 15:57
  • Just seeing your `seewave::cutw(tuneR::readWave(` explained why I wasn't getting any results. I hadn't read in a wave to process. – Chris Dec 23 '20 at 15:21

0 Answers0