flutter3d_audio_core library

Positional audio for flutter3d, without a backend.

The audio model

The units are the engine's: metres, seconds, hertz, radians, linear gain and decibels — see src/units.dart, and decibelsToGain.

flutter3d_audio re-exports all of it and adds the SoLoud backend; a package that only names buses, sounds or a scene depends on this one and carries no native audio code.

Classes

Attenuation
How a sound gets quieter with distance.
AudioBackend
What actually makes noise.
AudioBus
A group of sounds that a player can turn down as one.
AudioEmitter
One sound, somewhere, possibly moving: the emitter component of the audio model.
AudioListener
Where the ears are.
AudioPlugin
The audio model in the engine loop: the mix worked out once a frame, in the loop's audio phase.
AudioScene
Decides what is heard, and how loudly.
BlendedLoop
Several loops, crossfaded by one number.
BusEffect
Something a mixer bus does to everything routed through it, beyond its volume: a filter, a reverb.
BusMix
What MixingBackend.mixBus is handed: what one bus does this mix.
DirectionalBackend
A backend that places a voice in three dimensions itself: where a binaural (HRTF) or multichannel backend comes in.
DuckRule
One bus turned down while another is heard: the music under a line of dialogue, the ambience under an explosion.
EqualPowerPanner
Distance attenuation, occlusion and an equal-power stereo pan: the audio model's spatialisation today.
ExponentialRolloff
(d / reference) ^ -factor. Steep near the source, long tail after.
Heard
One sound, and where it happened.
HeldVoices
One looping voice of sound for each thing held, kept by its key: begun when it is first heard, moved and turned to it each frame, stopped when it is no longer heard.
InverseRolloff
Falls off as 1 / distance, which is what sound actually does.
LinearRolloff
Straight line from full to silent. Predictable, and wrong.
LoopBand
One recording in a set that covers a range of some value.
LowPassEffect
Takes the top off everything on the bus above cutoffHz hertz: what "under water" and "through a wall" sound like.
Mixer
What each bus is turned to, and the one place a volume setting lives.
MixingBackend
A backend that mixes the bus tree itself: what AudioBackend grows into for buses, beside it rather than inside it.
MixSnapshot
A named state of the mix — "under water", "paused", "boss fight" — that the mixer blends into and out of.
NoAttenuation
Never gets quieter and never pans. Music, narration, the wind.
ReverbEffect
A room's tail on everything on the bus: wet of the signal sent to a reverb that dies away by 60 dB in decaySeconds seconds.
SilentBackend
A backend that makes no sound and records everything.
SilentVoice
One recorded voice. Public because a test reads it, and a type a test has to reach for is part of the interface whether or not it looks like one.
SoundBank
Everything one game can make a noise about, as one list.
SoundDef
A sound the game can ask for, by name and behaviour rather than by file.
SpatialQuery
What a SpatialRenderer is asked about one emitter: who hears, what is heard, and what stands between them.
SpatialRenderer
Turns where a sound is into how it is heard.
SpatialResult
What a SpatialRenderer decided about one emitter.
VoicePlacement
What DirectionalBackend.placeVoice is handed: a voice and where it is heard from.
VoiceRoute
What MixingBackend.routeVoice is handed: a voice just started and the bus it is on.
VoiceStart
What AudioBackend.start is handed: the voice to begin.
VoiceUpdate
What AudioBackend.update is handed: a playing voice and what it plays at now.

Constants

silenceDecibels → const double
The level, in decibels, at and below which a gain is taken as silence.
speedOfSoundInAir → const double
How fast sound travels in air at 20 °C, in metres per second: the standard world's, which a scene given no world of its own mixes in.

Functions

decibelsToGain(double decibels) → double
The linear gain of decibels: 10 ^ (decibels / 20), and exactly zero at or below silenceDecibels. Nought decibels is exactly one.
gainToDecibels(double gain) → double
Turns a distance into the decibel figure a mixing desk would show.

Typedefs

Held = ({Vector3 at, double gain, int key, double rate})
One thing to be heard while it lasts: key the same from frame to frame while it goes on — a fire, a fall of water, an engine — where it is, how loud, and how fast its sound plays, one its recording's own speed.
PoseSource = Matrix4 Function()
Where something in the scene is, asked once a mix: a node's world matrix.
VoiceId = Object
A live voice, as the backend sees it.