theallelectricsmartgrid

Multi-Phasor Gate and trigger decision

The Multi-Phasor Gate (MultiPhasorGateInternal in private/src/MultiPhasorGate.hpp) decides, per voice, whether to emit a trigger – the gate that starts a note and drives the AHD envelope and the rest of the voice chain. The Nonagon feeds it from the Theory of Time, LameJuis, and index arp, then the Multi-Phasor Gate combines phasor-based gate timing with trigger logic so that only one condition (or the right combination) actually fires a note.


Overview


1. Inputs to the trigger logic

The Nonagon sets these before calling SetInput (in SetMultiPhasorGateInputs):


2. How m_trigs[i] and m_newTrigCanStart[i] are computed

NonagonTrigLogic::SetInput fills the Multi-Phasor Gate input for all 9 voices.

For each voice i:

Result: m_trigs[i] is true only when the chosen trigger source (pitch-changed or sub-trigger) fired, the note is not early-muted, and no lower-index voice “interrupts” it. m_newTrigCanStart[i] is true when running and not early-muted.


3. How the Multi-Phasor Gate turns that into m_trig and m_gate

MultiPhasorGateInternal::Process runs once per frame with that input.

Timing inputs (set by the Nonagon after SetInput):

A trigger is emitted when requested, allowed, and unmuted. Accepted trigger bounds capture global phase, voice cycle ratio, and global period. The gate closes when abs(globalPhase - startGlobalPhase) * capturedVoiceCycleRatio >= 0.5. Existing bounds do not adopt later topology changes. A retrigger captures fresh bounds. This 0.5 note-duration cutoff remains intentional; Theory of Time rhythm steps span complete loop cycles and do not change that cutoff or the clock frequency.

The envelope period sent in AHDControl is the captured global period divided by the captured voice cycle ratio. AHD captures that period and the source phase ratio when it receives the trigger and evaluates its own elapsed position from global phase. There is no elapsed-sample relay or circle-distance tracker.

Mute and interrupt decisions retain their existing behavior. Muted accepted requests still establish internal bounds; they do not emit an envelope trigger. Once the half-period ends, a muted voice or one that cannot start a new trigger receives release. m_anyGate reports whether any voice gate remains high.

m_gate controls note-off and the UI. Envelopes receive AHDControl (m_trig, m_release, m_phaseRatio, m_envelopePeriodSamples) rather than following the boolean gate directly.