Hierarchy¶
Named levels of Action and the containment between them.
Levels of segmentation over one recording, related by containment.
Three levels, coarse to fine: part is talking versus improvising, phrase is a run
of related activity, action is an individual segment of motion. Each is a list of Action,
which already carries features for what was measured and labels for what is
claimed, and the distinction between those two is the one thing here worth protecting.
Containment is computed on demand rather than stored as a tree. A level is a hypothesis, and every one of them will be recomputed --- a stored tree would make re-cutting the action level invalidate the phrase level that has nothing to do with it. Asking which phrase contains an action is cheap; keeping a tree correct is not.
Nothing here claims the levels are right. They are a draft for a person to
correct, which is why _annotate exists.
Hierarchy
dataclass
¶
Hierarchy(levels=dict())
Named levels of Action, and the containment between them.
Attributes:
| Name | Type | Description |
|---|---|---|
levels |
dict
|
Level name to the list of Actions at that level, in time order. |
children ¶
children(action, level)
The Actions at level whose midpoint falls inside action.
Midpoint, not overlap. A span that merely overlaps two parents would be returned by both, and twelve actions under three phrases would count as fourteen. The midpoint puts every child under exactly one parent.
Source code in musicalgestures/_hierarchy.py
39 40 41 42 43 44 45 46 47 48 49 50 51 | |
parent ¶
parent(action, level)
The Action at level containing action's midpoint, or None.
Source code in musicalgestures/_hierarchy.py
53 54 55 56 57 58 59 | |
to_dict ¶
to_dict()
A plain structure for JSON, one entry per level.
Source code in musicalgestures/_hierarchy.py
61 62 63 64 65 66 | |
part_level ¶
part_level(qom, fs, speech, quiet_percentile=25.0, min_part_s=60.0, tolerance_s=5.0, smooth_s=10.0)
Cut a session into improvisations and the talking between them.
Not from motion alone. ARJ's observation about this corpus is that the dancers talk between improvisations and hardly at all while dancing, so a between-improvisation section is where speech is present AND motion is low, and an improvisation is the converse. Two weak signals that agree beat one strong one, and this keys on what the session does rather than on how an envelope happens to bend.
It also makes the segmentation falsifiable. Every part records in features which
signals supported its start:
"both"--- the motion floor and the detector marked the same transition;"motion_only"--- motion dropped where nobody spoke;"vad_only"--- somebody spoke where motion did not drop.
Only "both" is an assertion. The other two are guesses and the renderer draws
them differently, so a reader sees which boundaries to distrust without reading a
log.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qom
|
Quantity of motion per frame. |
required | |
fs
|
float
|
Frames per second of |
required |
speech
|
Speech spans, as returned by |
required | |
quiet_percentile
|
float
|
Motion below this percentile of the session counts as low. A percentile rather than a fraction of the range, because a session's outlier spikes make the range meaningless. |
25.0
|
min_part_s
|
float
|
Parts shorter than this are absorbed into their neighbour. |
60.0
|
tolerance_s
|
float
|
How close two transitions must be to count as agreeing. |
5.0
|
smooth_s
|
float
|
Window for smoothing the envelope before thresholding. |
10.0
|
Returns:
| Name | Type | Description |
|---|---|---|
list |
list[Action]
|
Parts in time order, each labelled |
Source code in musicalgestures/_hierarchy.py
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 | |