plot.Sample: Plot a Sample Object

Description Usage Arguments Note Author(s) See Also Examples

View source: R/sound.R

Description

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

Usage

1
2
## 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 <[email protected]>

Maintainer: Stefan Langenberg <[email protected]>

See Also

print.Sample

Examples

1
2
3
4
5
6
7
## 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)

sound documentation built on Nov. 17, 2017, 5:09 a.m.

Related to plot.Sample in sound...