Skip to content

Voice Architecture

Each voice in a MIDI Sketch Bach composition operates as an independent melodic line, following Baroque conventions for register, independence, and voice leading.

What is a Voice?

In Baroque music, a "voice" is an independent melodic line — whether sung by a human voice or played on an instrument. A four-voice fugue has four simultaneous melodic lines, each with its own rhythm, contour, and identity. On a keyboard instrument like the organ, a single performer plays all voices simultaneously. In MIDI Sketch Bach, each voice becomes a separate MIDI track.

Voice System Overview

Voice Types and Roles

VoiceRoleRegisterTypical Function
SopranoHighest voiceUpperCarries main melody, subject entries, cantus firmus in chorale preludes
AltoInner upper voiceMid-upperSecondary counterpoint, fills harmonic texture
TenorInner lower voiceMid-lowerSecondary counterpoint, dialogue with alto
BassLowest voiceLowerHarmonic foundation, pedal points, bass themes in passacaglia
Voice 5 (Pedal)Extended bassLowestOrgan pedal bass, separate from manual voices

Voice Allocation by Count

numVoicesVoices Used
2Soprano, Bass
3Soprano, Alto, Bass
4Soprano, Alto, Tenor, Bass
5Soprano, Alto, Tenor, Bass, Pedal

Voice Ranges

Each voice's pitch range is determined by the instrument and voice count. The engine ensures that voices occupy distinct registers to maintain clarity.

Tessatura

In vocal and instrumental music, the tessatura is the comfortable range where a voice or instrument sounds best — not the extreme limits, but the central working range. The engine keeps each voice primarily within its tessatura, using the extremes sparingly for expressive effect.

Organ Voice Ranges (Approximate)

VoiceRangeMIDI Notes
SopranoC4--C660--84
AltoG3--G555--79
TenorC3--C548--72
BassG2--G443--67
PedalC2--C436--60

Solo Instrument Ranges

InstrumentRangeMIDI Notes
ViolinG3--E755--100
CelloC2--A536--81

Ranges are adjusted when fewer voices are used, giving each voice more registral space.

Voice Independence

Maintaining the independence of each voice is a core principle of Baroque counterpoint. The engine ensures independence through three mechanisms:

Rhythmic Differentiation

Voices use different rhythmic patterns to avoid moving in lockstep:

When one voice has a sustained note, others tend to be active, and vice versa. This rhythmic complementarity is a hallmark of Bach's contrapuntal writing.

Melodic Differentiation

Each voice has its own melodic character:

  • Different intervallic profiles (some voices more stepwise, others with more leaps)
  • Different directional tendencies at any given moment
  • Each voice develops thematic material independently

Register Differentiation

Voices maintain separation in pitch space:

  • Each voice stays primarily in its assigned range
  • Voice crossing is minimized
  • When voices approach each other in register, they tend to move apart

Voice Count by Form

FormDefault VoicesValid RangeNotes
0: Fugue42--5Classic 3-4 voice fugue
1: Prelude and Fugue42--5Prelude may use fewer voices
2: Trio Sonata33Fixed: two upper + pedal bass
3: Chorale Prelude43--5Cantus firmus + accompaniment
4: Toccata and Fugue43--5Toccata may use full range
5: Passacaglia43--5Voice count may increase across variations
6: Fantasia and Fugue43--5Fantasia may use variable voicing
7: Cello Prelude32--3Implied voices on solo instrument
8: Chaconne32--4Implied voices on solo violin

Piano Roll Colors

In the demo's piano roll visualization, each voice is assigned a distinct color from the cathedral design palette:

VoiceColorHex
Soprano (Voice 1)Gold#D4A63E
Alto (Voice 2)Burgundy#6B1D2A
Tenor (Voice 3)Green#2D5A3D
Bass (Voice 4)Steel Blue#4A7C9B
Voice 5 (Pedal)Bronze#8B6914

Voice-to-Track Mapping

Each voice maps to a separate MIDI track with its own channel and program:

js
const events = generator.getEvents()

for (const track of events.tracks) {
  console.log(`Voice: ${track.name}`)      // "Soprano", "Alto", etc.
  console.log(`Channel: ${track.channel}`)  // MIDI channel (0-15)
  console.log(`Program: ${track.program}`)  // GM program number
  console.log(`Notes: ${track.note_count}`) // Number of notes
}

General MIDI Program Mapping

InstrumentGM ProgramSound
Organ19Church Organ
Harpsichord6Harpsichord
Piano0Acoustic Grand Piano
Violin40Violin
Cello42Cello
Guitar24Acoustic Guitar (Nylon)

All voices within a composition use the same instrument program by default. The MIDI output is a Type 1 Standard MIDI File with separate tracks for each voice, allowing you to reassign instruments per voice in your DAW.

Released under the Apache-2.0 License.