Audio

The Gorilla3D audio building block covers everything a game needs to be heard: a backend independent audio manager, two interchangeable drivers (FMOD and OpenAL), a ready-made playlist component, and two speech modules that sit on top of the stack — Text-to-Speech for talking characters and Speech-to-Text for voice input.

Table of Contents

Architecture

Everything is layered on the abstract TGorillaAudioManager. The speech modules never talk to FMOD or OpenAL directly — they only use the backend independent interface, so switching the driver does not touch a line of their code.

   TGorillaTextToSpeech        TGorillaSpeechToText        TGorillaAudioPlaylist
   (characters, lipsync)       (microphone, commands)      (tracks, shuffle)
            |                           |                           |
            +-------------+-------------+-------------+-------------+
                          |                           |
                 TGorillaAudioManager (abstract) — sounds, channels, listener
                          |                           |
            +-------------+                           +-------------+
            |                                                       |
   TGorillaFMODAudioManager                            TGorillaOpenALManager
   (FMOD Core API)                                     (OpenAL Soft + EFX)

Beside this stack there is the old TGorillaLegacyAudioManager, a thread based wrapper around the FMX TMediaPlayer. It is kept for simple "play a jingle" scenarios and for projects migrating from earlier Gorilla3D versions — see Audio Manager.

The Pages of this Section

Page Content
Audio Manager The backend independent API: sound items, channels, the 3D listener, Update(), and the legacy manager
FMOD Driver TGorillaFMODAudioManager: channel groups, DSP effects, 3D reverb, geometry occlusion, licensing
OpenAL Driver TGorillaOpenALManager: sources, buffers, EFX effects, distance models, codecs
Audio Playlist TGorillaAudioPlaylist: track list, shuffle, loop, auto-advance
Text-to-Speech TGorillaTextToSpeech with the Piper backend, visemes and lipsync
Speech-to-Text TGorillaSpeechToText with the whisper.cpp and Vosk backends, voice commands

Choosing a Driver

FMOD OpenAL
3D spatialization Yes Yes
DSP effect chains Yes (full DSP graph) EFX effects (reverb, chorus, echo, distortion, flanger, compressor)
Channel groups / buses Yes Channels grouping several sounds
Geometry based occlusion Yes No
3D reverb zones Yes Reverb effect slots only
Streaming Yes Yes
Built-in codecs Very broad (MP3, OGG, WAV, FLAC, MOD, MIDI, …) WAV, plus MP3 and OGG Vorbis through the bundled decoders
Licensing Commercial product, free below a revenue threshold Open source (LGPL / ISC depending on build)
Redistribution FMOD libraries must be shipped with the app OpenAL Soft libraries must be shipped or installed

Rule of thumb: take FMOD when the sound design is a feature of the game — buses, effect chains, occlusion. Take OpenAL when you want positional audio without a commercial dependency.

Both drivers can even be used side by side in one application, since every component that consumes audio takes its manager through a property.

Platform Support

Platform Legacy manager FMOD OpenAL TTS (Piper) STT (whisper.cpp / Vosk)
Windows Yes Yes Yes Yes Yes
macOS Yes Yes Yes Yes Yes
Linux Limited — Yes Yes Yes
Android Yes Yes (via JNI) — HTTP mode only Library mode only
iOS Yes Yes — HTTP mode only Library mode only

The mobile restriction of the speech modules comes from process spawning: Piper and whisper-cli are external executables, which mobile platforms do not allow. Their library and HTTP modes are unaffected.

Units at a Glance

Unit Content
Gorilla.Audio.Manager TGorillaAudioManager, TGorillaSoundItem, TGorillaLegacyAudioManager
Gorilla.Audio.FMOD* FMOD driver, system, sounds, channels, channel groups, DSP, reverb, geometry
Gorilla.Audio.OpenAL* OpenAL driver, loader, API bindings, MP3 and OGG decoders
Gorilla.Audio.Playlist TGorillaAudioPlaylist
Gorilla.Audio.TTS* Speech synthesis, speakers, visemes, phonemizers, Piper backend
Gorilla.Audio.STT* Speech recognition, capture, voice activity detection, whisper.cpp and Vosk backends

Quick Start

uses
  Gorilla.Audio.Manager, Gorilla.Audio.OpenAL;

var
  LAudio : TGorillaOpenALManager;
  LSound : TGorillaSoundItem;
begin
  LAudio := TGorillaOpenALManager.Create(Self);
  LAudio.Parent := GorillaViewport1;

  LSound := LAudio.LoadSoundItemFromFile('sounds/explosion.wav');
  LAudio.PlaySound(LSound);

  // call once per frame, drives streaming and 3D updates
  LAudio.Update();
end;

See Also

API Reference

Related Topics