Skip to main content

Module mix

Module mix 

Source
Expand description

Shared multi-track mixing for assemble and daw. Port of mix_common.py.

Stems are classified by the parsed script’s direction_type, then built into a foreground (dialogue, SFX, beats — laid end to end with a gap) and background layers (ambience looped to the next cue, music at its cue, the vintage crackle between its markers). Every audio operation is a Segment call, so the arithmetic is pydub’s.

Modules§

config
The slices of the cast and SFX config models the mixing stages read. Port of the relevant parts of CastConfiguration, VoiceConfig, SfxEntry and SfxConfiguration in models.py.
timeline
Multitrack timeline views. Port of timeline_viz.py.

Structs§

Label
A label / timeline span: the widest Python label tuple, unset fields None.
LoopSpec 🔒
What distinguishes the two looped layers: which plans, which skip rule, which fallback label, and how a corrupt stem is named in the warning.
StemPlan
Resolved metadata for one stem file (or a boundary sentinel).

Constants§

AMBIENCE_LEVEL_DB
AMBIENCE_LOOP 🔒
BACKGROUND_DIRECTION_TYPES
Direction types routed to the background layers.
DEDUPED_TREATMENTS 🔒
Treatments that must not stack with the same cast filter.
FILTER_REGISTRY 🔒
The speaker keys FILTER_REGISTRY knows, for the unknown-filter warning.
MUSIC_LEVEL_DB
SPAN_DIRECTION_TREATMENTS
Span markers and the treatment each engages, in stacking order.
VINTAGE_LOOP 🔒

Statics§

WARNED_UNKNOWN_FILTERS 🔒

Functions§

amb_skip 🔒
amb_text 🔒
apply_clip_effects 🔒
_apply_clip_effects.
apply_named_filter 🔒
_apply_named_filter.
apply_speaker_filters
apply_vintage_filter
apply_vintage_filter — mono collapse, pydub single-pole EQ, -3 dB.
build_ambience_layer
build_dialogue_layer
build_foreground
build_foreground → (foreground, timeline).
build_foreground_timeline_only
build_foreground_timeline_only — header durations, no decoding.
build_looped_layer 🔒
Shared loop for the ambience and vintage-filter layers. With render off it computes only the labels (compute_*_labels), without decoding.
build_music_layer
build_sfx_layer
build_vintage_filter_layer
by_seq
Stable sort by seq, as sorted(plans, key=lambda p: p.seq).
cast_filter_names
_cast_filter_names.
collect_stem_plans
collect_stem_plans(stems_dir, entries_index, sfx_config).
compute_ambience_labels
compute_dialogue_labels
compute_dialogue_labels.
compute_music_labels
compute_sfx_labels
compute_vintage_filter_labels
cues_for 🔒
derive_structure_bands
derive_structure_bands(entries_index, timeline, total_ms, key).
extract_seq
extract_seq(filepath); None where Python raises ValueError.
find_effect_entry
_find_effect_entry: exact key, then em-dash-normalised.
get_str 🔒
glob_mp3 🔒
glob.glob(os.path.join(dir, "*.mp3")), sorted.
join
os.path.join(stems_dir, name) spelled the way glob returns it.
label_text 🔒
last_underscore_part 🔒
basename.rsplit("_", 1)[-1].
load 🔒
Load a stem, as AudioSegment.from_file. Decode failures are fatal in the builders that do not catch them, as they are in Python.
load_entries_index
load_entries_index(parsed_path) — insertion-ordered, last entry wins.
loop_clip 🔒
_loop_clip(clip, duration_ms).
loop_end 🔒
The end of a looped span: the next cue of the same kind after this one.
mp3_duration_ms
_mp3_duration_ms — mutagen’s header read, truncated to whole ms.
normalize_effect_key 🔒
py_int 🔒
int(prefix) for a stem prefix — whitespace, sign and _ separators between digits are all accepted by Python.
resolve_audio_params 🔒
_resolve_audio_params.
sorted_of 🔒
span_marker 🔒
span_names_to_apply 🔒
span_scope 🔒
span_sentinel_markers 🔒
Which markers of each span type get a synthetic boundary plan.
span_treatments
_span_treatments: dialogue seq → treatments of the spans open there.
stem_basename
os.path.splitext(os.path.basename(p))[0].
strip_chars 🔒
Python str.strip(chars).
treat_dialogue 🔒
Dialogue treatment shared by the foreground and the dialogue layer.
trim_to_pct 🔒
segment[:max(1, int(len(segment) * pct / 100.0))].
tts_model_of 🔒
The COMM::eng text of a dialogue stem, only if mutagen could open it as an MP3 at all (it raises, and the Python swallows, otherwise).
vf_skip 🔒
vf_text 🔒
volume_pct_to_db
_volume_pct_to_db.
warn_missing_treatment_codecs 🔒
_warn_missing_treatment_codecs.

Type Aliases§

AudioParams 🔒