Timeline¶
Sheets: videogram, motion, sound and segmentation on a shared time axis.

shade= draws a span's extent rather than the line where it began. A line lets a reader
assume a section ran until the next line; on the corpus this was built for that is wrong by
21 minutes, because the warm-up ends and nothing happens for a third of an hour before the
rehearsal starts.
Every sheet prints its own decimation factor, so a rendering artefact is never mistaken for data, and writes a JSON sidecar recording every boundary drawn.
The composite sheet: videogram, envelope, waveform and segmentation on one axis.
One renderer, three configurations. The overview, the improvisation sheet and the action strip differ only in the span of time they cover and in which level's boundaries they draw, so they are one function called three ways rather than three functions that drift apart.
Boundaries are drawn across every panel, so a proposed cut is read against the motion, the sound and the picture at once rather than against whichever signal produced it.
Video and audio decimate independently. The design's rule is that audio stays on its own clock and is never binned to the 20 ms video frame grid, because forcing both onto one grid quantises away the very asymmetry this corpus was recorded to study. That rule holds at render time too: each panel reduces its own samples to the available pixel columns.
decimate_minmax ¶
decimate_minmax(x, n_columns)
Reduce a signal to n_columns, keeping the extreme of each column.
Never a mean. An overview exists to show where the brief events are, and a mean is precisely what removes them: a single frame of large motion in a four-second column is the thing a viewer zoomed out to find.
The final partial column is kept rather than truncated away, so the end of a recording is drawn, and it is padded with the edge value rather than with zeros, which would draw a trough that is not in the recording.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
The signal, one dimension. |
required | |
n_columns
|
int
|
How many output columns are wanted. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
(mins, maxs, factor), where |
|
|
meant to be printed on the figure. |
Source code in musicalgestures/_timeline.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
render_timeline ¶
render_timeline(analysis_dir, start_s=0.0, end_s=None, panels=('videogram_v', 'qom', 'waveform', 'speech'), levels=('part',), hierarchy=None, speech=None, audio=None, out=None, dpi=150, title=None, shade=None, shade_label='shade')
One sheet: videogram, motion, sound and segmentation on a shared time axis.
The same function makes all three tiers. An overview passes the whole file and
levels=("part",); an improvisation sheet passes one part's span and
levels=("phrase",); an action strip passes one phrase and levels=("action",).
A sidecar .json is written beside the image recording the decimation factor, the
time range and every boundary drawn, so a figure can always be traced back to the
numbers behind it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analysis_dir
|
Directory holding |
required | |
start_s
|
float
|
Where the sheet begins, in seconds. |
0.0
|
end_s
|
Where it ends. None means the end of the recording. |
None
|
|
panels
|
tuple
|
Which panels to stack, top to bottom. A |
('videogram_v', 'qom', 'waveform', 'speech')
|
levels
|
tuple
|
Which hierarchy levels to draw boundaries for. |
('part',)
|
hierarchy
|
A |
None
|
|
speech
|
Speech spans for the |
None
|
|
audio
|
Path to a WAV for the |
None
|
|
out
|
Output path. Defaults to a name built from the time range. |
None
|
|
dpi
|
int
|
Figure resolution. Defaults to 150. |
150
|
title
|
Figure title. Defaults to the directory name and time range. |
None
|
|
shade
|
Actions to draw as shaded regions rather than as boundary lines. A line
marks where something began and lets a reader assume it ran until the next
line; on this project's corpus that is wrong by 21 minutes, because the
warm-up ends and nothing happens for a third of an hour before the rehearsal
starts. Where a span has an extent, showing the extent is the honest figure.
Defaults to None. The idiom is |
None
|
|
shade_label
|
str
|
Which label key to read from each shaded Action for its
caption. Defaults to |
'shade'
|
Returns:
| Name | Type | Description |
|---|---|---|
Path |
The image written. |
Source code in musicalgestures/_timeline.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 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 | |