In-Place Paulstretch Slicer — Multi-channel
Extracts random source slices, turns each into a phase-randomized Paulstretch texture, places the stretched material back around its original temporal midpoint, and mixes the wet slices into a dry multichannel layout.
What this does
In-Place Paulstretch Slicer creates a hybrid dry/wet texture from randomly selected moments of a Sound. The dry signal keeps its original channel layout. The wet path is derived from a mono fold of the source, and each stretched slice is routed to one output channel in round-robin order.
- Choose a random slice duration and random source position.
- Extract that slice with a rectangular window.
- Apply phase-randomized FFT overlap-add time stretching.
- Apply explicit raised-cosine fade-in and fade-out to the stretched slice.
- Place the result around the source slice's original midpoint when possible.
- Route successive wet slices round-robin across the output channels.
- Mix the wet field with the untouched zero-based dry channels.
What “in-place” means
For a selected source slice from sliceStart to sliceEnd:
The normal case therefore expands the slice around its original midpoint. It is not an edit that replaces only the original slice span, and it does not force the final Sound to keep the source duration.
Paulstretch stage
Effective FFT window
Window_size_s is a request. The script converts it to samples and rounds up to the next power of two:
The effective window must contain at least four samples. When rounding changes the requested duration by more than 0.5 ms, the actual value is reported in the Info window.
Analysis and synthesis hops
A factor above 1 expands time; a factor below 1 contracts it. The script accepts any positive stretch factor.
Frame processing
Every analysis frame is Hann-windowed, transformed to a Spectrum, and assigned independent random phases while retaining the frame's original spectral magnitudes. DC and the final spectral bin are left unchanged. The modified spectrum is converted back to Sound, multiplied by another Hann window, and overlap-added into the stretched buffer.
Boundary frames are zero-padded to the complete FFT window. The output overlap-add also accumulates a synthesis-window normalization buffer; after all frames have been added, the audio accumulator is divided by that buffer wherever it is non-zero. This prevents the overlap percentage from acting as an unintended gain control.
source slice duration × Stretch_factor.
What “Paulstretch” means here
The implementation uses the characteristic Paulstretch idea of very slow frame progression combined with spectral phase randomization and overlap-add. It is an offline spectral time-stretch process; it is not Praat PSOLA and does not use a DurationTier.
Quick start
- Select exactly one Sound object.
- Run
In-Place_Paulstretch_Slicer__Multi-channel.praat. - Choose Custom or one of the five named presets.
- For Custom, set the number and duration range of the slices, stretch factor, FFT-window request, overlap, fades, and dry/wet mix.
- Run the script. Random slices are processed independently and the result is created as
<source>_PSslice_<preset>.
Presets
| Preset | Slices | Source duration | Stretch | Window request | Overlap | Fade in/out | Wet |
|---|---|---|---|---|---|---|---|
| Subtle Shimmer | 3 | 0.15–0.40 s | 3× | 0.20 s | 60% | 0.08 / 0.15 s | 30% |
| Frozen Texture | 5 | 0.20–0.60 s | 6× | 0.30 s | 50% | 0.10 / 0.20 s | 50% |
| Extreme Stretch | 3 | 0.30–0.80 s | 10× | 0.40 s | 70% | 0.15 / 0.30 s | 60% |
| Glitch Clouds | 8 | 0.05–0.20 s | 4× | 0.15 s | 40% | 0.02 / 0.05 s | 70% |
| Ambient Wash | 4 | 0.40–1.00 s | 8× | 0.35 s | 65% | 0.20 / 0.40 s | 40% |
| Custom defaults | 4 | 0.10–0.50 s | 4× | 0.25 s | 50% | 0.05 / 0.10 s | 50% |
Named presets overwrite all synthesis and mix controls in the table. Draw_visualization and Play_result remain user-controlled.
Channel routing
Mono source
A mono source produces a two-channel result. The dry mono signal is copied equally to L and R. Wet slices alternate round-robin:
Stereo or multichannel source
The output channel count equals the source channel count. The dry path preserves channel 1, channel 2, … in place. Wet slices are mono and cycle through those existing channels:
For example, with four source channels, slices route 1→Ch1, 2→Ch2, 3→Ch3, 4→Ch4, 5→Ch1, and so on.
Random extraction & wet placement
Source selection
All wet slices are extracted from the mono source copy. The input time domain is first shifted to start at 0, so non-zero Praat source times do not alter the random-position or placement arithmetic.
Explicit slice fades
Source extraction itself is rectangular. After Paulstretch, the script applies raised-cosine edge fades:
This prevents an over-long requested fade from consuming more than half of the stretched slice. Setting a fade to 0 disables that edge fade.
Overlapping wet slices
Each stretched slice is added into its assigned wet channel. Slices assigned to the same channel can overlap in time, in which case their samples sum.
Dry/wet mix & level handling
Mix law
Dry_wet_mix is clamped to 0–1:
For a mono source, the same dry mono channel is used for both output channels. For a multichannel source, each dry channel remains on its corresponding output channel.
Safety ceilings, not normalization
Each stretched slice is attenuated only if its Sinc70 peak exceeds 0.95. After the full dry/wet mix is built, the complete output receives the same downward-only safety check:
Quiet slices and quiet mixes are not boosted. There is no per-channel wet normalization and no target normalization to 0.99.
Parameters & limits
| Parameter | Custom default | Behavior / validation |
|---|---|---|
| Preset | Custom | Custom plus five named presets. |
| Number_of_slices | 4 | 1–256 random wet slices. |
| Min_duration_s | 0.1 | Must be positive and ≤ Max_duration_s. |
| Max_duration_s | 0.5 | Must be positive and may not exceed the source duration. |
| Stretch_factor | 4.0 | Any value > 0. Above 1 expands; below 1 contracts. |
| Window_size_s | 0.25 | Requested Paulstretch FFT window; internally rounded upward to a power-of-two number of samples. |
| Overlap_percent | 50 | 0 ≤ overlap < 100. Affects the Paulstretch OLA hop, not overlap between source slices. |
| Fade_in_s | 0.05 | Non-negative; effective value capped at half the stretched-slice duration. |
| Fade_out_s | 0.10 | Non-negative; effective value capped at half the stretched-slice duration. |
| Dry_wet_mix | 0.5 | Silently clamped to 0–1. |
| Draw_visualization | On | Draw the slice map, process explanation, source regions, all output channels and summary. |
| Play_result | On | Play the finished Sound. |
Visualization
The v0.6 Picture output shows the actual multichannel structure:
- Slice map: light rectangles = source spans; darker rectangles = stretched placements. A vertical line marks the original source midpoint. Slice color identifies its routed wet channel.
- Process panel: Pick → Stretch → Place back → Route wet → Mix.
- Source: mono display copy with selected source regions highlighted. This is for display only; the dry rendering remains multichannel.
- Output: one waveform lane for every output channel, not only L/R. The same channel color used in the slice map is reused for that lane.
- Summary: preset, slice count/range, stretch, effective FFT window, overlap, dry/wet ratio, channel transformation, duration and final peak.
Source and all output lanes share one amplitude scale. For more than eight output channels, the channel palette repeats after channel 8.
Output behavior
Duration
The script initially allocates conservative workspace, but the delivered result is trimmed to:
The output therefore never becomes shorter than the dry source, but it can extend beyond it when a stretched slice rings past the original end.
Channels
- Mono input → stereo output.
- 2+ channel input → same number of output channels as input.
Naming
The original Sound remains unchanged. Temporary source, wet, frame, spectrum, matrix and visualization objects are removed after use.