Pitch correction

Detects the pitch of a monophonic input and pulls it to the nearest note of the Toy tuning, a scale or held MIDI notes.

  • Effect
  • Since 0.2.0
  • autotune
  • pitch
  • correction
  • tuning
  • vocal
  • scale

Open in TuneToys

Pitch correction as the Patch draws it, at default values: inlets on the left, outlets on the right.

Pitch correction listens to a single voice or instrument, finds the note it is closest to and moves it onto that note.

What it does#

The node measures the input's pitch every 5–6 ms with the YIN method, searching between Lowest note and Highest note. Steady tones are measured to well inside a cent. Silence, noise and other sounds without a clear pitch keep the last correction.

The target is the nearest note of the Toy's tuning, the same tuning its instruments play, so it follows 19-EDO, just intonation or a custom scale. In a 12-degree tuning, Scale and Key limit the targets to the notes of a scale. When notes are held on the midi input, the nearest held note is the target instead. A target changes only when another note is clearly nearer, so a voice sitting between two notes does not flutter.

Retune sets how quickly the correction reaches a new target, and Amount how much of the distance it corrects. The correction drives the same splicing shifter as the Pitch shifter, with a fixed 40 ms window. Every channel of the cable is corrected together from the pitch of all channels mixed.

The node delays everything by 20 ms, and the Patch aligns parallel paths around it. At Amount 0 it is an exact delay.

When to use it#

Use it to tighten a sung or played line, for the hard snapped effect at Retune 0, to force a melody into a scale, or with held MIDI notes to play a voice's pitch from a keyboard. It expects one note at a time; chords and drums have no single pitch to correct.

Ports#

PortDirectionSignalLanes
audioInputAudioInferred from the cable
midiInputMIDI16 MIDI channels
audioOutputAudioInferred from the cable

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
retune_msRetune0 to 50040mslinearTime the correction takes to reach a new target; 0 snaps at once.
amountAmount0 to 11linearFraction of the distance to the target that is corrected.
scaleScale0 to 60linearNotes the correction may target. Tuning allows every note of the Toy tuning; the scales apply to 12-degree tunings and allow every note otherwise. Held MIDI notes override it. Choices: 0 Tuning, 1 Major, 2 Minor, 3 Pentatonic major, 4 Pentatonic minor, 5 Blues, 6 Chromatic.
keyKey0 to 110linearTonic of the scale. Choices: 0 C, 1 C♯, 2 D, 3 D♯, 4 E, 5 F, 6 F♯, 7 G, 8 G♯, 9 A, 10 A♯, 11 B. Shown when scale is 1 or 2 or 3 or 4 or 5.
low_hzLowest note50 to 100070HzlogLowest pitch the detector looks for.
high_hzHighest note100 to 20001000HzlogHighest pitch the detector looks for.
mixMix0 to 11linearDry/wet blend. The dry signal is delayed by the same latency before blending.

Retune (retune_ms)#

The time the correction takes to cover 99% of a change in target, 0 to 500 ms. 0 snaps at once for the robotic effect; 20–60 ms is tight but smooth; 100 ms and up lets vibrato and slides through.

Amount (amount)#

How much of the distance to the target is corrected, from 0 (none) to 1 (all of it).

Scale (scale)#

The notes the correction may target. Tuning allows every note of the Toy tuning. Major, Minor, Pentatonic major, Pentatonic minor, Blues and Chromatic apply in 12-degree tunings such as 12-TET, just or Pythagorean; in other tunings they allow every note. Held MIDI notes override the scale.

Key (key)#

The tonic of the scale, C to B.

Lowest note (low_hz)#

The lowest pitch the detector looks for, 50 to 1000 Hz.

Highest note (high_hz)#

The highest pitch the detector looks for, 100 to 2000 Hz. If it is set below Lowest note, the two swap.

Mix (mix)#

The blend of the dry input and the corrected sound. The dry input is delayed by the same 20 ms so the two line up.

Tips#

  • Set Lowest note and Highest note just around the voice: a tighter range avoids octave mistakes and saves work.
  • Retune 0 with Scale set to Pentatonic minor gives the hard stepping effect.
  • Connect a Keyboard to midi and hold a chord: the voice jumps to whichever held note is nearest.
  • Change the Toy's tuning to 19-EDO and the same voice snaps to 19 notes per octave.

See also#

Pitch shifter, Harmonizer, Tuner, Keyboard, MIDI.

Help patches

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. Correct a drifting tone

beginner Teaches: retune_ms, amount, mix

A sine that slides between G♯4 and B4, pulled onto the nearest notes.

Patch: Control LFO control output connected to Scale control input. Scale control output connected to Oscillator @frequency input. Oscillator audio output connected to Pitch correction audio input. Pitch correction audio output connected to Patch outputs audio input.
Connections as text
  • Control LFO control output connected to Scale control input
  • Scale control output connected to Oscillator @frequency input
  • Oscillator audio output connected to Pitch correction audio input
  • Pitch correction audio output connected to Patch outputs audio input
  • The LFO slowly slides the sine between G♯4 and B4, so there is something to correct.
  • Retune 0 jumps from note to note. Slower settings glide between notes; 100 ms and up sounds natural.
  • Amount below 1 corrects only part of the way. Mix 0.5 plays the original and the corrected tone together.
Frame preview: Correct a drifting toneFrame “Correct a drifting tone” with 4 elements: knob Amount, text heading, knob Mix, knob Retune.1AmountCORRECT A DRIFTING TONE1Mix40 msRetune
Frame preview (static). Controls show their default values.

Open in TuneToys

2. Snap to a scale

intermediate Teaches: scale, key, low_hz, high_hz

A saw sweeping an octave lands only on the notes of the chosen scale.

Patch: Control LFO control output connected to Scale control input. Scale control output connected to Oscillator @frequency input. Oscillator audio output connected to Pitch correction audio input. Pitch correction audio output connected to Patch outputs audio input.
Connections as text
  • Control LFO control output connected to Scale control input
  • Scale control output connected to Oscillator @frequency input
  • Oscillator audio output connected to Pitch correction audio input
  • Pitch correction audio output connected to Patch outputs audio input
  • A triangle LFO sweeps the saw from A3 to A4 and back over 20 seconds.
  • Major in C plays a C major scale as the sweep passes; Pentatonic minor or Blues leave out more notes. Tuning allows every note of the Toy tuning.
  • Lowest note and Highest note bound the detector. Keep them around the sound to avoid octave mistakes.
Frame preview: Snap to a scaleFrame “Snap to a scale” with 5 elements: text heading, knob Highest note, segmented Key, knob Lowest note, segmented Scale.SNAP TO A SCALE600 HzHighest noteCC♯DD♯EFF♯GG♯AA♯BKey100 HzLowest noteTuningMajorMinorPentatoni…Pentatoni…BluesChromaticScale
Frame preview (static). Controls show their default values.

Open in TuneToys

3. Follow held notes

advanced Teaches: midi, retune_ms

Held keys become the only targets; release them to return to the Toy tuning.

Patch: Control LFO control output connected to Scale control input. Scale control output connected to Oscillator @frequency input. Oscillator audio output connected to Pitch correction audio input. Keyboard midi output connected to Pitch correction midi input. Pitch correction audio output connected to Patch outputs audio input.
Connections as text
  • Control LFO control output connected to Scale control input
  • Scale control output connected to Oscillator @frequency input
  • Oscillator audio output connected to Pitch correction audio input
  • Keyboard midi output connected to Pitch correction midi input
  • Pitch correction audio output connected to Patch outputs audio input
  • The saw drifts between B3 and F♯4.
  • Hold a chord on the keys: the tone jumps to whichever held note is nearest. Release every key to fall back to the nearest note of the Toy tuning.
Frame preview: Follow held notesFrame “Follow held notes” with 3 elements: text heading, piano Keys, knob Retune.FOLLOW HELD NOTES60 msRetune
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Pitch shifter Shifts audio up or down by up to two octaves with a splicing delay line, with fine cents, feedback and a dry/wet mix.
  • Harmonizer Adds up to three pitch-shifted voices to the input, each with its own interval, level and pan.
  • Tuner Passes audio through unchanged and shows the nearest degree of a microtonal tuning on its face. Mute silences it like a tuner pedal.
  • Keyboard Notes from the on-screen piano and computer typing become MIDI. The face of the piano widget.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close