Analyze Tuning
analyze_tuningChecks rendered stems or mixes against the song's 12-TET tuning grid and key, flags notes beyond tolerance, and reports per-part retuning or pitch-drift fixes.
Instructions
Check every part of a render against the song's tuning grid (12-TET) and key, and flag notes more than
tol_cents off (ledger:M231). A pitched part off the grid goes unnoticed until someone hears it: drums measured
from records keep the records' tuning (a tumba a quarter tone sharp). Run it after the first render of a song
with pitched percussion or a voice playing in a new register, and before any exam.
Reads: source='render' (default) every track stem of the last render(stems=True); 'ref' the reference's stems;
'track:', 'ref:', 'sound:' or a file path one part; 'render:mix' / 'ref:mix' a whole mix as one
part. stems=[names] keeps some parts; bars=[a, b] (inclusive) cuts the range.
Per note: the steady pitch from skip_ms (100) after its onset (plucks start sharp for ~90 ms, a drum's strike is
noise), read from spectral lines, so a chord reads one pitch per note and a drum its sustained mode; gliding
notes and noise are counted, not read. skip_ms is the longest skip: a note shorter than skip_ms / 0.3 (a fast
run: a 16th at 104 bpm is ~144 ms) is read from 0.3 of its length, so a picado scale is read, not skipped. The
attack is read too (30-80 ms after the onset, less on a short note); a note too short for a steady part is read
from its attack on and marked 'attack only' (it still counts against the grid), and one too short to resolve
its pitch (under 4 periods of it) is counted, not read. Grid: A4 = 440 Hz moved by tuning_cents; by default 0
for renders, and for a reference ref_retune has not moved, its own measured tuning. key ('A minor', 'D dorian'; default the
project's or the sketch's) lists out-of-key pitches as information (they can be intended).
Returns a table per part (pitched notes, median cents off the grid, spread = middle half, count beyond
tol_cents, attack = median cents of the attack over the steady pitch), up to worst worst notes per part
(seconds in the file, bar and beat, note, cents, Hz), and one verdict per part: in tune; the whole part off
(retune its voice by N c); a few pitches off (retune that voice or split it onto its own track); or drifting note
to note (per-note or per-string detune). When most attacks sit more than 5 c off their steady pitch, the
verdict adds "attacks start N c sharp: shorten the voice's pitch glide" (in fast runs that attack is what is
heard). A part with no steady pitch (hats, noise, a sliding vocal) says so and is skipped, never flagged.
Errors: nothing rendered or no stems -> render(stems=True) first; no reference stems -> separate(source='ref');
an unknown part in stems= -> the reply lists the parts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | ||
| bars | No | ||
| stems | No | ||
| worst | No | ||
| source | No | render | |
| project | Yes | ||
| skip_ms | No | ||
| tol_cents | No | ||
| tuning_cents | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |