prepComb {tuneR}R Documentation

Preparing the combination/concatenation of Wave objects

Description

Preparing objects of class Wave for binding/combination/concatenation by removing small amounts at the beginning/end of the Wave in order to make the transition smooth by avoiding clicks.

Usage

prepComb(object, zero = 0, where = c("both", "start", "end"))

Arguments

object Object of class Wave.
zero The zero level (default: 0) at which ideal cut points are determined (see Details). A typical alternative would be 127 for 8 bit Wave objects. If zero=NA, the mean of the left Wave channel is taken as zero level.
where One of “both” (default), “start”, or “end” indicating at where to prepare the Wave object for concatenation.

Details

This function is useful to prepare objects of class Wave for binding/combination/concatenation. At the side(s) indicated by where small amounts of the Wave are removed in order to make the transition between two Waves smooth (avoiding clicks).

This is done by dropping all values at the beginning of a Wave before the first positive point after the zero level is crossed from negative to positive. Analogously, at the end of a Wave all points are cut after the last negative value before the last zero level crossing from negative to positive.

Value

An object of class Wave.

Note

If stereo, only the left channel is analyzed while the right channel will be simply cut at the same locations.

Author(s)

Uwe Ligges, ligges@statistik.tu-dortmund.de, based on code from Matthias Heymann's former package ‘sound’.

See Also

bind, Wave-class, Wave, extractWave, and noSilence to cut off silence

Examples

Wobj1 <- sine(440, duration = 520, bit = 16)
Wobj2 <- extractWave(sine(330, duration = 500, bit = 16), from = 110, to = 500)
par(mfrow = c(2,1))
plot(bind(Wobj1, Wobj2), xunit = "samples")
abline(v = 520, col = "red")  # here is a "click"!

# now remove the "click" by deleting a minimal amount of information:
Wobj1 <- prepComb(Wobj1, where = "end")
Wobj2 <- prepComb(Wobj2, where = "start")
plot(bind(Wobj1, Wobj2), xunit = "samples")

[Package tuneR version 0.2-10 Index]