Kick Detector and Bass Adder – User Guide
Automatically detects kick drum hits in a drum loop using multi-band spectral analysis and places a bass sample at each detected position, creating a synchronized bass layer mixed with the original audio.
What this does
This Praat script implements an intelligent kick drum detector that analyzes a drum loop to identify kick drum hits, then automatically places a user-provided bass sample at each detected position to create a synchronized bass layer. The detection algorithm works by extracting and analyzing three frequency bands from the drum loop: a low band (25-120 Hz) capturing the fundamental kick drum body, a low-mid band (120-250 Hz) used to reject false positives from toms and snares, and the full broadband signal. For each analysis frame, the script computes intensity values and first-order differences (spectral flux) for these bands, then applies z-score normalization to create a robust detection metric that's independent of overall loudness. The detection score combines three weighted components: low-band intensity (favoring strong bass energy), broadband positive spectral flux (capturing transient attacks), and a penalty for low-mid energy (suppressing non-kick drum sounds). Local maxima in the score function that exceed user-defined thresholds and satisfy a refractory period constraint are marked as kick positions. An adjustable time offset parameter allows fine-tuning of the detected timing to account for the acoustic onset characteristics of the specific drum loop. Once kick positions are identified and stored in a TextGrid point tier, the script creates a new sound object that mixes the original drum loop with the bass sample placed at each kick position, allowing the bass to trigger synchronously with the kick drum hits to create a cohesive rhythm section, with all results automatically played back and preserved in the Objects window.
Quick start
- In Praat, select exactly TWO Sound objects: your drum loop and your bass sample (order doesn't matter).
- Run script… →
Kick detector and bass adder.praat. - In the dialog, specify which sound is the drum loop and which is the bass sample.
- Adjust detection sensitivity using
scoreThresh(lower = more sensitive, detects more kicks). - Fine-tune timing with
timeOffsetif bass placement sounds early or late. - Set
refractoryperiod to prevent double-triggering on the same kick (typically 0.09s for most tempos). - Click "Detect and Add Bass".
- The script creates a TextGrid with kick positions and a new sound with bass added.
- The mixed result plays automatically for preview.
Parameters (form fields)
| Name (GUI) | Type | Default | Description |
|---|---|---|---|
| Sound Selection | |||
| drumLoop | choice | 1 | Select which of the two input sounds is the drum loop to be analyzed. |
| bassSample | choice | 2 | Select which of the two input sounds is the bass sample to be placed at kick positions. |
| Detection Parameters | |||
| scoreThresh | real | 0.80 | Detection score threshold (0.5-1.5). Lower values detect more kicks (more sensitive); higher values are more selective. Start with 0.80 and adjust based on results. |
| dLowThresh | real | 0.60 | Low-band spectral flux threshold (0.3-1.0). Controls sensitivity to transient energy in the kick frequency range. Lower = more sensitive. |
| refractory | real | 0.09 | Minimum time between consecutive kick detections in seconds. Prevents double-triggering on the same kick. Set based on tempo: 0.09s works for ~120-140 BPM. |
| Timing Adjustment | |||
| timeOffset | real | 0.052 | Time shift in seconds applied to all detected positions. Positive values shift bass placement later; negative values shift earlier. Use to align bass with kick transients. |
| kickWindowBefore | real | 0.01 | Not used in bass adding mode (reserved for future extraction features). |
| kickWindowAfter | real | 0.11 | Not used in bass adding mode (reserved for future extraction features). |
| Score Weights | |||
| wLow | real | 1.0 | Weight for low-band intensity in detection score. Higher values emphasize bass frequency energy. |
| wFlux | real | 0.5 | Weight for broadband positive spectral flux. Higher values emphasize transient attacks. |
| wLowMidPen | real | 0.5 | Penalty weight for low-mid energy. Higher values more aggressively reject toms and snares. |
Hidden Parameters (hardcoded)
| Name | Default | Description |
|---|---|---|
| lowBandMin | 25 Hz | Lower frequency limit for kick drum body detection. |
| lowBandMax | 120 Hz | Upper frequency limit for kick drum body detection. |
| lowMidMin | 120 Hz | Lower frequency limit for rejection band (toms/snares). |
| lowMidMax | 250 Hz | Upper frequency limit for rejection band. |
| smoothHz | 100 Hz | Smoothing bandwidth for Hann band filters. |
| hop_default | 0.01 s | Target analysis frame hop size (10ms). |
Outputs
- TextGrid:
KD_TextGrid- Contains one point tier named "Kicks"
- Each point marks a detected kick drum position
- Point labels are set to "kick"
- Useful for manual verification and editing of detections
- Sound:
[DrumLoopName]_with_bass- Original drum loop with bass sample added at each kick position
- Bass samples are mixed additively with the original audio
- Preserves the full duration of the bass sample at each trigger point
- Respects channel count: mono bass → mono mix, stereo bass → stereo mix (up to original's channels)
- Console feedback: Printed to Praat Info window:
- Input sound names (drum loop and bass sample)
- Bass sample duration
- Number of kicks detected
- Summary of outputs created
- Playback: The mixed result (
_with_bass) plays automatically after processing for immediate preview. - Preserved objects: Original sounds, TextGrid, and mixed sound all remain in Objects window for further use.
Usage Tips
- Adjusting sensitivity: If the script misses kicks, lower
scoreThreshto 0.6-0.7. If it detects false positives, raise it to 0.9-1.0. - Tempo considerations: For faster tempos (160+ BPM), reduce
refractoryto 0.06-0.07s. For slower tempos (80-100 BPM), increase to 0.12-0.15s. - Timing alignment: Listen to the mixed result. If bass sounds early, increase
timeOffsetslightly (try increments of 0.005s). If late, decrease it. - Bass sample choice: Works best with bass samples that have a clear transient and short to medium decay. Very long samples may overlap.
- Complex drums: For busy drum patterns with multiple kick drum variations, you may need to adjust
wLowMidPento better reject toms.