sound-package {sound} | R Documentation |
A Sound Interface for R
Description
Basic functions for dealing with wav files and sound samples.
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)
Author(s)
Matthias Heymann [aut], Stefan Langenberg [cre] (<https://orcid.org/0000-0001-5817-5469>)
Maintainer: Stefan Langenberg <langenberg@uni-bonn.de>
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
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