readWave: Reading Wave files

View source: R/readWave.R

readWaveR Documentation

Reading Wave files

Description

Reading Wave files.

Usage

readWave(filename, from = 1, to = Inf, 
    units = c("samples", "seconds", "minutes", "hours"), header = FALSE, toWaveMC = NULL)

Arguments

filename

Filename of the file to be read.

from

Where to start reading (in order to save memory by reading wave file piecewise), in units.

to

Where to stop reading (in order to save memory by reading wave file piecewise), in units.

units

Units in which from and to is given, the default is "samples", but can be set to time intervals such as "seconds", see the Usage Section above.

header

If TRUE, just header information of the Wave file are returned, otherwise (the default) the whole Wave object.

toWaveMC

If TRUE, a WaveMC-class object is returned. If NULL (default) or FALSE and a non-extensible Wave file or an extensible Wave file with no other than the “FL” and “FR” channels is found, a Wave-class object is returned, otherwise a WaveMC-class object.

Value

An object of class Wave or WaveMC or a list containing just the header information if header = TRUE. If the latter, some experimental support for reading bext chunks in Broadcast Wave Format files is implemented, and the content is returned as an unprocessed string (character).

Author(s)

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

See Also

Wave-class, Wave, WaveMC-class, WaveMC, writeWave

Examples

Wobj <- sine(440)

tdir <- tempdir()
tfile <- file.path(tdir, "myWave.wav")
writeWave(Wobj, filename = tfile)
list.files(tdir, pattern = "\\.wav$")
newWobj <- readWave(tfile)
newWobj
file.remove(tfile)

tuneR documentation built on May 29, 2024, 11:28 a.m.

Related to readWave in tuneR...