Expand description
SFX asset generation and stem placement โ the generation half of
sfx_common.py, plus the backends of sfx_backends.py.
Two phases, as in Python: every unique effect key gets a shared asset in
SFX/ (copied from its declared source, rendered as silence, or
generated by a backend), then each script entry gets a copy of that asset
under its sequence-numbered stem name. A manifest in the stems directory
records what was placed, with a timestamped snapshot per run.
Structsยง
- Eleven
Labs Backend - MMAudio
Backend - MMAudio via
mmaudio_worker.py(CC BY-NC 4.0 weights). - MMAudio
Options - Plan
Entry - One direction entry matched to an effect (
load_sfx_entriesoutput).
Constantsยง
Traitsยง
- SfxBackend
SfxBackend:generate_to(out_path, prompt, duration, influence)+close().
Functionsยง
- content_
key ๐ - copy2
shutil.copy2: contents, permission bits and timestamps.- default_
influence ๐ - dry_
run_ sfx dry_run_sfx(entries, config, stems_dir, sfx_dir=, backend_name=).- ensure_
shared_ sfx ensure_shared_sfx(key, effect, sfx_dir, defaults, show=, backend=).- export_
silence ๐ AudioSegment.silent(duration).export(path, format="mp3").- file_
nonempty file_nonempty(path).- generate_
sfx generate_sfx(entries, config, stems_dir, sfx_dir=, start_from=, backend=).- load_
sfx_ entries load_sfx_entries(script, sfx, max_duration, direction_types, local_only, sfx_dir).- make_
sfx_ backend make_sfx_backend(name, ...).Ok(None)means the caller should exit with status 1 (the error is already logged, assys.exit(1)does).- place_
episode_ stem place_episode_stem(shared, stem)โ whether it copied.- resolve_
source_ path resolve_source_path(source): workspace-relative, NFC/NFD tolerant.- trim_
audio_ ๐file _trim_audio_file(path, seconds).- upsert ๐
_sfx_manifest_upsert: update in place when the content key matches.- with_
api_ retries - Retry 429 / 5xx / transport failures five times, waiting 10 s, 20 s, โฆ
- write_
atomic ๐ - Write
bytesthrough a.tmpsibling and an atomic rename.
Type Aliasesยง
- Content
Key ๐