Sound Duplicator — User Guide
Duplicates a selected sound N times, assembles the copies into a single longer sound with crossfades at every join, and applies a shaping envelope across the full output. Four envelope types: Linear, Cosine, Triangle, Gentle arch. Optimised for speed: incremental assembly (one copy in RAM at a time) and a single vectorised Formula call for the envelope.
What this does
Sound Duplicator creates a new sound by concatenating multiple copies of the selected source, with a smooth crossfade at each join to eliminate clicks. After assembly, a global envelope (Linear, Cosine, Triangle, or Gentle arch) is applied to the entire output, shaping its overall amplitude profile.
- Incremental assembly – only one copy in RAM at a time, avoiding memory blow‑up for large N.
- Single vectorised
Formula:call for the envelope – no sample‑by‑sample loops. - Four envelope shapes with independent fade‑in, fade‑out, and peak level.
- Crossfade duration adjustable (ms).
- Presets for common effects: Stutter, Echo Decay, Swell, Tight Loop, Pulse Burst, Long Fade.
Quick start
- In Praat, select exactly one Sound object (mono or stereo).
- Run script… →
Sound_Duplicator.praat. - Choose a Preset:
- Stutter, Echo Decay, Swell, Tight Loop, Pulse Burst, Long Fade
- For custom mode (preset = Custom), adjust parameters as desired:
- Number_of_repetitions – how many copies.
- Crossfade_duration_ms – overlap length at joins.
- Envelope_type – Linear / Cosine / Triangle / Gentle arch.
- Fade_in_percent – percentage of total duration for fade‑in.
- Fade_out_percent – percentage for fade‑out.
- Peak_level_percent – maximum amplitude relative to original.
- Click OK. The script builds the duplicated sound incrementally, applies the envelope, and imports the result as
originalname_dupN_xfX_envelope.
Concatenate with overlap, which handles the details.
The envelope is applied via a single Formula: call, which is vectorised and very fast.
The 6 presets (+ Custom)
| Preset | Copies | Xfade (ms) | Envelope | Fade in/out | Description |
|---|---|---|---|---|---|
| Stutter | 8 | 10 | Linear | 0/0% | Rapid, dry repetitions. |
| Echo Decay | 5 | 80 | Linear | 0/60% | Echoes with long fade‑out. |
| Swell | 4 | 120 | Cosine | 25/25% | Smooth rise and fall. |
| Tight Loop | 6 | 200 | Linear | 0/0% | Long crossfade, seamless loop. |
| Pulse Burst | 8 | 20 | Triangle | 10/10% | Rapid, peaked bursts. |
| Long Fade | 3 | 150 | Gentle arch | 30/30% | Gentle hill‑shaped envelope. |
Envelope types
| Type | Shape | Formula (simplified) | Use case |
|---|---|---|---|
| Linear | Straight line rise and fall | rise = x/fi, fall = (total-x)/fo | Simple fades, predictable. |
| Cosine | S‑shaped (sinusoidal) fades | 0.5-0.5·cos(πx/fi) etc. | Smoothest, natural‑sounding. |
| Triangle | Rise to peak at fade‑in end, then continuous linear fall | rise: x/fi, fall: 1-(x-fi)/fallDur | Peaked, then steady decay. |
| Gentle arch | Symmetrical hill (sin²) | 0.5-0.5·cos(2πx/total) | Soft swell and decay, zero at both ends. |
The envelope is applied after concatenation and affects the entire output duration. Fade_in_percent and Fade_out_percent are percentages of the total output length. For the Triangle envelope, the fade‑in is the rise, and the fade‑out is the entire remaining length – the separate fade_out_percent is ignored (but still displayed).
Parameters & defaults
Duplication
| Parameter | Range | Default | Description |
|---|---|---|---|
| Number_of_repetitions | ≥1 | 4 | How many copies of the source to concatenate. |
Crossfade
| Parameter | Range | Default | Description |
|---|---|---|---|
| Crossfade_duration_ms | ≥0 | 50 ms | Overlap length at each join (capped at 90 % of source duration). |
Overall Envelope
| Parameter | Range | Default | Description |
|---|---|---|---|
| Envelope_type | Linear / Cosine / Triangle / Gentle arch | Linear | Shape of the global amplitude envelope. |
| Fade_in_percent | 0–100 | 10 | Percentage of total duration for fade‑in (0 = no fade). |
| Fade_out_percent | 0–100 | 15 | Percentage for fade‑out. f_in+f_out ≤100. |
| Peak_level_percent | 0–100 | 100 | Maximum amplitude relative to original (scales whole envelope). |
Output
| Parameter | Default | Description |
|---|---|---|
| Draw_visualization | yes | Show source waveform, output waveform with crossfade boundaries, envelope curve, and summary. |
| Normalize_output | yes | Scale peak to 0.99 to avoid clipping. |
| Play_result | yes | Auto‑play after processing. |
Performance notes
The script is optimised for memory and speed:
- Incremental assembly – the duplicated sound is built by repeatedly concatenating one new copy to an existing result, then freeing the copy. This keeps only two sounds in RAM at any time, regardless of N.
- Single vectorised envelope – the envelope is applied using a single
Formula:call with a complex conditional expression. Praat evaluates this for all samples in one pass – much faster than a per‑sample loop. - The envelope formula uses direct arithmetic and
cos()– no temporary sounds.
For very large N (e.g., 100 repetitions of a long sound), processing time will be dominated by the incremental concatenations (each requires rewriting the growing sound). The envelope itself remains fast.
Visualization (Praat picture)
When Draw_visualization = 1, the script draws:
- Source waveform (grey).
- Output waveform (blue) with vertical orange lines marking the crossfade boundaries between copies.
- Envelope curve – a plot of the applied envelope shape (blue line) drawn from a synthetic 500 Hz sound computed with the same envelope formula. The axes show amplitude vs. time.
- Summary panel – source name, duration, channels, sample rate; copies, crossfade, output duration; envelope type, fade percentages, peak level, normalisation status.
FAQ / troubleshooting
If the crossfade duration is too short, clicks may occur at joins. Increase Crossfade_duration_ms. Also check that the envelope is not zeroing out the signal – ensure Peak_level_percent > 0.
The script normalises the output to 0.99 peak if Normalize_output is on. If clipping persists, reduce Peak_level_percent (e.g., to 80 %).
This is by design – the Triangle envelope has a continuous fall from the peak at the end of the fade‑in all the way to zero at the end. The separate fade_out_percent parameter is not used, but still appears in the summary for consistency. To create a triangle with a separate fade‑in and fade‑out, use Linear or Cosine.
For a stereo sound at 44.1 kHz, one second is about 176 kB (44,100 × 4 bytes × 2 channels). A 10‑second sound repeated 100 times would produce a 1000‑second output – about 176 MB. The incremental assembly keeps only two copies in RAM at once, so peak memory is roughly 2 × output size / N? Actually, at the final concatenation, the result is already built; the last step adds one more copy, so memory stays at about (output size) + (one copy). This is still large for very long outputs, but far better than building all copies separately first.
The Gentle arch is 0.5 - 0.5·cos(2π·x/total), which equals sin²(π·x/total).
It starts at 0, peaks at the midpoint, and returns to 0 – ideal for a swell that decays back to silence.