rikhoffbauer2 commited on
Commit
36db45b
·
verified ·
1 Parent(s): 8f0d74f

v4: no double-kicks (5kHz split+sneak), xcorr beat align, pre-drop mix-in (structure.py)

Browse files
Files changed (1) hide show
  1. structure.py +13 -9
structure.py CHANGED
@@ -207,17 +207,21 @@ def find_mix_points(analysis) -> dict:
207
  intros = [s for s in segments if get(s, 'label') == 'intro']
208
  outros = [s for s in segments if get(s, 'label') == 'outro']
209
 
210
- # Mix-in: start of the BUILDUP before the first drop.
211
- # The audience hears B from here. The intro plays on headphones only.
212
- # If no buildup, use 16 bars before the first drop.
213
- if buildups:
214
- mix_in_time = get(buildups[0], 'start')
215
- elif drops:
216
- # 16 bars before the first drop
 
 
 
217
  bars_16 = 16 * 4 * 60.0 / max(analysis.bpm, 60)
218
- mix_in_time = max(0, get(drops[0], 'start') - bars_16)
219
  else:
220
- mix_in_time = duration * 0.15
 
221
 
222
  # First drop
223
  if drops:
 
207
  intros = [s for s in segments if get(s, 'label') == 'intro']
208
  outros = [s for s in segments if get(s, 'label') == 'outro']
209
 
210
+ # Mix-in: where the audience first hears this track.
211
+ # Prefer: buildup BEFORE the first drop (the energy ramp into the drop).
212
+ # If no buildup before the drop, use the last 16 bars of the intro.
213
+ first_drop_time = get(drops[0], 'start') if drops else duration * 0.3
214
+
215
+ pre_drop_buildups = [s for s in buildups if get(s, 'start') < first_drop_time]
216
+ if pre_drop_buildups:
217
+ mix_in_time = get(pre_drop_buildups[-1], 'start')
218
+ elif intros:
219
+ # No buildup detected — use intro, 16 bars before the drop
220
  bars_16 = 16 * 4 * 60.0 / max(analysis.bpm, 60)
221
+ mix_in_time = max(0, first_drop_time - bars_16)
222
  else:
223
+ bars_16 = 16 * 4 * 60.0 / max(analysis.bpm, 60)
224
+ mix_in_time = max(0, first_drop_time - bars_16)
225
 
226
  # First drop
227
  if drops: