XMod — Cross Modulation — User Guide
Carrier-preserving cross modulation with ring modulation, bipolar-to-unipolar amplitude modulation, and attack/release-smoothed rhythmic or envelope gating. Control can come from an internal oscillator or a second Sound.
Overview
XMod multiplies a carrier Sound by a time-varying control signal. Depending on the selected mode, that control produces a dry-to-ring transformation, unipolar amplitude modulation, or a smoothed gate/envelope effect. The carrier's channel count, sample rate, duration, and original start time are preserved.
The modulator can be a sine, square, triangle, or sawtooth oscillator, or a second selected Sound. In Second Sound mode, v1.2.1 explicitly asks which of the two selected Sounds is the Carrier; the other becomes the Modulator. This avoids relying on Praat's object-list selection order.
Quick start
- Select one Sound when using an oscillator modulator.
- For Second Sound, select exactly two Sounds. After the main form, XMod displays both names and IDs and asks which one is the Carrier.
- Choose a preset or Custom.
- Select Ring Modulation, Amplitude Modulation, or Rhythmic Gate.
- Choose the modulator source and set frequency/depth. Gate mode also uses Attack and Release; Duty Cycle shapes the Square oscillator.
- Leave Safety peak at 0.99 for attenuation-only peak protection, or set it to 0 to disable that stage.
- Enable visualization and/or playback as desired, then run the script.
Three modulation modes
Ring Modulation
With modulator m[n], carrier x[n], and depth d:
Thus 0–1 is a dry-to-ring interpolation, not merely a ring-output gain control. Above 1, the dry term is removed and depth scales the pure ring product. For sinusoidal carrier/modulator components, multiplication produces the familiar sum/difference-frequency relationship.
Amplitude Modulation (AM)
XMod converts the bipolar modulator to a unipolar 0–1 amplitude control, then interpolates between dry and controlled amplitude:
At depth 0 the output is exactly dry. At depth 1, a sine oscillator varies the gain from 0 to 1. For a Second Sound, the modulator is peak-normalized only for the control calculation; the original source object is never modified.
Rhythmic Gate / Envelope Gate
Gate mode first creates a 0–1 target signal and then follows it with separate one-pole attack and release time constants. The smoothed envelope controls the carrier:
For a Square oscillator this behaves as a conventional rhythmic gate, with Duty Cycle determining the high portion of each cycle. Sine, triangle, and sawtooth sources generate continuous 0–1 targets rather than binary on/off targets. With a Second Sound, the rectified normalized amplitude of that sound becomes the gate target, so the result behaves as an external envelope-controlled gate.
Modulator sources
| Source | Control waveform | Important behavior |
|---|---|---|
| Sine Oscillator | sin(2πft) | Smooth bipolar control. |
| Square Oscillator | +1 / −1 | Duty Cycle determines the proportion of each cycle spent at +1. |
| Triangle Oscillator | Linear rise and fall from −1 to +1 | Continuous piecewise-linear control. |
| Sawtooth Oscillator | Linear rise from −1 to +1, then reset | Asymmetric periodic control. |
| Second Sound | External mono control derived from another selected Sound | Carrier is chosen explicitly in v1.2.1; multichannel modulator is converted to mono; sample rate, duration, and time origin are adapted to the carrier grid. |
Second Sound preparation
- Select exactly two Sounds; XMod asks which one is the Carrier.
- The other Sound is copied/converted to mono for control use.
- Its original
xminis removed so its first sample corresponds to local time 0. - If its sample rate differs from the carrier, it is resampled to the carrier rate.
- If it is longer than the carrier, it is trimmed. If shorter, the remainder is explicitly zero-padded.
- The prepared control Sound is temporary; the original modulator Sound remains unchanged.
AM and external Gate normalize this temporary control by its absolute peak for control purposes. Ring Modulation does not.
Presets
Choosing a preset overrides the listed mode/source parameters. Safety peak, Draw visualization, and Play result remain user-controlled.
| Preset | Mode | Source | Frequency | Depth | Gate settings |
|---|---|---|---|---|---|
| Custom | User | User | User | User | User |
| Ring Mod - Metallic | Ring | Sine | 440 Hz | 1.0 | — |
| Ring Mod - Deep | Ring | Sine | 80 Hz | 1.0 | — |
| AM - Radio Style | AM | Sine | 1000 Hz | 0.8 | — |
| AM - Tremolo | AM | Sine | 6 Hz | 0.7 | — |
| Gate - Fast Stutter | Gate | Square | 10 Hz | 1.0 | Duty 0.5; A/R 2/2 ms |
| Gate - Slow Pulse | Gate | Square | 2 Hz | 1.0 | Duty 0.5; A/R 10/10 ms |
| Gate - Helicopter | Gate | Square | 12.5 Hz | 1.0 | Duty 0.5; A/R 1/1 ms |
| Sidechain-like Pump | Gate | Square | 2 Hz | 0.9 | Duty 0.3; A/R 5/80 ms |
Parameters
| Parameter | Default | Meaning |
|---|---|---|
| Preset | Custom | Custom or one of eight fixed configurations. |
| Mod type | Ring Modulation | Ring, AM, or Rhythmic Gate. |
| Mod source | Sine Oscillator | Four internal oscillators or Second Sound. |
| Mod frequency (Hz) | 10 | Oscillator frequency. If it reaches/exceeds carrier Nyquist, XMod clamps it to 95% of Nyquist. It is irrelevant to Second Sound. |
| Mod depth | 1.0 | Negative values clamp to 0. AM/Gate clamp to 0–1. Ring allows values above 1 as pure-ring gain. |
| Attack (ms) | 5 | Gate-envelope rise time constant. |
| Release (ms) | 5 | Gate-envelope fall time constant. |
| Duty cycle | 0.5 | Clamped to 0–1; used by the Square oscillator to set its +1 portion. |
| Safety peak | 0.99 | Clamped to 0–1. 0 disables protection; otherwise attenuation is applied only when the processed peak exceeds the threshold. |
| Draw visualization | On | Draws diagnostic waveforms, control signal, spectrograms, and summary. |
| Play result | On | Plays the final output after processing. |
Input & output behavior
| Property | Behavior |
|---|---|
| Oscillator input | Exactly one selected Sound. |
| Second Sound input | Exactly two selected Sounds, followed by explicit Carrier selection. |
| Carrier channels | Preserved exactly; the same mono control is applied independently to every carrier channel. |
| Carrier sample rate | Preserved. |
| Carrier duration | Preserved; XMod adds no tail. |
| Carrier start time | xmin preserved. |
| External modulator channels | Downmixed to mono for control use. |
| External modulator duration | Trimmed or zero-padded to exactly the carrier duration. |
| Output name | <carrier>_xmod_<presetName>. |
| Randomness | None. With the same inputs/settings, processing is deterministic. |
Level management
XMod does not normalize every result. After modulation it measures the output peak. If depth is greater than 0, Safety peak is enabled, and the peak exceeds the threshold, XMod attenuates the whole output to that threshold. Quieter results are never boosted.
Because the safety stage is bypassed at depth 0, all three modes can return an exact dry signal even when the dry carrier itself is above the selected safety threshold.
Visualization
When enabled, v1.2.1 uses the Praat AudioTools 8-inch page layout. The visualization is diagnostic only and does not alter the processed audio.
- Input waveform: a mono display copy of the carrier.
- Output waveform: a mono display copy of the result.
- Control panel: the first up to 0.6 seconds of the bipolar modulator. In Gate mode, the smoothed 0–1 gate envelope is overlaid.
- Spectrogram pair: input and output, displayed up to the lower of 5 kHz and Nyquist.
- Summary strip: mode, source, depth, channels, sample rate, and output/gate information.
Technical notes
Attack and release coefficients
Gate smoothing is performed sample by sample. For time constant τ and sample rate Fs, the script uses:
Separate coefficients are calculated for Attack and Release and selected according to whether the target is above or below the previous envelope value.
External control normalization differs by mode
| Mode | Use of Second Sound amplitude |
|---|---|
| Ring | Direct sample multiplication; no peak normalization of the control. |
| AM | Divided by the control Sound's absolute peak before bipolar-to-unipolar mapping. |
| Gate | Absolute value divided by the control Sound's peak, yielding a 0–1 target. |
Limits and interpretation
- Ring modulation is multiplication, not spectral frequency shifting by a fixed amount; sum/difference components arise from the multiplication itself.
- AM is amplitude modulation, not vibrato: it changes amplitude, not instantaneous pitch.
- The oscillator-driven Sidechain-like preset imitates a pumping contour; it is not a dynamics processor and does not detect another track.
- Second Sound control is aligned by sample position from the beginning, not by absolute Praat timestamps.
- The displayed processing-time value is diagnostic and should not be treated as a precision benchmark.
Further Reading
- Dutilleux, P., Holters, M., Disch, S., & Zölzer, U. (2011). “Modulators and Demodulators.” In U. Zölzer (Ed.), DAFX: Digital Audio Effects, 2nd ed. Wiley. DOI: 10.1002/9781119991298.ch3. Directly relevant to audio-frequency amplitude/ring modulation and tremolo-style effects.
- Giannoulis, D., Massberg, M., & Reiss, J. D. (2012). “Digital Dynamic Range Compressor Design—A Tutorial and Analysis.” Journal of the Audio Engineering Society, 60(6), 399–408. Relevant here for digital level/envelope detection and attack/release smoothing behavior.