WaveToIFF | R Documentation |
Convert tuneR::WaveMC()
objects (or objects that can be coerced to
WaveMC
objects) into an IFFChunk-class()
object which
can be stored as a valid Iterchange File Format (write.iff()
).
WaveToIFF(
x,
loop.start = NA,
octaves = 1,
compress = c("sCmpNone", "sCmpFibDelta"),
...
)
x |
A |
loop.start |
If the sample should be looped from a specific position to the
end of the sample, this argument specifies the starting position in samples (with
a base of 0) for looping. |
octaves |
A whole positive |
compress |
A |
... |
Currently ignored. |
tuneR::WaveMC()
objects can be read from contemporary file containers
with tuneR::readWave()
or tuneR::readMP3()
. With this
function such objects can be converted into an IFFChunk-class()
object
which can be stored conform the Interchange File Format (write.iff()
).
When x
is not a pcm formatted 8-bit sample, x
will first be
normalised and scaled to a pcm-formatted 8-bit sample using
tuneR::normalize()
. If you don't like the result you need to convert
the sample to 8-bit pcm yourself before calling this function.
Returns an IFFChunk-class()
object with a FORM container that
contains an 8SVX waveform based on x
.
Pepijn de Vries
https://en.wikipedia.org/wiki/8SVX
Other iff.operations:
IFFChunk-class
,
as.raster.AmigaBasicShape()
,
getIFFChunk()
,
interpretIFFChunk()
,
rasterToIFF()
,
rawToIFFChunk()
,
read.iff()
,
write.iff()
## Not run:
## First get an audio sample from the ProTrackR package
snare.samp <- ProTrackR::PTSample(ProTrackR::mod.intro, 2)
## The sample can easily be converted into an IFFChunk:
snare.iff <- WaveToIFF(snare.samp)
## You could also first convert the sample into a Wave object:
snare.wav <- as(snare.samp, "Wave")
## And then convert into an IFFChunk. The result is the same:
snare.iff <- WaveToIFF(snare.wav)
## You could also use a sine wave as input (although you will get some warnings).
## This will work because the vector of numeric data can be coerced to
## a WaveMC object
sine.iff <- WaveToIFF(sin((0:2000)/20))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.