Spectral Anticipation
The next note is heard before it arrives: spectral tuning turns each melodic event into a prediction, and each prediction into a lasting resonance.
The musical idea: the future becomes audible
A melodic phrase unfolds in time: a note is heard, and only later does its successor arrive. Spectral Anticipation changes this order. For each adjacent pair of usable melodic events, it takes sound material from the earlier event and uses Praat's estimate of the later event's fundamental frequency to control CDP Tune to Pitch (Hz).
The transformed material sounds before the next note arrives. With sustained-cloud presets, that spectral prediction then crossfades into a CDP Freeze of the already tuned sound. It continues as the melody moves forward, joining later predictions in an accumulating, spatially distributed cloud. After the unaltered phrase ends, the processed cloud decays slowly.
This differs from Frozen Canon. Frozen Canon sustains pitches after they have appeared in the source melody. Spectral Anticipation retunes the current event toward the following event, so its pitch relationship is predictive rather than retrospective. The two instruments share the embedded CDP Freeze infrastructure, but organize musical time differently.
How the instrument works
The entire instrument runs from one Praat script. Praat analyzes events and F0, chooses material, schedules voices, manages stereo/multichannel rendering, applies the shared decay, and draws the optional Picture. Its bundled CDP engine performs the spectral tuning and, when enabled, the sound extension. No Python is required.
Tune to Pitch (Hz)
The registry process sp_tune_1 receives Pitch = F0 of the next event, with Focus = 1 and Clarity = 1. Focus and Clarity are fixed, not preset parameters. The operation spectrally reorganizes source material toward the target; it does not simply replay the next note.
Freeze of the tuned material
The separate freeze process extends the processed excerpt with zero pitch shift and zero amplitude cut. It freezes the tuned sound, never the untreated original. In the Short Anticipation preset the entire Freeze stage is disabled.
Anticipation becomes resonance
Each successfully rendered event pair creates a voice with two phases. Phase A (anticipation) is a naturally timed excerpt of the earlier event, spectrally tuned to the next event's F0 and placed just before its arrival. Phase B (resonance) sustains the tuned material from around that arrival, allowing future-oriented voices to overlap. The original phrase remains audible during its normal duration.
One shared decay, applied only to the processed cloud
The processed voices remain at their rendered levels until the source phrase ends, then follow a common exponential curve toward approximately -60 dB by the output boundary, with a short terminal fade. The source is not lengthened or given this envelope. Its amplitude envelope is not imposed on the processed voices.
Cloud tail = T × Cloud_decay_factor
Total output duration = T × (1 + Cloud_decay_factor)
Example: T = 10 s, factor = 1.5 → 10 s melody + 15 s tail = 25 s total.
In the Short Anticipation preset, the decay factor is zero. This deliberately disables both Freeze sustain and the extended tail, so the instrument behaves like its original short-anticipation concept.
Event pairs, stable pitch, and the meaning of "next"
Praat finds candidate events from pitch jumps and voiced restarts, or accepts onset times from a selected PointProcess. The script measures a median F0 over a stable portion after each onset, rather than trusting the attack frame. Each accepted event needs enough voiced Pitch frames to support the estimate.
Pairs are formed only between adjacent original events whose pitch estimates are both reliable. If E2 has no valid F0, the script will not silently invent an E1 → E3 prediction: the missing event breaks adjacency. This detail preserves the instrument's musical proposition.
E2 (source timbre) → F0(E3) (spectral target)
E3 (source timbre) → F0(E4) (spectral target)
When there are more usable pairs than Maximum_anticipations, the script favors the largest F0 interval changes, with timing used as a small tie-breaker, and renders the retained pairs in chronological order. The source and target indices do not change when other pairs are omitted. Invalid or too-short excerpts are skipped or reported rather than silently retargeted.
Stereo and multichannel composition
Output_format is independent of the selected preset. Every voice carries both its anticipation and, if successfully generated, its sustained resonance into the chosen channel layout.
Stereo
Always returns a two-channel Sound. Earlier anticipation/resonance voices are placed toward the left, later voices toward the right, using equal-power panning across the sequence. The original mono working phrase is added identically to both channels.
Multichannel
Places one processed voice per channel until the channel limit is reached; additional voices are assigned round-robin. The original mono working phrase is present in every output channel. With 5 rendered anticipations and a channel limit of 6, the output contains 5 channels.
Multichannel routing is a set of independent output channels, not a pre-assigned surround loudspeaker geometry. Monitor the channels using suitable audio hardware or a compatible DAW. For a conventional two-speaker test, select Stereo.
Getting started
Spectral_Anticipation.praat as an independent script in plugin_AudioTools/CDP/. The script includes internal/cdp_engine.praat and uses the existing CDP_Processes.tsv, CDP_Parameters.tsv and bundled platform engine (including the Windows binaries). No separate SoundLoom or Python installation is required when the compatible embedded engine is available. Praat 6.4 or newer is required.- Select one Sound in Praat, preferably a clearly articulated monophonic phrase with at least two stable pitches. Minimum source duration: 0.35 seconds.
- Optional: select a PointProcess as well. Its points specify candidate event onsets in the Sound's own time domain. Praat still measures the F0 from the Sound itself.
- Run
Spectral_Anticipation.praat. Start with Spectral Cloud for the full anticipation-to-resonance idea, or with Short Anticipation to isolate the predictive phase. - Choose Stereo or Multichannel. Use Stereo for immediate auditioning; use Multichannel when you want independently editable voices and an identical original layer in each channel.
- Listen and inspect the Picture. A new Sound appears in Praat. With visualization enabled, the Picture shows measured events, the prediction map, sustained voice lanes, the shared decay, and the rendered waveforms.
- Compare presets with the same source. Alter event density, anticipation timing, and tail duration while keeping spectral Focus and Clarity fixed at 1.
Compositional presets
Presets control how many anticipation pairs are rendered, how early their tuned material appears, their relative processed level, the Freeze variation, and the length of the cloud. They never change Focus = 1, Clarity = 1 or the next-event pitch target. The output format is chosen separately.
| Preset | Max. anticipations | Anticipation fraction | Cloud decay factor | Processed level | Freeze randomness |
|---|---|---|---|---|---|
| Custom | 6 | 0.50 | 1.50 | 0.65 | 0.04 |
| Short Anticipation | 6 | 0.50 | 0 | 0.65 | Not used |
| Transparent Future | 4 | 0.35 | 0.80 | 0.40 | 0.02 |
| Spectral Cloud | 6 | 0.50 | 1.50 | 0.65 | 0.04 |
| Dense Foreknowledge | 10 | 0.70 | 2.00 | 0.55 | 0.06 |
| Deep Suspension | 5 | 0.80 | 2.50 | 0.60 | 0.03 |
| Sparse Prophecy | 3 | 0.40 | 1.50 | 0.65 | 0.02 |
Short Anticipation
Only the initial tuned anticipations. They end at the target-note onset; no CDP Freeze and no post-phrase tail. In Multichannel, this retains the earlier v0.1 audio behavior for the same event selection. Stereo uses the newer panning layout.
Transparent Future
Fewer voices, quieter spectral predictions, and a shorter after-resonance. The original phrase remains prominent.
Spectral Cloud
The principal balance: anticipation, CDP Freeze sustain, and a tail lasting 1.5 times the source duration.
Dense Foreknowledge
Up to ten anticipations, earlier entries, a longer tail, and more sensitive automatic event detection (0.15 s gap, 1.2-semitone jump).
Deep Suspension
Long anticipation periods and a 2.5-times-source decay tail; emphasizes lingering spectral expectations.
Sparse Prophecy
Up to three stronger transitions; automatic detection uses a 0.35 s minimum event gap and a 2.5-semitone pitch-jump threshold.
Custom
Uses the form's manual values, initially set to the default full-cloud configuration. No external preset file is required.
These values define potential voices, not guaranteed voice counts. Fewer may render when pitches are unreliable or excerpts are too short. The musical labels describe intended behavior, not the listening result of every possible recording. All presets retain the form's Original_level, selected pitch range, crossfade, and output format.
Controls and output options
| Control | Function |
|---|---|
Preset | Custom plus six named presets. Musical settings are independent of Output_format. |
Maximum_anticipations | Maximum number of adjacent event pairs processed; default 6, maximum 16. If necessary, selects the most prominent pitch changes. |
Anticipation_fraction | Fraction of the interval between neighboring onsets allocated to anticipation (0, 1]; default 0.5. The source excerpt may be shorter than the requested window. |
Pitch_floor_Hz, Pitch_ceiling_Hz | Pitch-analysis range; defaults 140 and 1500 Hz. The ceiling must exceed the floor and stay below 45% of the sample rate. |
Pitch_jump_semitones | Automatic pitch-event threshold, default 1.5 semitones. |
Min_event_gap_s | Minimum temporal separation of automatically detected events, default 0.20 s. |
Freeze_window_ms | Requested sustained-region window, default 160 ms; accepted range 40–600 ms, constrained by the tuned excerpt. |
Freeze_delay_ms | Nominal CDP Freeze iteration delay, default 45 ms; limited relative to the selected region. |
Freeze_randomness | CDP iteration-delay randomness, default 0.04; range 0–1. Pitch shift and amplitude cut stay zero. |
Crossfade_ms | Transition duration between anticipation and sustained resonance, default 60 ms; range 10–500 ms, bounded by the individual anticipation length. |
Original_level, Processed_level | Relative gains for original and processed sounds, defaults 0.85 and 0.65; both constrained to 0–1. |
Cloud_decay_factor | Post-phrase cloud tail divided by phrase duration, default 1.5; allowed 0–4. Zero disables sustain. Total output is limited to 180 s. |
Output_format | Stereo (default) or Multichannel. |
Maximum_channels | Maximum processed-cloud channels in Multichannel mode, default 6, up to 16. Excess voices are routed round-robin. |
Draw_visualization | Creates an optional measured/computed Praat Picture; enabled by default. |
Play_result | Auditions the finished Sound when supported by the output configuration; enabled by default. |
CDP settings that do not vary
Freeze (when enabled): Pitch shift = 0; Amp cut = 0; Gain = 1; reproducible per-voice seed.
Result objects
| Mode | Praat Sound suffix | Output channels |
|---|---|---|
| Stereo | _SpectralAnticipation_ST | 2 |
| Multichannel | _SpectralAnticipation_MC | Minimum of successful anticipations and Maximum_channels, up to 16 |
The renderer preserves the Sound's original time-domain start, returns a new Sound without altering the source, and applies an attenuation-only final peak guard when the result exceeds 0.95. If a CDP stage fails, the script reports an error instead of silently returning a misleading result.
Reading the compositional visualization
With Draw_visualization enabled, the script draws an approximately 8-inch Praat Picture after audio rendering. The image is a diagnostic/compositional score computed from the events and completed Sound of the current run; it does not change the audio.
Phrase and events
Original waveform, detected or supplied onsets, selected source events, and measured F0 labels.
Anticipation map
Each Ei → Ei+1 relationship, target pitch, predictive time window, and transition to resonance.
Spectral cloud lanes
One lane per rendered voice, showing anticipatory onset, sustained continuation, and stereo pan or multichannel assignment.
Shared decay
The processed-cloud envelope: flat during the phrase, followed by the configured exponential decay.
Rendered output
Waveforms measured from the finished stereo or multichannel Sound, with compact labeling for larger channel counts.
A summary strip identifies source duration, preset, successful anticipations, sustained voices, rendering format, tail duration, and related output measurements. Voice lanes show actual rendered durations; a sustain that could not be generated is not represented as a completed long resonance.
Technical and listening notes
Future-pitch mapping, not musical prediction
The script operates offline and can inspect the entire selected recording. "Anticipation" is a compositional time relationship, not a real-time model predicting an unknown future performance.
Robustness of F0
Noise, rapid ornamentation, weak fundamentals, or genuinely polyphonic input can produce rejected or inaccurate pitch estimates. PointProcess marks improve onset control but do not replace pitch measurement.
Sustaining a spectral target
CDP Freeze repeats a chosen tuned excerpt with controlled iteration variation. It is not a perfectly stationary partial-tracking oscillator; some internal movement, beating, or timbral modulation may remain.
Transition improvements in v0.2.1
The current version adds energy-and-stability-based Freeze selection, a steady-state starting offset, phase alignment, and correlation-aware crossfading. These are engineering measures rather than a guarantee of artefact-free output.