extractWave: Extractor for Wave and WaveMC objects

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

Description

Extractor function that allows to extract inner parts for Wave or WaveMC objects (interactively).

Usage

1
2
extractWave(object, from = 1, to = length(object), 
    interact = interactive(), xunit = c("samples", "time"), ...)

Arguments

object

Object of class Wave or class WaveMC.

from

Sample number or time in seconds (see xunit) at which to start extraction.

to

Sample number or time in seconds (see xunit) at which to stop extraction. If to < from, object will be returned as is.

interact

Logical indicating whether to choose the range to be extracted interactively (if TRUE). See Section Details.

xunit

Character indicating which units are used to specify the range to be extracted (both in arguments from and to, and in the plot, if interact = TRUE). If xunit = "time", the unit is time in seconds, otherwise the number of samples.

...

Parameters to be passed to the underlying plot function (plot-methods) if interact = TRUE.

Details

This function allows interactive selection of a range to be extracted from an object of class Wave or class WaveMC. The default is to use interactive selection if the current R session is interactive. In case of interactive selection, plot-methods plot the Wave or WaveMC object, and the user may click on the starting and ending points of his selection (given neither from nor to have been specified, see below). The cut-points are drawn and the corresponding selection will be returned in form of a Wave or WaveMC object.

Setting interact = TRUE in a non-interactive session does not work.

Setting arguments from or to explicitly means that the specified one does not need to be selected interactively, hence only the non-specified one will be selected interactively. Moreover, setting both from or to implies interact = FALSE.

Value

An object of class Wave or class WaveMC.

Author(s)

Uwe Ligges ligges@statistik.tu-dortmund.de, Sarah Schnackenberg

See Also

Wave-class, Wave, WaveMC-class, WaveMC, bind, channel, mono

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Wobj <- sine(440)
# extracting the middle 0.5 seconds of that 1 sec. sound:
Wobj2 <- extractWave(Wobj, from = 0.25, to = 0.75, xunit = "time")
Wobj2

## Not run: 
# or interactively:
Wobj2 <- extractWave(Wobj)

## End(Not run)

tlevine/tuneR documentation built on May 31, 2019, 3:52 p.m.