R/mono.R

mono <- 
function(object, which = c("left", "right", "both")){
    if(!is(object, "Wave")) 
        stop("Object not of class 'Wave'")
    validObject(object)
    which <- match.arg(which)
    return(
        switch(which,
            left = {
                object@stereo <- FALSE
                object@right <- numeric(0)
                object
            },
            right = {
                object@left <- object@right
                object@stereo <- FALSE
                object@right <- numeric(0)
                object
            },
            both = {
                object@left <- (object@right + object@left) / 2
                object@stereo <- FALSE
                object@right <- numeric(0)
                object
            }
        )
    )
}

Try the tuneR package in your browser

Any scripts or data that you put into this service are public.

tuneR documentation built on May 2, 2019, 6:15 p.m.