Commit 831d3f14 by PLN (Algolia)

fix(foundry): the cheat sheet printed 133 bpm over loops cut at 132.5

`loopAt` is exact, so a rounded tempo is a stretched loop — and the cheat sheet is
where the number gets typed. It reported ANGIE and BIG HEN as "133 bpm" over files cut
at 132.51, which plays every one of them 0.4% fast.

Two decimals now, and each kit prints its own `setcps` line rather than leaving the
÷60÷4 to the reader: `loopAt` squeezes the file into N bars of the *current* cps, so
the cps is half the instruction and omitting it is what makes the rounding bite.

Same fix in La Cale's UI, where the transport read 123.05 next to a row reading
123.0 — one `fmtBpm` for the transport, the rack header and every row, because the
same tempo printed two ways reads as a disagreement in the data.
parent ebcd5664
......@@ -476,9 +476,12 @@ def cheatsheet(cuts: list[CutLoop]) -> str:
lines = ["-- fred kits — generated by engine.stempack; n indices are sort order", ""]
for kit in sorted({c.kit for c in cuts}):
items = sorted((c for c in cuts if c.kit == kit), key=lambda c: c.name)
bpms = {round(c.bpm) for c in items if c.bpm}
# NOT rounded to an integer. This is the number someone types into `setcps`,
# and ANGIE is 132.5 — printing "133 bpm" over loops cut at 132.5 makes every
# one of them play 0.4% fast, because `loopAt` is exact.
bpms = {round(c.bpm, 2) for c in items if c.bpm}
lines.append(f"-- {kit} ({len(items)} samples"
+ (f", {'/'.join(str(b) for b in sorted(bpms))} bpm)" if bpms else ")"))
+ (f", {'/'.join(f'{b:g}' for b in sorted(bpms))} bpm)" if bpms else ")"))
for i, c in enumerate(items):
inst = (c.tags.get("instrument") or [("", 0)])[0][0]
how = f"loopAt {c.bars}" if c.bars > 0 else f"one-shot {c.dur_s:.2f}s"
......@@ -486,6 +489,11 @@ def cheatsheet(cuts: list[CutLoop]) -> str:
f"{c.stem_role}{(' · ' + inst) if inst else ''}")
ex = items[0]
if ex.bars > 0:
# `loopAt` squeezes the file into N bars of the CURRENT cps, so the cps is
# half the instruction. Printing the bpm and leaving the arithmetic to the
# reader is how a 132.5 kit ends up played at 133.
if ex.bpm:
lines.append(f"-- setcps ({ex.bpm / 60 / 4:.4f}) -- {ex.bpm:g} bpm")
lines.append(f'-- d1 $ loopAt {ex.bars} $ chop 8 $ s "{kit}" # n 0')
else:
lines.append(f'-- d1 $ s "{kit}*4" # n (irand {len(items)})')
......
-- fred kits — generated by engine.stempack; n indices are sort order
-- fred_angie_bass (3 samples, 133 bpm)
-- fred_angie_bass (3 samples, 132.51 bpm)
-- n 0 00_bass_8b S loopAt 8 bass · an acid bassline
-- n 1 01_bass_8b S loopAt 8 bass · an acid bassline
-- n 2 02_bass_2b S loopAt 2 bass · an acid bassline
-- setcps (0.5521) -- 132.51 bpm
-- d1 $ loopAt 8 $ chop 8 $ s "fred_angie_bass" # n 0
-- fred_angie_drums (3 samples, 133 bpm)
-- fred_angie_drums (3 samples, 132.51 bpm)
-- n 0 00_drumbreaks_2b S loopAt 2 drum breaks · a drum break
-- n 1 01_alldrums_1b S loopAt 1 all drums · a drum break
-- n 2 02_alldrums_2b A loopAt 2 all drums · a drum break
-- setcps (0.5521) -- 132.51 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_angie_drums" # n 0
-- fred_angie_fx (2 samples, 133 bpm)
-- fred_angie_fx (2 samples, 132.51 bpm)
-- n 0 00_fx_chop S one-shot 0.5 fx · a spoken voice
-- n 1 01_fx_1b A loopAt 1 fx · hand percussion
-- d1 $ s "fred_angie_fx*4" # n (irand 2)
-- fred_angie_hits (2 samples, 133 bpm)
-- fred_angie_hits (2 samples, 132.51 bpm)
-- n 0 00_kicks_chop S one-shot 0.4 kicks · a kick drum
-- n 1 01_snare_chop S one-shot 1.8 snare · a hi-hat
-- d1 $ s "fred_angie_hits*4" # n (irand 2)
-- fred_angie_tonal (5 samples, 133 bpm)
-- fred_angie_tonal (5 samples, 132.51 bpm)
-- n 0 00_synth_8b S loopAt 8 synth · a synth pad
-- n 1 01_synth_2b B loopAt 2 synth · a synth pad
-- n 2 02_synth_2b B loopAt 2 synth · an electric guitar
-- n 3 03_padstuff_2b B loopAt 2 pad stuff · an electric guitar
-- n 4 04_padstuff_1b B loopAt 1 pad stuff · a synth lead
-- setcps (0.5521) -- 132.51 bpm
-- d1 $ loopAt 8 $ chop 8 $ s "fred_angie_tonal" # n 0
-- fred_angie_vox (7 samples, 133 bpm)
-- fred_angie_vox (7 samples, 132.51 bpm)
-- n 0 00_bv_chop S one-shot 0.6 bv · a spoken voice
-- n 1 01_lv_chop S one-shot 0.2 lv · a saxophone
-- n 2 02_lv_4b B loopAt 4 lv · a solo singing voice
......@@ -40,33 +43,35 @@
-- n 6 06_bv_1b B loopAt 1 bv · a solo singing voice
-- d1 $ s "fred_angie_vox*4" # n (irand 7)
-- fred_angieinterlude_bass (1 samples, 112 bpm)
-- fred_angieinterlude_bass (1 samples, 112.35 bpm)
-- n 0 00_pad_2b S loopAt 2 pad · a synth pad
-- setcps (0.4681) -- 112.35 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_angieinterlude_bass" # n 0
-- fred_angieinterlude_fx (4 samples, 112 bpm)
-- fred_angieinterlude_fx (4 samples, 112.35 bpm)
-- n 0 00_ipadtextures_chop S one-shot 0.3 ipad textures · a saxophone
-- n 1 01_drone_chop S one-shot 0.3 drone · a rhodes electric piano
-- n 2 02_noise_4b A loopAt 4 noise · a sub bass
-- n 3 03_noise_1b A loopAt 1 noise · hand percussion
-- d1 $ s "fred_angieinterlude_fx*4" # n (irand 4)
-- fred_angieinterlude_hits (1 samples, 112 bpm)
-- fred_angieinterlude_hits (1 samples, 112.35 bpm)
-- n 0 00_kick_chop S one-shot 0.5 kick · a kick drum
-- d1 $ s "fred_angieinterlude_hits*4" # n (irand 1)
-- fred_angieinterlude_vox (2 samples, 112 bpm)
-- fred_angieinterlude_vox (2 samples, 112.35 bpm)
-- n 0 00_voices_chop S one-shot 0.4 voices · a spoken voice
-- n 1 01_fvox_chop S one-shot 0.3 f vox · a spoken voice
-- d1 $ s "fred_angieinterlude_vox*4" # n (irand 2)
-- fred_bighen_bass (3 samples, 133 bpm)
-- fred_bighen_bass (3 samples, 132.51 bpm)
-- n 0 00_bass_8b S loopAt 8 bass · a sub bass
-- n 1 01_bass_8b S loopAt 8 bass · a kick drum
-- n 2 02_bass_4b B loopAt 4 bass · a sub bass
-- setcps (0.5521) -- 132.51 bpm
-- d1 $ loopAt 8 $ chop 8 $ s "fred_bighen_bass" # n 0
-- fred_bighen_drums (9 samples, 133 bpm)
-- fred_bighen_drums (9 samples, 132.51 bpm)
-- n 0 00_maindrumloop_2b S loopAt 2 main drum loop · a drum break
-- n 1 01_alldrums_2b S loopAt 2 all drums · a drum break
-- n 2 02_drumbreaks_1b S loopAt 1 drum breaks · a drum break
......@@ -76,22 +81,25 @@
-- n 6 06_alldrums_8b B loopAt 8 all drums · a drum break
-- n 7 07_drumbreaks_4b B loopAt 4 drum breaks · a drum break
-- n 8 08_drumbreaks_8b B loopAt 8 drum breaks · a drum break
-- setcps (0.5521) -- 132.51 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_bighen_drums" # n 0
-- fred_bighen_fx (1 samples, 133 bpm)
-- fred_bighen_fx (1 samples, 132.51 bpm)
-- n 0 00_fx_1b S loopAt 1 fx · hand percussion
-- setcps (0.5521) -- 132.51 bpm
-- d1 $ loopAt 1 $ chop 8 $ s "fred_bighen_fx" # n 0
-- fred_bighen_hits (1 samples, 133 bpm)
-- fred_bighen_hits (1 samples, 132.51 bpm)
-- n 0 00_snare_chop A one-shot 0.3 snare · a hi-hat
-- d1 $ s "fred_bighen_hits*4" # n (irand 1)
-- fred_bighen_tonal (2 samples, 133 bpm)
-- fred_bighen_tonal (2 samples, 132.51 bpm)
-- n 0 00_strings_2b S loopAt 2 strings · an electric guitar
-- n 1 01_synth_2b S loopAt 2 synth · a rhodes electric piano
-- setcps (0.5521) -- 132.51 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_bighen_tonal" # n 0
-- fred_bighen_vox (8 samples, 133 bpm)
-- fred_bighen_vox (8 samples, 132.51 bpm)
-- n 0 00_lv_chop S one-shot 0.3 lv · a solo singing voice
-- n 1 01_lv_4b S loopAt 4 lv · a solo singing voice
-- n 2 02_lv_1b S loopAt 1 lv · a solo singing voice
......@@ -105,6 +113,7 @@
-- fred_dermot_bass (2 samples, 152 bpm)
-- n 0 00_bass_8b S loopAt 8 bass · an acid bassline
-- n 1 01_bass_2b S loopAt 2 bass · a sub bass
-- setcps (0.6333) -- 152 bpm
-- d1 $ loopAt 8 $ chop 8 $ s "fred_dermot_bass" # n 0
-- fred_dermot_drums (7 samples, 152 bpm)
......@@ -115,6 +124,7 @@
-- n 4 04_alldrums_2b A loopAt 2 all drums · a drum break
-- n 5 05_hihatsetc_4b A loopAt 4 hihats etc · a hi-hat
-- n 6 06_hihatsetc_1b A loopAt 1 hihats etc · hand percussion
-- setcps (0.6333) -- 152 bpm
-- d1 $ loopAt 1 $ chop 8 $ s "fred_dermot_drums" # n 0
-- fred_dermot_hits (2 samples, 152 bpm)
......@@ -126,6 +136,7 @@
-- n 0 00_keys1_2b A loopAt 2 keys1 · a synth pad
-- n 1 01_guitar_1b B loopAt 1 guitar · hand percussion
-- n 2 02_guitar_4b B loopAt 4 guitar · an acid bassline
-- setcps (0.6333) -- 152 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_dermot_tonal" # n 0
-- fred_dermot_vox (5 samples, 152 bpm)
......@@ -136,46 +147,50 @@
-- n 4 04_lv_2b B loopAt 2 lv · a solo singing voice
-- d1 $ s "fred_dermot_vox*4" # n (irand 5)
-- fred_iamaparty_bass (1 samples, 105 bpm)
-- fred_iamaparty_bass (1 samples, 105.47 bpm)
-- n 0 00_bass_2b B loopAt 2 bass · an acid bassline
-- setcps (0.4395) -- 105.47 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_iamaparty_bass" # n 0
-- fred_iamaparty_drums (4 samples, 105 bpm)
-- fred_iamaparty_drums (4 samples, 105.47 bpm)
-- n 0 00_alldrums_8b S loopAt 8 all drums · a drum break
-- n 1 01_alldrums_1b S loopAt 1 all drums · a drum break
-- n 2 02_alldrums_4b S loopAt 4 all drums · a drum break
-- n 3 03_hihatsetc_1b B loopAt 1 hihats etc · a drum break
-- setcps (0.4395) -- 105.47 bpm
-- d1 $ loopAt 8 $ chop 8 $ s "fred_iamaparty_drums" # n 0
-- fred_iamaparty_fx (4 samples, 105 bpm)
-- fred_iamaparty_fx (4 samples, 105.47 bpm)
-- n 0 00_fx_chop S one-shot 0.5 fx · a drum break
-- n 1 01_drones_1b A loopAt 1 drones · an electric guitar
-- n 2 02_drones_2b B loopAt 2 drones · an electric guitar
-- n 3 03_drones_chop B one-shot 0.3 drones · an electric guitar
-- d1 $ s "fred_iamaparty_fx*4" # n (irand 4)
-- fred_iamaparty_hits (2 samples, 105 bpm)
-- fred_iamaparty_hits (2 samples, 105.47 bpm)
-- n 0 00_snare_chop A one-shot 0.7 snare · a snare drum
-- n 1 01_kick_chop B one-shot 1.1 kick · a kick drum
-- d1 $ s "fred_iamaparty_hits*4" # n (irand 2)
-- fred_iamaparty_tonal (3 samples, 105 bpm)
-- fred_iamaparty_tonal (3 samples, 105.47 bpm)
-- n 0 00_synth_1b B loopAt 1 synth · a synth lead
-- n 1 01_synth_4b B loopAt 4 synth · a synth lead
-- n 2 02_synth_4b B loopAt 4 synth · a synth lead
-- setcps (0.4395) -- 105.47 bpm
-- d1 $ loopAt 1 $ chop 8 $ s "fred_iamaparty_tonal" # n 0
-- fred_iamaparty_vox (3 samples, 105 bpm)
-- fred_iamaparty_vox (3 samples, 105.47 bpm)
-- n 0 00_lv_chop S one-shot 0.4 lv · a spoken voice
-- n 1 01_bv_chop A one-shot 0.3 bv · an electric guitar
-- n 2 02_lv_1b B loopAt 1 lv · a spoken voice
-- d1 $ s "fred_iamaparty_vox*4" # n (irand 3)
-- fred_marea_bass (1 samples, 123 bpm)
-- fred_marea_bass (1 samples, 123.05 bpm)
-- n 0 00_bass_2b S loopAt 2 bass · a sub bass
-- setcps (0.5127) -- 123.05 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_marea_bass" # n 0
-- fred_marea_drums (12 samples, 123 bpm)
-- fred_marea_drums (12 samples, 123.05 bpm)
-- n 0 00_kit_1b S loopAt 1 kit · a drum break
-- n 1 01_kit_1b S loopAt 1 kit · a drum break
-- n 2 02_kit_1b S loopAt 1 kit · a drum break
......@@ -188,22 +203,24 @@
-- n 9 09_perc_8b A loopAt 8 perc · a hi-hat
-- n 10 10_marea_4b A loopAt 4 marea · a spoken voice
-- n 11 11_marea_4b A loopAt 4 marea · a synth pad
-- setcps (0.5127) -- 123.05 bpm
-- d1 $ loopAt 1 $ chop 8 $ s "fred_marea_drums" # n 0
-- fred_marea_hits (2 samples, 123 bpm)
-- fred_marea_hits (2 samples, 123.05 bpm)
-- n 0 00_kick_chop S one-shot 0.4 kick · a kick drum
-- n 1 01_clap_chop A one-shot 0.5 clap · hand percussion
-- d1 $ s "fred_marea_hits*4" # n (irand 2)
-- fred_marea_tonal (5 samples, 123 bpm)
-- fred_marea_tonal (5 samples, 123.05 bpm)
-- n 0 00_keys1_2b S loopAt 2 keys1 · a synth pad
-- n 1 01_keys2_1b S loopAt 1 keys2 · a synth lead
-- n 2 02_keys2_2b S loopAt 2 keys2 · a synth lead
-- n 3 03_keys2_2b S loopAt 2 keys2 · a solo singing voice
-- n 4 04_keys1_2b A loopAt 2 keys1 · a hammond organ
-- setcps (0.5127) -- 123.05 bpm
-- d1 $ loopAt 2 $ chop 8 $ s "fred_marea_tonal" # n 0
-- fred_marea_vox (8 samples, 123 bpm)
-- fred_marea_vox (8 samples, 123.05 bpm)
-- n 0 00_tonivox_chop S one-shot 0.5 toni vox · a saxophone
-- n 1 01_makeitthruvox_chop S one-shot 0.5 make it thru vox · a drum break
-- n 2 02_breaths_1b S loopAt 1 breaths · a hi-hat
......@@ -216,6 +233,7 @@
-- fred_me_bass (1 samples, 152 bpm)
-- n 0 00_bass_1b B loopAt 1 bass · a sub bass
-- setcps (0.6333) -- 152 bpm
-- d1 $ loopAt 1 $ chop 8 $ s "fred_me_bass" # n 0
-- fred_me_fx (4 samples, 152 bpm)
......@@ -227,6 +245,7 @@
-- fred_me_tonal (1 samples, 152 bpm)
-- n 0 00_keys_1b B loopAt 1 keys · a grand piano
-- setcps (0.6333) -- 152 bpm
-- d1 $ loopAt 1 $ chop 8 $ s "fred_me_tonal" # n 0
-- fred_me_vox (2 samples, 152 bpm)
......@@ -234,22 +253,23 @@
-- n 1 01_voxtextures_chop S one-shot 0.3 vox textures · a solo singing voice
-- d1 $ s "fred_me_vox*4" # n (irand 2)
-- fred_pleasemakeitbetter_hits (2 samples, 123 bpm)
-- fred_pleasemakeitbetter_hits (2 samples, 123.05 bpm)
-- n 0 00_toms_chop S one-shot 0.3 toms · a kick drum
-- n 1 01_kick_chop S one-shot 0.4 kick · a kick drum
-- d1 $ s "fred_pleasemakeitbetter_hits*4" # n (irand 2)
-- fred_pleasemakeitbetter_vox (2 samples, 123 bpm)
-- fred_pleasemakeitbetter_vox (2 samples, 123.05 bpm)
-- n 0 00_lv_chop S one-shot 0.4 lv · hand percussion
-- n 1 01_bv_chop S one-shot 0.4 bv · hand percussion
-- d1 $ s "fred_pleasemakeitbetter_vox*4" # n (irand 2)
-- fred_yasminah_bass (2 samples, 117 bpm)
-- fred_yasminah_bass (2 samples, 117.45 bpm)
-- n 0 00_bass_4b B loopAt 4 bass · an acid bassline
-- n 1 01_bass_2b B loopAt 2 bass · an acid bassline
-- setcps (0.4894) -- 117.45 bpm
-- d1 $ loopAt 4 $ chop 8 $ s "fred_yasminah_bass" # n 0
-- fred_yasminah_drums (10 samples, 117 bpm)
-- fred_yasminah_drums (10 samples, 117.45 bpm)
-- n 0 00_drumloop1_1b S loopAt 1 drum loop 1 · a drum break
-- n 1 01_drumloop1_2b S loopAt 2 drum loop 1 · a drum break
-- n 2 02_drumloop1_1b S loopAt 1 drum loop 1 · a drum break
......@@ -260,17 +280,19 @@
-- n 7 07_hidrums_1b S loopAt 1 hi drums · a hi-hat
-- n 8 08_lodrums_8b S loopAt 8 lo drums · a snare drum
-- n 9 09_lodrums_2b A loopAt 2 lo drums · a saxophone
-- setcps (0.4894) -- 117.45 bpm
-- d1 $ loopAt 1 $ chop 8 $ s "fred_yasminah_drums" # n 0
-- fred_yasminah_hits (1 samples, 117 bpm)
-- fred_yasminah_hits (1 samples, 117.45 bpm)
-- n 0 00_kick_chop A one-shot 0.5 kick · a kick drum
-- d1 $ s "fred_yasminah_hits*4" # n (irand 1)
-- fred_yasminah_tonal (1 samples, 117 bpm)
-- fred_yasminah_tonal (1 samples, 117.45 bpm)
-- n 0 00_keys_4b B loopAt 4 keys · a synth pad
-- setcps (0.4894) -- 117.45 bpm
-- d1 $ loopAt 4 $ chop 8 $ s "fred_yasminah_tonal" # n 0
-- fred_yasminah_vox (6 samples, 117 bpm)
-- fred_yasminah_vox (6 samples, 117.45 bpm)
-- n 0 00_lv_chop S one-shot 0.5 lv · a spoken voice
-- n 1 01_bv_2b S loopAt 2 bv · a solo singing voice
-- n 2 02_bv_chop A one-shot 0.3 bv · a drum break
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment