sound (version 1.4.5)

bits: Bits per Sample

Description

Get or set the bits parameter (the sampling quality) of a Sample object or a wav file.

Usage

bits(s)
bits(s) <- value
setBits(s,value)

Value

For bits, the bits parameter (number of bits per sample) of the Sample object (8, 16 or 24).

For setBits, a Sample object with the new bits parameter.

Arguments

s

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

value

the number of bits per sample: 8, 16 or 24.

Author

Author: tools:::Rd_package_author("sound")

Maintainer: tools:::Rd_package_maintainer("sound")

Details

The replacement form can be used to reset the sampling quality of a Sample object, that is the number of bits per sample (8 or 16). Here, filenames are not accepted.

See Also

fitSampleParameters

Examples

Run this code
if (FALSE) {
s <- Sine(20000,1,rate=44100,bits=16)
play(s)
print(s)
bits(s) <- 8
play(s)  # now worse quality
print(s) # but less disk space
play(setBits(s,16)) # now better quality again, since waveform data was not changed.
}

Run the code above in your browser using DataLab