WaveToIFF {AmigaFFH}R Documentation

Convert WaveMC objects into an Interchange File Format object


Convert 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"), ...)



A WaveMC object that needs to be converted into an IFFChunk object. x can also be any other class object that can be coerced into a WaveMC object. Wave and PTSample objects are therefore also allowed.


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. loop.start therefore should be a whole non-negative number. When set to NA or negative values, the sample will not be looped.


A whole positive numeric value indicating the number of octaves that should be stored in the resulting IFF chunk. The original wave will be resampled for each value larger than 1. Each subsequent octave will contain precisely twice as many samples as the previous octave.


A character string indicating whether compression should be applied to the waveform. "sCmpNone" (default) applies no compression, "sCmpFibDelta" applies the lossy deltaFibonacciCompression.


Currently ignored.


WaveMC objects can be read from contemporary file containers with readWave or 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 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



See Also

Other iff.operations: IFFChunk-class, as.raster, 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)

[Package AmigaFFH version 0.3.1 Index]