channels {sound}R Documentation

Number of Channels of a Sample Object

Description

Get or set the number of channels of a Sample object or a wav file.

Usage

channels(s)
channels(s) <- value
setChannels(s,value)

Arguments

s

a Sample object, or a string giving the name of a wav file.

value

1 for mono, or 2 for stereo.

Details

The replacement form can be used to reset the number of channels of a Sample object (here, filenames are not accepted).

If a mono sample is transformed into a stereo sample, each channel of the stereo sample equals the waveform of the mono sample. If a stereo Sample is transformed to a mono sample, (left(s)+right(s))/2 is returned.

Value

For channels, the number of channels of the sample (1 for mono, 2 for stereo).

For setChannels, a Sample object with the new channels parameter.

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

fitSampleParameters

Examples

## Not run: 
s <- stereo(Sine(440,1),Sine(220,1))
channels(s)  # 2
play(s)
channels(s) <- 1  # now a mono sample
play(s)

## End(Not run)

[Package sound version 1.4.6 Index]