By Tania Alwan
Search for a vocal range chart and you get colourful images of overlapping bars: soprano up here, bass down there, a piano keyboard underneath. They are handy, but they hide the maths that makes them work. Every bar is just two note names, and every note name maps to a number and a frequency.
In this post we build a vocal range chart from scratch in Python with no dependencies: convert note names such as C4 into MIDI numbers and hertz, draw the six classic operatic voice types as a text chart, and then compare a singer's comfortable range against each type. Along the way, we will see why a chart like this is a starting point and not a verdict.
What a vocal range chart actually shows
A vocal range chart plots the span of pitches associated with each voice type. Wikipedia's Vocal range article lists approximate operatic ranges for six basic types:
- Soprano: C4 to G6
- Mezzo-soprano: A3 to G5
- Contralto: F3 to C5
- Tenor: D3 to A4
- Baritone: B2 to F4
- Bass: G2 to C4
The same article stresses that these ranges "are approximations and are not meant to be too rigidly applied", and that voice teachers usually care more about tessitura (where the voice is comfortable) and timbre than about the extreme notes. Keep that in mind: our code will happily produce precise numbers from imprecise categories.
Note names, MIDI numbers and frequencies
The chart uses scientific pitch notation: a letter, an optional sharp, and an octave number. Middle C is C4, and the A above it is A4, the 440 Hz tuning reference.
To do maths with notes, it helps to convert them to MIDI note numbers, where every semitone is one step. A4 is 69 and middle C is 60. From there, twelve-tone equal temperament gives the frequency: each semitone multiplies the frequency by the twelfth root of two, so an octave doubles it. Wikipedia's Piano key frequencies page gives the formula and a full reference table, which is useful for checking our output.
In code:
NOTE_INDEX = {"C": 0, "C#": 1, "D": 2, "D#": 3, "E": 4, "F": 5,
"F#": 6, "G": 7, "G#": 8, "A": 9, "A#": 10, "B": 11}
def note_to_midi(note):
"""'A4' -> 69, 'C#3' -> 49 (scientific pitch notation)."""
name, octave = note[:-1], int(note[-1])
return 12 * (octave + 1) + NOTE_INDEX[name]
def midi_to_hz(m, a4=440.0):
return a4 * 2 ** ((m - 69) / 12)
The octave + 1 term is there because MIDI note 0 is C-1, one octave below C0. The function only handles single-digit octaves and sharps, which is all a vocal range chart needs.
Building the vocal range chart
Here is the full script. It prints a table of each voice type's limits in hertz and semitones, then draws a text-mode chart with one column per semitone.
NOTE_INDEX = {"C": 0, "C#": 1, "D": 2, "D#": 3, "E": 4, "F": 5,
"F#": 6, "G": 7, "G#": 8, "A": 9, "A#": 10, "B": 11}
NAMES = list(NOTE_INDEX)
def note_to_midi(note):
"""'A4' -> 69, 'C#3' -> 49 (scientific pitch notation)."""
name, octave = note[:-1], int(note[-1])
return 12 * (octave + 1) + NOTE_INDEX[name]
def midi_to_hz(m, a4=440.0):
return a4 * 2 ** ((m - 69) / 12)
def midi_to_note(m):
return f"{NAMES[m % 12]}{m // 12 - 1}"
# Approximate operatic ranges (Wikipedia, "Vocal range")
VOICE_TYPES = {
"Soprano": ("C4", "G6"),
"Mezzo-soprano": ("A3", "G5"),
"Contralto": ("F3", "C5"),
"Tenor": ("D3", "A4"),
"Baritone": ("B2", "F4"),
"Bass": ("G2", "C4"),
}
lo_all = min(note_to_midi(lo) for lo, _ in VOICE_TYPES.values())
hi_all = max(note_to_midi(hi) for _, hi in VOICE_TYPES.values())
print(f"{'voice':<14}{'low':>5}{'Hz':>9}{'high':>6}{'Hz':>9}{'semitones':>11}")
for voice, (lo, hi) in VOICE_TYPES.items():
a, b = note_to_midi(lo), note_to_midi(hi)
print(f"{voice:<14}{lo:>5}{midi_to_hz(a):>9.1f}{hi:>6}{midi_to_hz(b):>9.1f}{b - a:>11}")
print()
# ASCII chart: one column per semitone, '|' marks every C
axis = "".join("|" if m % 12 == 0 else "." for m in range(lo_all, hi_all + 1))
print(f"{'':<14}{axis} ({midi_to_note(lo_all)} to {midi_to_note(hi_all)}, '|' = C)")
for voice, (lo, hi) in VOICE_TYPES.items():
a, b = note_to_midi(lo), note_to_midi(hi)
row = "".join("#" if a <= m <= b else " " for m in range(lo_all, hi_all + 1))
print(f"{voice:<14}{row}")
def overlap(my_lo, my_hi):
a, b = note_to_midi(my_lo), note_to_midi(my_hi)
out = []
for voice, (lo, hi) in VOICE_TYPES.items():
va, vb = note_to_midi(lo), note_to_midi(hi)
shared = max(0, min(b, vb) - max(a, va) + 1)
out.append((shared / (vb - va + 1), voice))
return sorted(out, reverse=True)
print("\nComfortable range A2-E4, share of each chart range covered:")
for share, voice in overlap("A2", "E4"):
print(f" {voice:<14}{share:6.0%}")
Running it with Python 3 prints:
voice low Hz high Hz semitones
Soprano C4 261.6 G6 1568.0 31
Mezzo-soprano A3 220.0 G5 784.0 22
Contralto F3 174.6 C5 523.3 19
Tenor D3 146.8 A4 440.0 19
Baritone B2 123.5 F4 349.2 18
Bass G2 98.0 C4 261.6 17
.....|...........|...........|...........|....... (G2 to G6, '|' = C)
Soprano ################################
Mezzo-soprano #######################
Contralto ####################
Tenor ####################
Baritone ###################
Bass ##################
Comfortable range A2-E4, share of each chart range covered:
Baritone 95%
Bass 89%
Tenor 75%
Contralto 60%
Mezzo-soprano 35%
Soprano 16%
The frequencies match the reference table on the piano key frequencies page (middle C at 261.6 Hz, A4 at exactly 440 Hz, G6 at about 1568 Hz), which is a quick sanity check that the conversion is right.
Reading the output
A few things stand out:
- Heavy overlap. Neighbouring voice types share most of their notes. Tenor and baritone overlap from D3 to F4 in this chart. That is why range alone is a weak classifier.
- Spans differ. The soprano bar covers 31 semitones, more than two and a half octaves, while bass covers 17 in this particular list. Those spans come from the source ranges, not from any law of nature; another reference could draw them differently.
- The overlap score is crude. A comfortable range of A2 to E4 covers 95% of the baritone bar and 89% of the bass bar. The script cannot tell you which one the singer is, and a teacher would listen for weight, timbre and where the voice feels most at home before deciding.
Ideas to extend it
If you want to take the vocal range chart further:
-
Measure your own range. Record slow sirens or scales, run a pitch tracker such as librosa's
pyin, and convert the lowest and highest steady pitches to note names with the functions above. - Add tessitura. Store a comfortable sub-range per singer and draw it with a different character, which tells you more than the extremes do.
- Check songs against a range. Convert a melody's lowest and highest notes, then compute how many semitones you would need to transpose it to fit.
- Plot it properly. Swap the text chart for matplotlib horizontal bars if you need an image.
That last idea is where range charts become practical. If a song sits outside your range, you can transpose it, or, if you are a songwriter demoing a part written for a different voice type, try it with an AI singer voice model, such as those in the Voicestars singer voice library, or with a session singer on a platform like SoundBetter. Either way, the chart tells you where the notes need to land.
Copy the script, change the overlap("A2", "E4") call to your own lowest and highest comfortable notes, and see where you land on the chart.
Disclosure: this article was written in partnership with Voicestars.
Top comments (0)