Rhythmic Pitch Percussion — User Guide

Builds a rhythmic target-pitch contour around the source median F0, using hit envelopes, polyrhythmic ghost events, correlated humanization, and a low-level tension wave.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.4.1 (2026) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

Rhythmic Pitch Percussion analyses the selected Sound only to obtain a reliable median F0, then constructs a new PitchTier around that median. The new contour is driven by a binary rhythm pattern, three-stage decaying hit envelopes, polyrhythmic ghost events, per-beat humanization, and a small continuous tension wave.

Important: the source pitch contour is not preserved. The source median F0 is used as the anchor, and the rhythmic engine generates a new time-varying target pitch around it. Praat overlap-add resynthesis then applies that shared target PitchTier independently to every source channel.

Signal flow:

Sound → mono pitch analysis → median F0
→ rhythm / ghost / tension pitch-offset curve in Hz
→ target PitchTier = median F0 + offset
→ synthesis safety limits
→ per-channel Manipulation + overlap-add
→ rebuild original channel count → attenuation-only peak safety

Quick start

  1. Select exactly one Sound object in Praat.
  2. Run Rhythmic_Pitch_Percussion.praat.
  3. Choose one of the five built-in presets or Custom.
  4. For Custom, enter a binary underscore-separated Rhythm_pattern, for example 1_0_1_1_0_1.
  5. Adjust hit strength, decay, polyrhythmic density, and ghost-hit amount.
  6. Adjust analysis settings only when the source F0 requires a different range.
  7. Choose whether to draw the visualization and play the result.
Timing model: the complete rhythm pattern is stretched once across the full duration of the Sound. It is not a BPM-based grid and it does not loop automatically. A 16-beat pattern on a 4-second file gives 250 ms per beat; the same pattern on an 8-second file gives 500 ms per beat.

Rhythm and pitch engine

Pattern parsing

Rhythm_pattern must contain only underscore-separated 0 and 1 tokens. At least one beat is required and the maximum is 512 beats.

Pattern semantics

1 activates the main percussive pitch envelope for that beat. 0 omits the main hit, although ghost events and the tension wave can still contribute small pitch offsets.

Beat duration is derived from the source duration:

beat_duration = sound_duration / number_of_pattern_beats

Main hit envelope

Within a hit beat, normalized beat phase runs from 0 to 1. Three decays are summed:

attack = exp(−3 × Decay_rate × phase)
body = 0.6 × exp(−0.8 × Decay_rate × phase)
tail = 0.2 × exp(−0.3 × Decay_rate × phase)

envelope = attack + body + tail
fundamental_hit = Hit_strength × envelope
harmonic_hit = 0.4 × Hit_strength × envelope × sin(8π × phase)

Hit_strength is a frequency offset in Hz, not semitones. The two hit components are summed and multiplied by one correlated humanization value for the entire beat.

Polyrhythmic ghost events

A second phase grid runs at Polyrhythm_factor times the main beat rate. At the first 10% of each polyrhythmic subdivision, a ghost event is added when Ghost_hits > 0:

ghost_envelope = exp(−20 × poly_phase)
ghost_hit = Ghost_hits × Hit_strength × ghost_envelope

Ghost events have their own correlated humanization value per polyrhythmic subdivision bucket. They are generated independently of whether the underlying main-pattern beat is 0 or 1.

Humanization and tension

Humanization is random but correlated: each main beat receives one multiplier uniformly drawn from 0.95…1.05, and each polyrhythmic subdivision bucket receives one independent multiplier in the same range. There is no seed control, so repeated runs can differ.

A small continuous tension component is always added:

tension_base = sin(2π × beat_position)
tension_modulation = 1 + 0.3 × sin(7π × beat_position)
tension_wave_hz = 0.8 × tension_base × tension_modulation

Target pitch

The generated offset is added to the source median F0:

new_F0(t) = median_F0 + pitch_offset_hz(t)

The final target is limited independently of the analysis range to 20 Hz through 0.45 × source sample rate. The Info window reports how many generated PitchTier points required this safety limiting.

Presets

The menu contains five built-in presets plus Custom. Presets replace only Rhythm_pattern, Hit_strength, Decay_rate, Polyrhythm_factor, and Ghost_hits. Analysis, Npoints, visualization, and playback settings remain as entered by the user.

PresetPatternStrengthDecayPolyGhosts
Techno Kick1_0_0_0_1_0_0_0_1_0_0_0_1_0_0_0150 Hz1510
Trap Hi-Hat1_1_1_1_0_1_1_1_1_1_0_1_1_1_1_08 Hz4082.0
Dubstep Wobble1_0_1_0_1_0_1_0_1_0_1_0_1_0120 Hz2110.8
Breakbeat1_0_0_1_0_1_0_0_1_0_1_0_1_0_0_1100 Hz2071.2
Minimal Pulse1_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0180 Hz0.510
CustomUses the form values unchanged.

Parameters

ParameterDefaultMeaning
PresetCustomFive built-in configurations or direct use of the form values.
Rhythm_pattern1_0_1_1_0_1_0_1_1_0_0_1Binary pattern stretched once across the complete Sound.
Hit_strength25Main pitch-offset magnitude in Hz. Must be non-negative.
Decay_rate6Controls the speed of the three hit-envelope decays. Must be greater than zero.
Polyrhythm_factor3Multiplier for the ghost-event subdivision grid. It is a positive real value, not restricted to integers.
Ghost_hits0.3Scales the polyrhythmic ghost-event magnitude relative to Hit_strength. Zero disables ghost hits.
Time_step0.005 sPitch-analysis and Manipulation time step. It does not determine the generated PitchTier point density.
Floor_pitch50 HzLower bound for source pitch analysis and Manipulation.
Ceiling_pitch900 HzUpper analysis/Manipulation bound; must remain below 45% of source sample rate.
Npoints600Number of points used to construct the generated target PitchTier; accepted range 2–20000.
Draw_visualizationYesDraw the current run in the Picture window.
Play_resultYesPlay the final Sound after processing.
Analysis range: if no usable voiced pitch is found between Floor_pitch and Ceiling_pitch, processing stops. These values determine analysis and Manipulation behavior; they are separate from the final 20 Hz … 0.45×SR synthesis-safety limits.

Output behavior

Visualization

When Draw_visualization is enabled, the script draws:

The synthesis curve uses all Npoints. Visualization storage is capped at 500 points and keeps the first generated sample that falls into each display bin.