Stereo Micro ↔ Macro Time Collapser — User Guide

Detects short high-intensity events and longer stable-intensity regions, stretches the short events, compresses the stable regions, and cycles the transformed segment pool into a fixed-duration stereo composition. Left and right share the same event order but receive independent duration and pitch variation.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.1 (2026) License: MIT License Repo: GitHub
Contents:

What this does

Stereo Micro ↔ Macro Time Collapser uses a common intensity analysis to build two segment classes:

Detected bursts are duration-expanded and detected slow regions are duration-compressed. Both transformed pools are then ordered according to the selected interleave mode and cycled until the requested output duration is reached.

input → common mono Intensity analysis → burst / slow segment lists → L and R extract the same source-time regions → independent duration variation per channel → Praat duration-tier resynthesis → independent subtle varispeed pitch variation → optional per-segment normalization → shared event order → cyclic crossfade assembly → stereo merge → optional output normalization

Quick start

  1. Select exactly one Sound object of at least 0.1 seconds.
  2. Run Stereo_Micro_Macro_Time_Collapser.praat.
  3. Choose Custom or one of the six named presets.
  4. Adjust the burst and slow-texture detection criteria if needed.
  5. Set Stretch_factor, Compress_factor, Crossfade_ms and Stereo_width_percent.
  6. Choose Alternate, Probabilistic, or Timeline order.
  7. Set the target duration and maximum output duration.
  8. Choose segment and final-output normalization modes.
  9. Run. The result is named Stereo_Collapser_Output.

Analysis & synthesis sources

Common analysis contour

The selected Sound is converted to a mono analysis copy and shifted to time 0. Praat Intensity is then calculated with:

minimum pitch = 70 Hz time step = Micro_window_ms / 1000 subtract mean pressure = yes

The median of this Intensity contour provides the reference for burst detection. The same contour is also used for the slow-region criteria.

Synthesis channels

InputSynthesis source
MonoThe source is duplicated into separate L and R work copies.
StereoInput channel 1 supplies L; input channel 2 supplies R.
3+ channelsThe mono analysis uses the multichannel fold, while synthesis uses only channels 1 and 2.

Analysis and synthesis work copies are shifted to time 0. The user's original Sound is not modified.

Micro-burst detection

The burst threshold is:

burstThreshold = medianIntensity + Burst_threshold_dB_above_median

The scan advances in Micro_window_ms steps. When a sampled Intensity value exceeds the threshold, a candidate begins. It continues until one of the following occurs:

The candidate is retained only when its duration lies between Micro_burst_min_ms and Micro_burst_max_ms. Its maximum sampled Intensity is stored for the visualization.

After a candidate is evaluated, the scan resumes one analysis step after its end. Burst regions therefore do not deliberately overlap one another.

Slow-texture detection

Slow-texture detection evaluates windows of exactly Slow_min_ms. It does not extend an accepted region until stability ends.

For each candidate window:

mean = Praat Intensity mean using energy averaging variation = standardDeviation / max(1, mean) slope = abs( (Intensity_at_end - Intensity_at_start) / windowDuration )

The region is accepted when:

variation < Slow_variance_threshold AND slope < Slow_slope_threshold_dB_per_s

If rejected, the scan advances by Slow_min_ms / 4. If accepted, it advances directly to the end of that window.

Burst and slow-texture detection are performed independently. A source-time region can therefore satisfy both analyses and appear in both segment pools.

Fallback analysis

When Allow_fallback_if_insufficient_segments is enabled, fallback is triggered whenever either class contains fewer than two segments.

When fallback starts, both detected segment lists are discarded and rebuilt by the fallback procedure, even if one class had already produced several valid primary detections.

The fallback uses the 25th and 75th percentiles of the same Intensity contour:

A random candidate is kept only if its complete duration fits before the source end. Fallback slow regions do not use the primary variance/slope criteria.

If no segments of either type remain after analysis, the script exits without producing an output.

Time transformation

Each detected source region is extracted with a rectangular window from the current synthesis channel.

Bursts

channelStretch = Stretch_factor × (1 + channelJitter)

Slow textures

channelCompress = Compress_factor × (1 + channelJitter)

The selected factor is written into a Praat DurationTier and resynthesized with Get resynthesis (overlap-add). This is the main duration-changing stage.

Very short-segment guard

For every extracted segment the script derives a pitch-analysis floor from its duration:

safePitchFloor = 3 / segmentDuration + 5

If that value reaches 590 Hz or more, the Manipulation resynthesis is skipped and the segment is copied without the stretch/compress or pitch-variation stage. With the normal preset duration ranges this guard is rarely reached.

Stereo variation

Left and right use the same detected source regions and later share the same interleave order, but every channel generates its own duration jitter and pitch variation.

Duration jitter

channelJitter ~ Uniform( -Stereo_width_percent / 200, +Stereo_width_percent / 200 )

For example, Stereo_width_percent = 20 produces a multiplier range of approximately 0.90…1.10 around the configured Stretch_factor or Compress_factor.

Pitch variation

After duration resynthesis, a small independent varispeed operation is applied when Stereo_width_percent is positive:

Segment typeRandom rate factor
Micro-burst0.98…1.02
Slow texture0.99…1.01

The implementation overrides the segment sampling frequency by that factor and resamples back to the source sample rate. This changes pitch and also changes segment duration slightly.

Stereo_width_percent is a positive form field and is not internally upper-clamped. Normal presets leave it at the form value; the default is 20%.

Interleave modes

The segment order is generated once and reused for both output channels.

ModeActual ordering rule
AlternateBurst 1, Slow 1, Burst 2, Slow 2, continuing with whichever class remains after the other is exhausted.
ProbabilisticAt each pool position, attempt a 50/50 burst/slow choice. Each source segment is consumed once; if the chosen class is exhausted, the other class is used.
Timeline orderMerge both detected classes and sort them by their original source start time.

Timeline mode preserves source-time ordering of the detected events. The burst/slow duration transformations still remain different.

Assembly, crossfade & target duration

Effective target

effectiveDuration = min( Target_output_duration_s, Max_output_duration_s )

Each channel cycles repeatedly through its transformed segment pool until it reaches or exceeds this duration. The final channel is then rectangularly trimmed to the exact effective duration.

Overlap between segments

For every appended segment:

safeCrossfade = min( Crossfade_ms / 1000, 0.30 × min(currentOutputDuration, nextSegmentDuration) )

Praat Concatenate with overlap is used only when:

Otherwise the next segment is concatenated without overlap.

Channel alignment

Because L and R transformations have independent duration variation, their intermediate assembly lengths can differ. Each is independently driven to the same effective duration; a final silence-padding safeguard is available before the two channels are combined.

Normalization

Per-segment normalization

After each transformed segment is created, Segment_normalization can apply:

ModeAction
Scale peak (0.95)Target Sinc70 peak scaling to 0.95.
Scale intensityPraat Scale intensity to Segment_intensity_target_dB.
OffNo per-segment gain adjustment.

Final output normalization

After L/R are combined, Output_normalization can apply:

ModeAction
Scale peak (0.99)Target Sinc70 peak scaling to 0.99.
Scale intensityPraat Scale intensity to Output_intensity_target_dB.
OffNo final gain adjustment.
Praat Intensity values are dB SPL relative to the program's acoustic-pressure reference, not dBFS. Silent segments and silent final output skip normalization.

Presets

All named presets leave Stereo_width_percent, target/max duration, fallback, visualization, playback and both normalization sections unchanged.

PresetWindowBurst min–max / thresholdSlow min / variation / slopeStretchCompressXfadeOrder
Gentle Bloom12 ms20–150 ms / +6 dB800 ms / 0.12 / 5 dB/s0.25×20 msAlternate
Extreme Inversion10 ms15–100 ms / +10 dB500 ms / 0.20 / 8 dB/s20×0.08×8 msProbabilistic
Micro Detail Focus8 ms15–80 ms / +12 dB1000 ms / 0.10 / 4 dB/s15×0.30×5 msAlternate
Macro Drone20 ms40–200 ms / +5 dB400 ms / 0.25 / 10 dB/s0.05×25 msTimeline
Granular Chaos8 ms10–60 ms / +15 dB300 ms / 0.30 / 15 dB/s25×0.05×3 msProbabilistic
Smooth Morph25 ms50–250 ms / +4 dB1000 ms / 0.08 / 3 dB/s0.40×30 msAlternate

Parameters

ParameterDefaultRole
PresetCustomCustom plus six named analysis/transformation strategies.
Micro_window_ms15 msIntensity-analysis time step.
Micro_burst_min_ms25 msMinimum retained primary burst duration.
Micro_burst_max_ms180 msMaximum retained primary burst duration.
Burst_threshold_dB_above_median8 dBOffset added to median Intensity.
Slow_min_ms600 msExact window duration used by primary slow-texture detection.
Slow_variance_threshold0.15Upper bound for the implemented std/mean variation measure; must be ≥0.
Slow_slope_threshold_dB_per_s6Maximum endpoint Intensity slope.
Stretch_factor12Base DurationTier factor for bursts.
Compress_factor0.15Base DurationTier factor for slow regions.
Crossfade_ms15 msRequested overlap between assembled segments, subject to safety reduction.
Stereo_width_percent20Controls half-width duration jitter; positive form field with no internal upper clamp.
Interleave_modeAlternateAlternate, Probabilistic, or Timeline order.
Target_output_duration_s60 sRequested final duration before the maximum cap is applied.
Max_output_duration_s120 sHard duration cap.
Allow_fallback_if_insufficient_segmentsOnReplace both primary segment pools when either class has fewer than two detections.
Draw_visualizationOnDraw the analysis and result overview.
Play_outputOnPlay Stereo_Collapser_Output.
Segment_normalizationScale peak (0.95)Per-segment peak, Intensity, or off.
Segment_intensity_target_dB70 dBTarget used by segment Scale intensity mode.
Output_normalizationScale peak (0.99)Final stereo peak, Intensity, or off.
Output_intensity_target_dB70 dBTarget used by final Scale intensity mode.

Visualization

The v1.1 Picture view contains the following information:

  1. Title: source, preset, requested target, Stretch_factor and Compress_factor.
  2. Original waveform: the common mono analysis source.
  3. Intensity contour + segment map: slow regions in blue, bursts in orange, the primary burst threshold as a dotted line, and stored burst peaks.
  4. Original spectrogram: mono analysis source, capped at min(5 kHz, Nyquist).
  5. Result waveforms: L and R shown separately.
  6. Result spectrogram: left output channel only, with the same frequency ceiling.
  7. Average-duration chart: original burst/slow averages and estimated transformed values.
  8. Processing summary: counts, average durations, global transform factors, stereo width, crossfade, mode and target/actual duration.
  9. Legend: color and marker meanings.

Segment-map caveat when fallback is used

The colored regions always show the segment lists that are actually used for synthesis. If fallback analysis replaced the primary detections, the dotted red line still shows the primary median-plus-threshold value; fallback bursts themselves were selected using Q75 instead.

Result waveform scale

The L and R result panels each use Praat's automatic waveform range. They are therefore not a shared-amplitude-scale comparison.

Duration chart

The transformed bars are estimates:

estimated burst duration = average original burst duration × Stretch_factor estimated slow duration = average original slow duration × Compress_factor

They do not measure the final rendered segment durations and therefore do not include channel-specific jitter or the later varispeed pitch factor.

Output behavior

The event-order pool is shared by both channels. Stereo difference comes primarily from independent L/R transformations, not from unrelated sequence generation.