Each rising edge on trigger adds Step to the count; a negative Step counts down. The count is kept between 0 and Limit: with Clamp it stops at the limit, with Wrap it returns to 0 once it passes it. A rising edge on reset returns the count to its start. The output has two lanes: lane 1 is the count divided by Limit, from 0 to 1, and lane 2 is the raw count.
The wrap outlet sends an event: it is 1 for one block whenever a step carries the count past Limit or below 0, whether Wrap brings it back to 0 or Clamp holds it at the edge, and 0 otherwise. A reset never counts as a wrap. Cable it into a trigger input, such as another Counter or Sample and hold, to do something once per lap.
Use it for scoreboards, step counters and anything that advances on events. Feed it from Compare in Trigger mode, or straight from a square Control LFO as a clock. Use lane 1 for a normalised position and lane 2 for the whole number.
Each help patch is an ordinary Toy that teaches one idea. The diagram shows the Patch; the preview shows its Frame. Open it in TuneToys to play and edit it.
1. Count a clock
beginner Teaches: limit, step, wrap
A square LFO clocks a counter with a limit, step and wrap.
Oscillator
MIDI1 lane
Audio1ch
Fundamental pitch, capped below Nyquist; detune uses cents. Range: 20–20000 Hz. Default: 220 Hz. Logarithmic scale. Units: Hz.
Hz
Output gain. Range: 0–0.5 ×. Default: 0.12 ×. Linear scale. Units: linear gain.
×
Selects the implemented algorithm. Choices are discrete and are not LFO targets. Range: 0–7. Default: 0. Linear scale. Units: unitless.
Cycle offset; Gate rising edges restart phase from this position. Range: 0–1 cycles. Default: 0 cycles. Linear scale. Units: cycles.
cycles
Pitch offset in cents. Range: -1200–1200 cents. Default: 0 cents. Linear scale. Units: cents.
cents
On or off. A rising edge retriggers; held on runs the oscillator or envelope. A control cable switches it at 0.5. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Semitones a full pitch bend on the MIDI input moves the note, up or down. Range: 0–48 st. Default: 2 st. Linear scale. Units: st.
st
Time constant of the slide from one MIDI note's pitch to the next; 0 jumps. Range: 0–2000 ms. Default: 0 ms. Linear scale. Units: ms.
ms
Control LFO
Reset1 lane
Control1 lane
Cycle1 lane
Waveform of the oscillator. The random shapes draw a new value each cycle from a generator seeded by the node path, so every host and replay agrees. Range: 0–5. Default: 0. Linear scale. Units: unitless.
Cycles per second when Beats is 0. Range: 0.01–40 Hz. Default: 1 Hz. Logarithmic scale. Units: Hz.
Hz
Beats per cycle, synced to the shared transport. 0 uses Rate instead. Range: 0–64 beats. Default: 0 beats. Linear scale. Units: beats.
beats
Peak-to-peak amount of the output swing. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Centre of the swing. Range: 0–1. Default: 0.5. Linear scale. Units: unitless.
Starting phase of the cycle, and where a Reset edge restarts it. Range: 0–1. Default: 0. Linear scale. Units: unitless.
Where the Triangle peaks, or how the Saw bends. 0.5 is the plain shape. Range: 0–1. Default: 0.5. Linear scale. Units: unitless.
Counter
Trigger1 lane
Reset1 lane
Control2 lanes
Wrap1 lane
Count value that maps to 1 on the normalised lane and where wrapping or clamping happens. Range: 1–1000. Default: 8. Linear scale. Units: unitless.
Amount added on each trigger; negative counts down. Range: -10–10. Default: 1. Linear scale. Units: unitless.
Wrap past the limit back to 0 instead of clamping. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Audio output
Audio1ch
Note
Note
Note
Patch: Oscillator audio output connected to Patch outputs audio input. Control LFO control output connected to Counter trigger input.Connections as text
Oscillator audio output connected to Patch outputs audio input
Control LFO control output connected to Counter trigger input
Each rising edge of the square LFO adds Step to the count.
Lane 1 is the count divided by Limit; lane 2 is the raw count.
Wrap returns to 0 past Limit; Clamp holds there.
Frame preview (static). Controls show their default values.
A clock steps a counter that shapes the level; every time the count wraps, the wrap outlet samples a new pitch from a slow LFO.
Oscillator
MIDI1 lane
Audio2ch
Fundamental pitch, capped below Nyquist; detune uses cents. Range: 20–20000 Hz. Default: 220 Hz. Logarithmic scale. Units: Hz.
Hz
Output gain. Range: 0–0.5 ×. Default: 0.12 ×. Linear scale. Units: linear gain.
×
Selects the implemented algorithm. Choices are discrete and are not LFO targets. Range: 0–7. Default: 0. Linear scale. Units: unitless.
Cycle offset; Gate rising edges restart phase from this position. Range: 0–1 cycles. Default: 0 cycles. Linear scale. Units: cycles.
cycles
Pitch offset in cents. Range: -1200–1200 cents. Default: 0 cents. Linear scale. Units: cents.
cents
On or off. A rising edge retriggers; held on runs the oscillator or envelope. A control cable switches it at 0.5. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Semitones a full pitch bend on the MIDI input moves the note, up or down. Range: 0–48 st. Default: 2 st. Linear scale. Units: st.
st
Time constant of the slide from one MIDI note's pitch to the next; 0 jumps. Range: 0–2000 ms. Default: 0 ms. Linear scale. Units: ms.
ms
Gain
Audio2ch
Audio2ch
Multiplies every audio channel. 0 silences the signal; 1 leaves its level unchanged. Range: 0–2 ×. Default: 1 ×. Linear scale. Units: linear gain.
×
Control LFO
Reset1 lane
Control1 lane
Cycle1 lane
Waveform of the oscillator. The random shapes draw a new value each cycle from a generator seeded by the node path, so every host and replay agrees. Range: 0–5. Default: 0. Linear scale. Units: unitless.
Cycles per second when Beats is 0. Range: 0.01–40 Hz. Default: 1 Hz. Logarithmic scale. Units: Hz.
Hz
Beats per cycle, synced to the shared transport. 0 uses Rate instead. Range: 0–64 beats. Default: 0 beats. Linear scale. Units: beats.
beats
Peak-to-peak amount of the output swing. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Centre of the swing. Range: 0–1. Default: 0.5. Linear scale. Units: unitless.
Starting phase of the cycle, and where a Reset edge restarts it. Range: 0–1. Default: 0. Linear scale. Units: unitless.
Where the Triangle peaks, or how the Saw bends. 0.5 is the plain shape. Range: 0–1. Default: 0.5. Linear scale. Units: unitless.
Counter
Trigger1 lane
Reset1 lane
Control2 lanes
Wrap1 lane
Count value that maps to 1 on the normalised lane and where wrapping or clamping happens. Range: 1–1000. Default: 4. Linear scale. Units: unitless.
Amount added on each trigger; negative counts down. Range: -10–10. Default: 1. Linear scale. Units: unitless.
Wrap past the limit back to 0 instead of clamping. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Select lanes
ControlAuto
ControlAuto
Control LFO
Reset1 lane
Control1 lane
Cycle1 lane
Waveform of the oscillator. The random shapes draw a new value each cycle from a generator seeded by the node path, so every host and replay agrees. Range: 0–5. Default: 0. Linear scale. Units: unitless.
Cycles per second when Beats is 0. Range: 0.01–40 Hz. Default: 1 Hz. Logarithmic scale. Units: Hz.
Hz
Beats per cycle, synced to the shared transport. 0 uses Rate instead. Range: 0–64 beats. Default: 0 beats. Linear scale. Units: beats.
beats
Peak-to-peak amount of the output swing. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Centre of the swing. Range: 0–1. Default: 0.5. Linear scale. Units: unitless.
Starting phase of the cycle, and where a Reset edge restarts it. Range: 0–1. Default: 0. Linear scale. Units: unitless.
Where the Triangle peaks, or how the Saw bends. 0.5 is the plain shape. Range: 0–1. Default: 0.5. Linear scale. Units: unitless.
Sample and hold
ControlAuto
Trigger1 lane
ControlAuto
Scale
ControlAuto
ControlAuto
Input value that maps to Output min. Range: -10000–10000. Default: 0. Linear scale. Units: unitless.
Input value that maps to Output max. Range: -10000–10000. Default: 1. Linear scale. Units: unitless.
Output at Input min. Range: -10000–10000. Default: 0. Linear scale. Units: unitless.
Output at Input max. Range: -10000–10000. Default: 1. Linear scale. Units: unitless.
Bend of the mapping: negative eases in, positive eases out, 0 is linear. Range: -1–1. Default: 0. Linear scale. Units: unitless.
Hold the output inside its range instead of extrapolating. Range: 0–1. Default: 1. Linear scale. Units: unitless.
Audio output
Audio2ch
Note
Note
Note
Patch: Oscillator audio output connected to Gain audio input. Gain audio output connected to Patch outputs audio input. Control LFO “clock” control output connected to Counter trigger input. Counter control output connected to Select lanes control input. Select lanes control output connected to Gain @level input. Control LFO “drift” control output connected to Sample and hold control input. Counter wrap output connected to Sample and hold trigger input. Sample and hold control output connected to Scale control input. Scale control output connected to Oscillator @frequency input.Connections as text
Oscillator audio output connected to Gain audio input
Gain audio output connected to Patch outputs audio input
Control LFO “clock” control output connected to Counter trigger input
Counter control output connected to Select lanes control input
Select lanes control output connected to Gain @level input
Control LFO “drift” control output connected to Sample and hold control input
Counter wrap output connected to Sample and hold trigger input
Sample and hold control output connected to Scale control input
Scale control output connected to Oscillator @frequency input
The square clock steps the counter four times a second.
wrap is 1 for one block when a step passes the limit (or zero); it triggers Sample and hold.
The held slow-LFO value is scaled to a pitch window and cabled into frequency.
Frame preview (static). Controls show their default values.
Compare Turn any signal into a gate or trigger by comparing it to a threshold or to another signal, lane by lane, with hysteresis and tolerance.
Sample and hold Capture the input lanes whenever the trigger lane rises and hold them until the next trigger.
Control LFO A free-running or tempo-synced low-frequency oscillator on a control lane, 0 to 1, with depth, offset, phase, skew, random shapes and a reset input.