class RemiAudio::Formats::AuFile
- RemiAudio::Formats::AuFile
- RemiAudio::Formats::AudioFile
- Reference
- Object
Overview
A virtual representation of an Au file (.au/.snd).
Au files originated from Sun and store data in liner PCM, IEEE Float, µLaw, or ALaw format. Their data is stored in big endian format.
The official specification supports more encodings, some of which are
specific to certain platforms. This library does not support these. See
AuEncoding
for a list of supported encodings.
Defined in:
remiaudio/formats/au.crConstructors
-
.create(io : IO, *, sampleRate : Int = 44100, channels : Int = 2, encoding : AuEncoding = AuEncoding::Lpcm16bit, note : String | Nil = nil) : AuFile
Creates a new
AuFile
that that is backed by io and returns the new instance. -
.create(io : IO, *, sampleRate : Int = 44100, channels : Int = 2, encoding : AuEncoding = AuEncoding::Lpcm16bit, note : String | Nil = nil, &) : AuFile
Creates a new
AuFile
that that is backed by io and yields the new instance to the block. -
.create(filename : Path | String, *, sampleRate : Int = 44100, channels : Int = 2, encoding : AuEncoding = AuEncoding::Lpcm16bit, note : String | Nil = nil) : AuFile
Creates a new
AuFile
that is backed by a new file on disk. - .new(io : IO, *, sampleRate : UInt32 = 44100_u32, channels : UInt32 = 2_u32, encoding : AuEncoding = AuEncoding::Lpcm16bit, note : String | Nil = nil)
-
.new(*, sampleRate : UInt32 = 44100_u32, channels : UInt32 = 2_u32, encoding : AuEncoding = AuEncoding::Lpcm16bit, note : String | Nil = nil)
Creates a new, blank
AuFile
that is backed by a fresh::IO::Memory
. -
.open(io : IO) : AuFile
Creates a new
AuFile
by reading the existing Au data from io. -
.open(filename : Path | String) : AuFile
Creates a new
AuFile
by reading the existing Au data from the given file.
Class Method Summary
-
.create(filename : Path | String, *, sampleRate : Int = 44100, channels : Int = 2, encoding : AuEncoding = AuEncoding::Lpcm16bit, note : String | Nil = nil, &)
Creates a new
AuFile
that is backed by a new file on disk, then yields it to the block. -
.open(io : IO, &)
Creates a new
AuFile
by reading the existing Au data from io, then yields it to the block. -
.open(filename : Path | String, &)
Creates a new
AuFile
by reading the existing Au data from the file, then yields it to the block.
Instance Method Summary
-
#copyTo(dest : IO) : Nil
Writes the current state of this file to dest.
-
#encoding : AuEncoding
The
AuEncoding
that the samples in this instance uses. -
#flush : Nil
:inherited:
-
#note : String | Nil
The annotation string for this instance, or
nil
if there is none. -
#read(dest : Array(Float64)) : Int32
:inherited:
-
#readSamplesToEnd : SampleData
:inherited:
-
#sampleFormat : SampleFormat
:inherited:
Instance methods inherited from class RemiAudio::Formats::AudioFile
<<(sample : Float64) : self
<<,
bitDepth : UInt8
bitDepth,
channels : UInt32
channels,
close : Nil
close,
copyTo(dest : IO) : Nil
copyTo,
each(& : Float64 -> ) : Nil
each,
eachSample(& : Sample -> ) : Nil
eachSample,
flush : Nil
flush,
io : IO
io,
mono? : Bool
mono?,
numSamples : UInt64
numSamples,
pos : UInt64
pos,
pos=(value : Int) : Nil
pos=,
read(pos : Int) : Float64read(dest : Array(Float64)) : Int32
read : Float64 read, read? : Float64 | Nil read?, readSample(pos : Int) : Sample
readSample : Sample readSample, readSample? : Sample | Nil readSample?, readSamples(dest : SampleData) : Int32 readSamples, readSamplesToEnd : SampleData readSamplesToEnd, readToEnd : Array(Float64) readToEnd, rewind : Nil rewind, sampleFormat : SampleFormat sampleFormat, sampleRate : UInt32 sampleRate, stereo? : Bool stereo?, toEnd : Nil toEnd, withExcursion(newSamplePos : Int32, &) withExcursion, write(value : Float64) : self
write(samples : Array(Float64)) : self write, writeSample(value : Sample) : self writeSample, writeSamples(samples : SampleData) : self writeSamples
Constructor methods inherited from class RemiAudio::Formats::AudioFile
open(io : IO) : AudioFileopen(filename : Path | String) : AudioFile open
Class methods inherited from class RemiAudio::Formats::AudioFile
open(io : IO, &) : Nilopen(filename : Path | String, &) : Nil open, test(filename : Path | String) : Type | Nil test
Constructor Detail
Creates a new AuFile
that that is backed by io and returns the new
instance. A skeleton Au header data is immediately written into io.
Creates a new AuFile
that that is backed by io and yields the new
instance to the block. A skeleton Au header data is immediately written
into io. The AuFile
instance will be flushed and closed once the
block exits.
Creates a new AuFile
that is backed by a new file on disk.
This always opens the file with the mode "w+b"
(i.e. existing files are
overwritten/truncated). A skeleton Au header data is immediately written
into the file.
Creates a new, blank AuFile
that is backed by the given ::IO
. This
will immediately write a skeleton Au header into io.
Creates a new, blank AuFile
that is backed by a fresh ::IO::Memory
.
This will immediately write a skeleton Au header into #io
Creates a new AuFile
by reading the existing Au data from io. Samples
will be streamed from io as needed.
Creates a new AuFile
by reading the existing Au data from the given
file. The file is always opened with the mode "r+b"
. Samples will be
streamed from the file as needed.
Class Method Detail
Creates a new AuFile
that is backed by a new file on disk, then yields
it to the block. This automatically closes the AuFile
and the
underlying file before the block returns.
This always opens the file with the mode "w+b"
(i.e. existing files are
overwritten/truncated). A skeleton Au header data is immediately written
into the file.
Creates a new AuFile
by reading the existing Au data from io, then
yields it to the block. Samples will be streamed from io as needed.
This will NOT automatically close the AuFile
before returning in
case you have passed an io that cannot does not support writing.
Creates a new AuFile
by reading the existing Au data from the file, then
yields it to the block. The file is always opened with the mode "r+b"
.
Samples will be streamed from io as needed. This will automatically
close the AuFile
and underlying ::IO
before returning.
Instance Method Detail
Writes the current state of this file to dest. This will automatically
call #flush
before writing.