DEKI/ENGINE docs
deki-audio 0.19.0
Deki package reference
deki-audio

Audio playback peripheral interface with MAX98357 (I²S) backend

Repository: github.com/dekiengine/deki-audio · Latest release: 0.19.0 · Needs engine 0.19.0+ · Requires: deki-i2s

Install with DekiEditor --packages-add deki-audio <project>, or from the Package Manager. The engine's own components and C++ API are in the Deki docs.

Shown in the editor as Audio (Speaker / PCM playback).

Components

Component Category Description
MAX98357AudioComponent Sensors Plays sound through a MAX98357A I2S amplifier.

Feature flags

Parts you can leave out of a build. A feature with a define is switched there; the rest are stripped with their components.

Feature Define Default
MAX98357A (I²S class-D mono amp, 16-bit PCM) DEKI_FEATURE_AUDIO_MAX98357 on

Component reference

MAX98357AudioComponent

Plays sound through a MAX98357A I2S amplifier.

Inspector name: MAX98357A Audio · Category: Sensors · Type: DekiAudio::MAX98357AudioComponent

Property Type Default Constraints Description
i2sPort int32 0 0 to 1 Which of the chip's I2S controllers drives the amplifier. Most boards only use one.
bclkPin int32 39 0 to 48 GPIO carrying the bit clock (BCLK), which ticks once per audio bit.
lrclkPin int32 40 0 to 48 GPIO carrying the word select line (LRCLK or WS), which marks left and right samples. Some boards label it LRC.
dinPin int32 5 0 to 48 GPIO carrying the audio data into the amplifier (DIN). This is the one sound actually travels on.
sampleRate int32 16000 8000 to 48000 Samples per second. 16 kHz is plenty for speech and effects and cheap on memory; 44100 is CD rate and costs nearly three times the bandwidth.
channels int32 1 1 to 2 1 for mono, 2 for stereo. The MAX98357 is a mono amplifier, so stereo material is mixed down unless a second one is wired for the other channel.
initialVolume int32 80 0 to 100 Volume at startup, 0 to 100. Applies before the first sound plays, so a project can come up quiet rather than at full output.

Changelog

0.19.0

Changed

  • minEngine 0.19.0: built against engine 0.19.0, whose component metadata records the package each class is in. A build of this package from before does not load and is rebuilt.

Added

  • Japanese, Simplified Chinese and Korean: editor/lang/ja.json, zh.json and ko.json translate the names, tooltips and enum values this package's components show in the Inspector.
  • The package's editor text goes through the editor's translation (Tr), so it shows in the editor's language. Needs the editor release that adds Localization.h; raise minEngine to it when releasing.

0.18.0

Changed

  • minEngine 0.18.0. Reflection ABI 21: the package must be rebuilt.
  • Names follow the code style (deki-engine/docs/codestyle): types, functions and enum values are PascalCase, constants kPascalCase, members m_PascalCase, locals and parameters camelCase. The code is formatted with clang-format 22.
  • The functions the editor finds by name are PascalCase: DekiAudioRegisterComponents, DekiAudioGetAutoComponentCount, DekiAudioEnsureRegistered and the rest. Built against engine ABI 21; a build of this package from before does not load and is rebuilt.

Fixed

  • MAX98357A: after Stop() the speaker stayed silent until a restart, because playing never turned the I2S channel back on. PlayPCM now does.
  • MAX98357A: PlayPCM copied the whole clip into internal RAM to apply the volume, so a long clip ran the board out of memory. It now scales a small chunk at a time.
  • MAX98357A: initializing twice leaked the first I2S channel, and a channel that failed to start was left open.

Removed

  • The former names from before 0.16.0 (bare class names, and deki-gpio's DekiEsp32::ESP32PinSetup). A scene that old is upgraded with 0.17 first.

Earlier releases: CHANGELOG.md.


Generated from the package's reflection data (engine 0.19.0). Property names are the keys used in scene files. Renames keep an alias (compatibility).