Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit44fd9e59bd

README.md

SoundClip Importer

Promotes a loose audio file (ogg / mp3 / wav / flac) into a managed .soundClip/ container. This is the loose-audio → container step only.

What it does

When a bare audio file lands OUTSIDE any .soundClip/, the importer creates <name>.soundClip/ beside it through asset.create("soundClip", ...), then moves the uploaded file into it:

foo.ogg  →  foo.soundClip/
              foo.ogg        the original, moved in under its own name (never lost)
              settings.yaml  the clip's resolved settings, stamped by asset.create
              data.zaud      engine-native encoded payload
              .metadata      what data.zaud was encoded from
              README.md      the type's template note

asset.create resolves the new clip's settings — the schema's defaults and any preset or importer layer — stamps them into settings.yaml, and encodes data.zaud from the uploaded bytes in the same call, so the clip is complete the moment it exists. The move that follows is quiet: it lands the original file without firing a second encode.

After the import

Everything inside the container is the soundClip assetType's: soundClip.assetType/behavior.luau::onChange reacts to writes inside a .soundClip/ instance. Rewriting the retained audio re-encodes data.zaud from it; changing an encode setting (clipRef:setSettings({ ... }), or an edit of settings.yaml) re-encodes it against the new values.

This split mirrors the engine's two write seams:

SeamFires forConsumer
loose-file (onLooseWrite)a write with no enclosing typed-asset folderthis importer (promote)
per-type (onChange)a write inside a <name>.<type>/ instancethe soundClip assetType (re-encode data.zaud)

Encoding

data.zaud is the canonical ZAUD payload the runtime decodes and plays. The audio encoder is exposed to Luau as the audio.* namespace, consumed by the assetType's onCreate and onChange.