Timeline Viz
src.xil_pipeline.timeline_viz
Multitrack timeline visualization for the audio pipeline.
Renders a visual representation of asset placement across all four audio layers (dialogue, ambience, music, SFX). Two output formats are supported:
- Terminal ASCII timeline — printed to stdout, auto-scaled to terminal width.
- HTML interactive timeline — self-contained file with hover tooltips and zoom.
No pydub dependency — consumes label tuples only.
Usage (from XILP005): python XILP005_daw_export.py --episode S02E03 --timeline python XILP005_daw_export.py --episode S02E03 --timeline-html
LayerSpan
dataclass
A single asset placement on the timeline.
Attributes:
-
start_s(float) –Start time in seconds.
-
end_s(float) –End time in seconds.
-
label(str) –Human-readable label (speaker name, SFX text, etc.).
-
ramp_in_s(float | None) –Fade-in duration in seconds, or
Noneif not set. -
ramp_out_s(float | None) –Fade-out duration in seconds, or
Noneif not set. -
play_duration(float | None) –Percentage of file to play, or
Noneif not set. -
snippet(str | None) –First 5 words of dialogue text for HTML tooltip, or
None. -
volume_pct(float | None) –Volume percentage (100 = unity), or
Noneif not set. -
seq(int | None) –Sequence number from the parsed script, or
None.
Source code in src/xil_pipeline/timeline_viz.py
TimelineData
dataclass
Complete timeline data for all four layers.
Attributes:
-
tag(str) –Episode tag (e.g.
"S02E03"). -
total_duration_s(float) –Total episode duration in seconds.
-
layers(dict[str, list[LayerSpan]]) –Mapping of layer name to list of :class:
LayerSpaninstances.
Source code in src/xil_pipeline/timeline_viz.py
layers
class-attribute
instance-attribute
build_timeline_data
build_timeline_data(tag: str, total_s: float, dlg_labels: list, amb_labels: list, mus_labels: list, sfx_labels: list, vf_labels: list | None = None) -> TimelineData
Wrap the layer label lists into a :class:TimelineData object.
Label tuples may be 3-element (start_s, end_s, text),
5-element (start_s, end_s, text, ramp_in_s, ramp_out_s),
6-element (start_s, end_s, text, ramp_in_s, ramp_out_s, play_duration), or
7-element (start_s, end_s, text, ramp_in_s, ramp_out_s, play_duration, snippet).
Parameters:
-
tag(str) –Episode tag.
-
total_s(float) –Total episode duration in seconds.
-
dlg_labels(list) –Dialogue label 7-tuples
(start_s, end_s, speaker, None, None, None, snippet). -
amb_labels(list) –Ambience label tuples (may carry ramp data).
-
mus_labels(list) –Music label tuples (may carry ramp data).
-
sfx_labels(list) –SFX label tuples.
-
vf_labels(list | None, default:None) –Vintage filter label tuples (may carry ramp data).
Returns:
-
TimelineData–A populated :class:
TimelineDatainstance.
Source code in src/xil_pipeline/timeline_viz.py
render_terminal_timeline
Render a multi-line Unicode timeline string for terminal display.
Parameters:
-
data(TimelineData) –Timeline data from :func:
build_timeline_data. -
width(int | None, default:None) –Terminal width in characters. If
None, auto-detected via :func:shutil.get_terminal_size.
Returns:
-
str–Multi-line string suitable for printing to stdout.
Source code in src/xil_pipeline/timeline_viz.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
render_html_timeline
Write a self-contained HTML timeline file.
Parameters:
-
data(TimelineData) –Timeline data from :func:
build_timeline_data. -
output_path(str) –Path to write the HTML file.
-
stems_dir(str | None, default:None) –Directory of episode stem MP3 files. When provided, clicking a timeline block plays the corresponding stem via an embedded audio player (served by Gradio's
/gradio_api/file=endpoint).
Returns:
-
str–The path written (same as output_path).