Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

readWave

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

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

Analysis of Music and Speech

v1.3.3
GPL-2 | GPL-3
Authors
Uwe Ligges <ligges@statistik.tu-dortmund.de> with contributions from Sebastian Krey, Olaf Mersmann, Sarah Schnackenberg, Guillaume Guenard, Andrea Preusser, Anita Thieler, Johanna Mielke and Claus Weihs, as well as code fragments and ideas from the former package 'sound' by Matthias Heymann and functions from 'rastamat' by Daniel P. W. Ellis. The included parts of the libmad MPEG audio decoder library are authored by Underbit Technologies.
Initial release
2018-07-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.