Learn R Programming

sound (version 1.4.6)

sound-package: tools:::Rd_package_title("sound")

Description

tools:::Rd_package_description("sound")

Arguments

Author

tools:::Rd_package_author("sound")

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

Details

The basic object of this package is a variable of the new class Sample with properties for

  • the sampling rate.

  • the number of bits per sample.

  • the waveform matrix itself, which is a matrix with one or two rows (for mono or stereo sounds), each row representing one channel. The rows are sequences of values in [-1, 1] that discretize the waveform of the sound.

Sample objects can be created with the command as.Sample

sample <- as.Sample(sound,rate,bits)

where sound is the waveform matrix of the sample. Alternatively, one can use loadSample

sample <- loadSample(filename)

to load a wav-file on the hard disk and convert it into a Sample object. Similarly, one can save a Sample object as a wav-file, using saveSample

saveSample(sample,filename)

References

M. Heymann and M. Hansen, A new set of sound commands for R; Sonification of the HMC algorithm, in ASA Proceedings, Statistical Computing Section, pp. 1439-1443, 2002. http://www.matthiasheymann.de/Download/Sonification.pdf

See Also

package tuneR.

Examples

Run this code
   sample1 <- Sine(440, 10) # create a sin waveform sample with 440 Hz
   sample2 <- Sine(1000, 10) # create a sin waveform sample with 1000 Hz
   sample1 + sample2 # adding two waveforms
   appendSample(sample1, sample2) # merging waveforms

Run the code above in your browser using DataLab