noSilence: Cut Off Silence from a Sample Object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/sound.R

Description

Cut off silence or low noise at the beginning and/or at the end of a Sample object or a wav file.

Usage

1
noSilence(s, level=0, start=TRUE, end=TRUE)

Arguments

s

a Sample object, or a string giving the name of a wav file.

level

non-negative numeric. Absolute values in the waveform matrix smaller than or equal to this value are regarded as silence.

start

logical. If TRUE, silence at the beginning of the sample will be cut off.

end

logical. If TRUE, silence at the end of the sample will be cut off.

Details

For stereo samples, it is checked if the values of both channels are silence before the silence is cut off.

Value

a Sample object without those parts at the start and at the end of the original sample that are below the specified noise level.

Author(s)

Author: Matthias Heymann <mail@MatthiasHeymann.de>

Maintainer: Stefan Langenberg <langenberg@uni-bonn.de>

See Also

cutSample

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
s <- Sine(440,5)
sound(s) <- sound(s)*matrix(seq(1,0,length=5*44100),nrow=1)
sampleLength(s)
play(s) # fade out
s <- noSilence(s,level=.05)
sampleLength(s)  # s is shorter now
play(s)    # although you don't hear that the end is missing

## End(Not run)

sound documentation built on May 2, 2019, 2:10 a.m.

Related to noSilence in sound...