library("tuneR") vol = function(w, indices, n=50) { # w : wave object # indices: points at which to compute the volume # number of samples to use # return a vector of volumes left = w@left vol = c() # empty vector count = 0 for (j in indices) { count = count + 1 from = j to = j + n vol[count] = sd(left[from:to]) } print(indices) title = paste("skip factor= ", indices[3]) plot(vol, main=title); lines(vol); return(vol) }