Formula Audio Manipulation — User Guide

Multi-stage sound transformation combining a formula-generated amplitude envelope, optional contour-preserving pitch modulation, and optional ring modulation.

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

What this does

Formula Audio Manipulation processes one selected Sound through up to three stages. First, a deterministic mathematical envelope modulates amplitude. Second, if enabled and usable F0 is detected, a layered low-frequency control signal shifts the detected source pitch contour in musical interval space. Third, if enabled, the result is blended with a sine-carrier ring-modulated version.

Signal flow: Source → formula AM → optional pitch modulation → optional ring modulation → peak safety. The original number of channels, sample grid, sampling frequency, start time, and end time are preserved.

The effect is deterministic: there is no random generator or random seed. Pitch modulation depends on Praat pitch analysis, so that stage is most meaningful for voiced or otherwise clearly pitched material. If no usable pitch is detected, the script skips only the pitch stage and continues with the other enabled stages.

Quick start

  1. Select exactly one Sound object in Praat.
  2. Run Formula_Audio_Manipulation.praat.
  3. Choose a preset, or leave Manual selected and set the three processing stages directly.
  4. Use Base_frequency, Modulation_depth, and Complexity_level to define the amplitude envelope.
  5. Enable or disable Apply_pitch_modulation and Apply_ring_modulation as required.
  6. Choose whether to draw the visualization and play the result.
  7. Click OK. The result is selected when processing finishes.

Processing pipeline

1. Formula amplitude modulation

A mono envelope is created on the exact sample grid and time domain of the source, then the same envelope is multiplied into every source channel. The envelope is independent of the source waveform; channel 1 is used only to obtain a matching Sound grid.

Depth mapping used by every complexity level
envelope = 1 − md + md × shape

where md = Modulation_depth and the generated shape is mapped approximately to 0…1.

Therefore:
• md = 0 → envelope = 1 everywhere → no AM
• md = 1 → full formula envelope
• the AM stage does not intentionally amplify above unity

Complexity 1 — simple nested oscillator

shape = 0.5 + 0.5 × sin(2π·bf·t × (1 + md·0.6·sin(2π·2·t)))

Complexity 2 — layered oscillators

shape = 0.5 + 0.5 × [
  sin(2π·bf·t × (1 + 0.4·sin(2π·1.5·t))) +
  0.6·sin(2π·bf·1.618·t × (1 + 0.5·sin(2π·2.8·t))) +
  0.4·sin(2π·bf·2.718·t × (1 + 0.6·sin(2π·0.9·t)))
] / 2

At this level Modulation_depth controls the outer dry-to-envelope depth. The internal oscillator coefficients are fixed.

Complexity 3 — nested layered modulation

This level combines three oscillators at ratios 1, 1.618, and 2.414. Modulation_depth affects both the outer envelope depth and several nested phase-modulation terms.

2. Optional pitch modulation

The AM-processed signal is converted to a mono analysis reference when necessary. Praat detects its F0 contour; the script then builds a new target PitchTier from the detected source F0 at each voiced control point. It does not replace the contour with a constant median pitch.

3. Optional ring modulation

output(t) = input(t) × [1 − d + d·sin(2π·f·t)]

d = Ring_mod_depth
f = Ring_mod_frequency

Ring_mod_depth = 0 is dry. Ring_mod_depth = 1 is full bipolar ring modulation. Intermediate values are a linear blend of the dry signal and the ring-modulated signal. The same carrier is applied directly to every channel.

Presets

Presets replace the processing parameters listed below. Draw_visualization and Play_result remain as chosen by the user. Parameters belonging to a disabled stage may retain their form values, but they are not used while that stage is off.

Preset AM Pitch Ring
ManualUses the form values unchanged.
Gentle Modulation0.3 Hz · depth 0.4 · complexity 2On · 0.2 Hz · depth 0.2Off
Complex Textures1.2 Hz · depth 0.7 · complexity 3On · 0.8 Hz · depth 0.3On · 80 Hz · depth 0.4
Chaotic Systems2.5 Hz · depth 0.9 · complexity 3On · 1.5 Hz · depth 0.6On · 200 Hz · depth 0.8
Rhythmic Pulsing4.0 Hz · depth 0.6 · complexity 2OffOn · 60 Hz · depth 0.7
Harmonic Richness0.5 Hz · depth 0.5 · complexity 3On · 0.3 Hz · depth 0.4On · 150 Hz · depth 0.3
Extreme Modulation3.0 Hz · depth 1.0 · complexity 3On · 2.0 Hz · depth 0.8On · 300 Hz · depth 0.9
Subtle Evolution0.2 Hz · depth 0.3 · complexity 1On · 0.1 Hz · depth 0.15Off

Parameters

Amplitude modulation

ParameterDefaultMeaning
Base_frequency0.8Base rate in Hz used by the formula. Must be ≥ 0.
Modulation_depth0.85AM depth, 0…1. Zero gives an exact unity envelope.
Complexity_level31 = simple, 2 = layered, 3 = nested layered modulation.

Pitch modulation

ParameterDefaultMeaning
Apply_pitch_modulationYesEnables the Praat pitch-analysis/resynthesis stage.
Pitch_mod_rate0.5Base rate in Hz for the layered pitch-control oscillators. Must be ≥ 0.
Pitch_mod_depth0.4Depth control, 0…1. It is converted internally to a symmetric musical interval.

Ring modulation

ParameterDefaultMeaning
Apply_ring_modulationYesEnables the final dry/ring-modulated blend.
Ring_mod_frequency120 HzSine carrier frequency. Must be ≥ 0 and below Nyquist.
Ring_mod_depth0.6Dry-to-ring depth, 0…1.

Output

ParameterDefaultMeaning
Draw_visualizationYesDraw the analysis and processing summary in the Picture window.
Play_resultYesPlay the final Sound after processing.

Pitch modulation details

Pitch analysis uses a 5 ms analysis step, a 40 Hz floor, and a ceiling of min(1200 Hz, 0.45 × sample rate). The median detected F0 is reported only as information and as the test for whether usable pitch exists; it is not used as the replacement contour.

Depth conversion
pitchDepthSemitones = 12 × log₂(1 + Pitch_mod_depth)

Layered control
m₁ = sin(2π·rate·t)
m₂ = 0.5·sin(2π·rate·1.7·t + 0.5)
m₃ = 0.3·sin(2π·rate·0.6·t + 1.2)
shape = (m₁ + m₂ + m₃) / 1.8

semitoneShift = pitchDepthSemitones × shape
targetF0 = sourceF0 × 2^(semitoneShift/12)

The control grid is fixed at 10 ms (100 Hz) and explicitly includes the Sound end time. Points are added only where the analyzed source F0 is defined. Target values are limited to 20 Hz…0.45 × sample rate.

For multichannel material, the target PitchTier is calculated once from the mono analysis reference and then applied independently to each original channel. All channels therefore follow the same target F0 contour while the original channel count is retained.

No usable pitch: If no median F0 or no usable voiced control points are found, the pitch stage is skipped. The AM stage remains in the signal, and ring modulation still runs if enabled.

Output behavior

Visualization

When Draw_visualization is enabled, the Picture window contains:

The mono objects used for display and spectral analysis do not alter the multichannel DSP result. The waveform panels use their own automatic amplitude ranges; they are not drawn on one shared amplitude scale.