Cavern.Format
2.0.0
See the version list below for details.
dotnet add package Cavern.Format --version 2.0.0
NuGet\Install-Package Cavern.Format -Version 2.0.0
<PackageReference Include="Cavern.Format" Version="2.0.0" />
paket add Cavern.Format --version 2.0.0
#r "nuget: Cavern.Format, 2.0.0"
// Install Cavern.Format as a Cake Addin
#addin nuget:?package=Cavern.Format&version=2.0.0
// Install Cavern.Format as a Cake Tool
#tool nuget:?package=Cavern.Format&version=2.0.0
Cavern.Format
Audio transcoder library for Cavern with object-based audio support. Supported codecs:
- E-AC-3 with Joint Object Coding (Dolby Digital Plus Atmos)
- Limitless Audio Format
- RIFF WAVE
- Audio Definition Model Broadcast Wave Format Supported containers: .ac3, .eac3, .ec3, .laf, .mka, .mkv, .mov, .mp4, .qt, .wav, .weba, .webm
Quick start
This library handles reading and writing audio files. For custom rendering or
transcoding, they can be handled on a lower level than loading a Clip
.
Reading
To open any supported audio file for reading, use the following static function:
AudioReader reader = AudioReader.Open(string path);
After opening a file, the following workflows are available.
Getting all samples
The Read()
function of an AudioReader
returns all samples from the file in
an interlaced array with the size of reader.ChannelCount * reader.Length
.
Getting the samples block by block
For real-time use or cases where progress should be displayed, an audio file can
be read block-by-block. First, the header must be read, this is not done
automatically. Until the header is not read, metadata like length or channel
count are unavailable. Header reading is accomplished by calling
reader.ReadHeader()
.
The ReadBlock(float[] samples, long from, long to)
function of an
AudioReader
reads the next interlaced sample block to the specified array in
the specified index range. Samples are counted for all channels. A version of
ReadBlock
for multichannel arrays (float[channel][sample]
) is also
available, but in this case, the index range is given for a single channel.
Seeking in local files are supported by calling reader.Seek(long sample)
. The
time in sample
s is relative to reader.Length
, which means it's per a single
channel.
Rendering in an environment
The reader.GetRenderer()
function returns a Renderer
instance that creates
Source
s for each channel or audio object. These can be retrieved from the
Objects
property of the renderer. When all of them are attached to a
Listener
, they will handle fetching the samples. Seeking the reader or the
renderer works in this use case.
Writing
To create an audio file, use an AudioWriter
:
AudioWriter writer = AudioWriter.Create(string path, int channelCount, long length, int sampleRate, BitDepth bits);
This will create the AudioWriter
for the appropriate file extension if it's
supported.
Just like AudioReader
, an AudioWriter
can be used with a single call
(Write(float[] samples)
or Write(float[][] samples)
) or block by block
(WriteHeader()
and WriteBlock(float[] samples, long from, long to)
).
Development documents
- Scripting API with descriptions of all public members for all public classes
- Limitless Audio Format for storing Cavern mixes in a CPU-effective spatial format
- Cavern DCP channel order compared to DCP standards
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Cavern (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.