library("tuneR") vol = function(w, indices, n=50) { # w : wave object # indices: points at which to compute the volume # number of samples to use left = w@left for (j in indices) { from = j to = j + n vol = sd(left[from:to]) print(vol) } }