plot.Sample {sound}R Documentation

Plot a Sample Object

Description

Plot the waveform of a Sample object or a wav file.

Usage

## S3 method for class 'Sample'
plot(x,xlab="sample #",ylab=NULL,...)

Arguments

x

a Sample object, or a string giving the name of a wav file. If x is a string, the explicit form plot.Sample must be used.

xlab

the character string giving the label for the x-axis.

ylab

For mono Sample objects as usual. For stereo Sample objects, ylab can be a vector of two strings to distinguish the y-labels for the left and the right channel. If ylab=NULL, the presets are used, that is "waveform" for mono samples and c("left","right") for stereo samples.

...

further graphical parameters.

Note

Use plot(s[interval]) to plot parts of s only (see examples).

If the range of the graph exceeds [-1,1], you can use the normalize command before plotting to get a better view of the waveform. (Then you should also call this function to avoid cracks in the sound before you save or play it the next time.)

Author(s)

Author: Matthias Heymann [aut], Stefan Langenberg [cre] (<https://orcid.org/0000-0001-5817-5469>)

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

See Also

print.Sample

Examples

## Not run: s <- Sine(440,1) + .4*Sine(1000,1)
plot(s[1:1000])
play(s)
s <- normalize(s)
plot(s[1:1000])  # now the range of the waveform is in [-1,1]
play(s)  # no cracks!
## End(Not run)

[Package sound version 1.4.6 Index]