Polyphonic instrument

Eight owned, velocity-sensitive oscillator voices with ADSR, sustain and MPE, played from a MIDI cable in the Toy's tuning.

  • Generator
  • Since 0.2.0
  • instrument
  • voices
  • keyboard
  • adsr
  • tuning
  • microtonal
  • mpe

Open in TuneToys

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

A ready-made eight-voice instrument. It has no audio input: it makes sound when it receives notes from a Frame piano, the computer keyboard or MIDI, and sends a stereo signal out.

What it does#

Each note takes one of eight voices. A voice is an oscillator with its own attack, decay, sustain and release, so overlapping notes keep their own envelopes. The instrument responds to note velocity and to the sustain pedal. Level is shared across the voices: each voice receives one eighth of it, so playing eight notes together has fixed headroom.

It does not take an audio input or modulation cables. Effects go after it on the output cable.

Pitch and tuning#

The keys play the Toy's tuning: a preset such as 31-EDO or just intonation, or a custom table of cents. Without one the Toy plays 12-TET with A4 at 440 Hz, and note 69 is A4.

  • Equal divisions of the octave (12-TET, 19-, 22-, 24-, 31- and 53-EDO): middle C (MIDI 60) is degree 0, each key up is one step, and A4 stays at the reference on the degree three of the division's own fifths above C. In 31-EDO, C4 to C5 spans 31 keys.
  • Just, Pythagorean, Bohlen–Pierce and custom tables: MIDI 60 plus Root plays the root at its 12-TET pitch from the reference, and each key up is the next degree, repeating at the period (an octave, or a tritave for Bohlen–Pierce).

The engine maps all 128 notes once when the Toy is prepared, so a note-on only reads a table. Pitch bend is ±2 semitones, except on MPE member channels (below). The tuning is set in the Toy's source, for example "tuning": { "preset": "31-edo", "root": 0, "reference": 440 }; the Thirty-One Keys example Toy plays that one. A Tuner left on Toy tuning measures against the same degrees.

Voices and stealing#

A note takes the voice already playing that key from the same source and channel, else a silent voice, else the oldest released voice, else the oldest held one. A stolen voice crossfades to its new note over 32 samples. Each MIDI source (a Frame piano, the computer keyboard, each MIDI device) owns its own notes and sustain pedal per channel, so one source releasing a key never silences another's.

MPE#

With MPE set to Lower zone (master channel 1, members 2–16) or Upper zone (master channel 16, members 1–15), each note arrives on its own member channel. That channel's pitch bend then moves only the voice holding its note, by up to MPE bend semitones; master-channel bend still moves every voice by ±2 semitones, and the two add. Pressure and CC74 have no target in this instrument; build a polyphonic group to route them per voice. MPE configuration messages (MCM) and MIDI-CI are not handled: set the zone here to match the controller.

When to use it#

Use it when you want something playable with a few controls and no wiring: a starting point for keyboards, pads and plucks. Reach for Oscillator with an Envelope when you need a single voice you can wire and modulate yourself, and give its group voices to play chords with it.

Ports#

PortDirectionSignalLanes
midiInputMIDI16 MIDI channels
audioOutputAudioInferred from the cable

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
amplitudeLevel0 to 0.50.3linearMaster level. Each of the eight voices receives one eighth of this level for fixed headroom.
shapeShape0 to 30linearContinuous sine, triangle, saw and pulse morph using the shared wave oscillator.
attack_msAttack0 to 100005mslinearVoice attack time.
decay_msDecay0 to 10000120mslinearVoice decay time.
sustainSustain0 to 10.7%linearHeld voice envelope level. Stored as a fraction; shown ×100 as a percentage.
release_msRelease0 to 10000200mslinearVoice release after note-off or sustain release.
detuneFine tune-100 to 1000centslinearMoves every note by this many cents from the Toy's tuning, for this instrument only. 0 plays the tuning as written.
pulse_widthPulse width0.05 to 0.950.5linearPulse duty cycle.
mpeMPE0 to 20linearIn a zone, a member channel's pitch bend moves only the voice holding that channel's note; master-channel bend moves every voice. Choices: 0 Off, 1 Lower zone, 2 Upper zone.
mpe_bendMPE bend0 to 9648stlinearSemitones a full member-channel pitch bend moves its note in an MPE zone.

Level (amplitude)#

Master level of the instrument. Because each voice gets one eighth, raising it never makes a full chord clip on its own.

Shape (shape)#

A continuous morph: 0 is sine, 1 is triangle, 2 is saw and 3 is pulse. Values between blend neighboring waves.

Attack (attack_ms), Decay (decay_ms), Sustain (sustain), Release (release_ms)#

The per-voice envelope. Attack, Decay and Release are times in milliseconds. Sustain is the level, shown from 0 to 100 %, that a held key stays at after the decay. Release starts at note-off, or when the sustain pedal is let go.

Fine tune (detune)#

Moves every note of this instrument by up to 100 cents either way from the Toy's tuning; 0 plays the tuning as written. Two instruments a few cents apart thicken a sound. The tuning itself, including the A4 reference, belongs to the Toy (see Pitch and tuning).

Pulse width (pulse_width)#

The duty cycle of the pulse wave, from 0.05 to 0.95. It affects the sound near the pulse end of Shape.

MPE (mpe)#

Off treats every channel alike. Lower zone and Upper zone make channel 1 or channel 16 the master and the other fifteen member channels, one per sounding note (see MPE).

MPE bend (mpe_bend)#

How far a full pitch bend on a member channel moves its note, 0 to 96 semitones each way; 48 is the MPE default most controllers send. It applies only while MPE is on.

Tips#

  • Short Attack and Release sound plucked; long ones sound like a pad.
  • Sustain of 0 makes a note die away after the decay even while the key is held.
  • Add Reverb after the instrument for space.
  • Frame pianos and MIDI both reach the instrument. See MIDI.
  • To hear a microtonal scale, give the Toy a tuning and play neighbouring keys: each is one degree.

See also#

Oscillator, Envelope, Reverb, Tuner, Frames, Voices.

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. Play a chord with the keyboard

beginner Teaches: shape, amplitude

An eight-voice instrument with a piano and a waveform choice.

Patch: Polyphonic instrument audio output connected to Patch outputs audio input. Keyboard midi output connected to Polyphonic instrument midi input.
Connections as text
  • Polyphonic instrument audio output connected to Patch outputs audio input
  • Keyboard midi output connected to Polyphonic instrument midi input
  • Play several keys at once. Each key takes its own voice, up to eight.
  • Shape morphs from sine to triangle to saw to pulse. Level sets the whole instrument.
Frame preview: Play a chord with the keyboardFrame “Play a chord with the keyboard” with 4 elements: knob Level, text heading, piano Keys, segmented Waveform.0.3LevelPLAY A CHORD WITH THE KEYBOARDSineTriangleSawPulseWaveform
Frame preview (static). Controls show their default values.

Open in TuneToys

2. Shape the note with ADSR

intermediate Teaches: attack_ms, decay_ms, sustain, release_ms

Attack, decay, sustain and release for every voice.

Patch: Polyphonic instrument audio output connected to Patch outputs audio input. Keyboard midi output connected to Polyphonic instrument midi input.
Connections as text
  • Polyphonic instrument audio output connected to Patch outputs audio input
  • Keyboard midi output connected to Polyphonic instrument midi input
  • Raise Attack for a slow swell and Release for a note that fades after you let go.
  • Sustain is a level, not a time: it is the volume held while a key stays down.
Frame preview: Shape the note with ADSRFrame “Shape the note with ADSR” with 6 elements: knob Attack, knob Decay, text heading, piano Keys, knob Release, knob Sustain.5 msAttack120 msDecaySHAPE THE NOTE WITH ADSR200 msRelease0.7 %Sustain
Frame preview (static). Controls show their default values.

Open in TuneToys

3. Fine tune and pulse width

advanced Teaches: detune, pulse_width

Detune every voice by cents and change the pulse duty cycle.

Patch: Polyphonic instrument audio output connected to Patch outputs audio input. Keyboard midi output connected to Polyphonic instrument midi input.
Connections as text
  • Polyphonic instrument audio output connected to Patch outputs audio input
  • Keyboard midi output connected to Polyphonic instrument midi input
  • Pulse width only changes the sound while Shape is near the pulse end of its range.
  • Fine tune moves every key together by cents from the Toy's tuning. 0 plays the tuning as written.
Frame preview: Fine tune and pulse widthFrame “Fine tune and pulse width” with 5 elements: knob Fine tune, text heading, piano Keys, knob Pulse width, knob Shape.0 centsFine tuneFINE TUNE AND PULSE WIDTH0.5Pulse width3Shape
Frame preview (static). Controls show their default values.

Open in TuneToys

4. MPE zones

advanced Teaches: mpe, mpe_bend

Choose an MPE zone so each member channel's pitch bend moves only its own note, by up to MPE bend semitones.

Patch: Keyboard midi output connected to Polyphonic instrument midi input. Polyphonic instrument audio output connected to Patch outputs audio input.
Connections as text
  • Keyboard midi output connected to Polyphonic instrument midi input
  • Polyphonic instrument audio output connected to Patch outputs audio input
  • An MPE controller sends each note on its own member channel. With a zone set, that channel's bend moves only its note; channel 1 (lower) or 16 (upper) bends them all.
Frame preview: MPE zonesFrame “MPE zones” with 5 elements: text heading, knob MPE, knob MPE bend, piano Keys, knob Shape.MPE ZONES1MPE48 stMPE bend1Shape
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Oscillator Selected waveform kernels, continuous morphing, harmonic shapes and phase/gate control; an optional MIDI input plays notes in the Toy's tuning.
  • Envelope Curved AD, AR and ADSR gain envelopes with looping and explicit retrigger behavior.
  • Reverb An eight-line modulated feedback-delay network with room, hall and plate-like tunings.
  • Tuner Passes audio through unchanged and shows the nearest degree of a microtonal tuning on its face. Mute silences it like a tuner pedal.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close