Write a PTSample as a "wav", "8svx" or "raw" audio file.
Usage
# S4 method for class 'PTSample,character'
write.sample(sample, filename, what = c("wav", "8svx", "raw"))Arguments
- sample
A
PTSampleobject that needs to be exported to an audio file.- filename
A
characterstring representing the filename to which the audio needs to be saved.- what
A
characterstring indicating what type of file is to be exported. Can be one of the following:"wav"(default),"8svx"or"raw". TheAmigaFFHpackage needs to be installed in order to write 8svx files.
Details
This method provides a wrapper for the tuneR::writeWave method
from tuneR::tuneR. It also provides the means to export audio
to file formats native to the Commodore Amiga. PTSamples can be
exported as simple (uncompressed) 8svx
files also known as "iff" files). In addition they can be exported as raw data,
where each byte simply represents a signed integer value of the waveform.
See also
Other sample.operations:
PTSample-class,
PTSample-method,
fineTune(),
loopLength(),
loopSample(),
loopStart(),
loopState(),
name,
playSample(),
read.sample(),
sampleLength(),
volume(),
waveform()
Other io.operations:
read.module(),
read.sample(),
write.module()
Examples
data("mod.intro")
## Export the second sample of mod.intro as a wav file:
write.sample(PTSample(mod.intro, 2), tempfile(fileext = ".wav"), "wav")
## Export the second sample of mod.intro as an 8svx file:
write.sample(PTSample(mod.intro, 2), tempfile(fileext = ".iff"), "8svx")
## Export the second sample of mod.intro as a raw file:
write.sample(PTSample(mod.intro, 2), tempfile(fileext = ".raw"), "raw")