Skip to main content

Module audio

Module audio 

Source
Expand description

A bounded local copy of workspace audio, so playback of a NAS workspace reads the network once, and the “play all” concatenation preview.

Constants§

AUDIO_CACHE_MAX_BYTES
_AUDIO_CACHE_MAX_BYTES.
COPY_CHUNK 🔒

Functions§

audio_cache_dir
_audio_cache_dir(): $XDG_CACHE_HOME (or ~/.cache)/xil-gui/audio.
cache_url
The /cache/... URL for a file inside the audio cache, or None when the path is elsewhere (a failed copy falls back to the workspace original).
cached_audio_path
_cached_audio_path(src): copy src into the cache (keyed by path, size and mtime) and return the copy. Any I/O failure returns src unchanged.
concatenate_stems
_concatenate_stems(slug, tag, filter): every matching stem joined into one cached MP3, keyed by the ordered (path, size, mtime) of its inputs so a repeat click is instant and a re-produced stem rolls the key over.
evict_audio_cache
_evict_audio_cache(cache_dir, keep): delete oldest files until the cache is under AUDIO_CACHE_MAX_BYTES.
hex 🔒
mtime_ns 🔒
touch 🔒