Make sound, math & scales intuitive From ancient traditions to your own creations
Click any line/label to play • Spacebar to stop
Ask a Question
Layer 0: Hz Grid
Min: 20 HzMax: 10k Hz
Zoom:1.0x
Orientation:
Physical frequency grid (20 Hz intervals)
▼Dive Deeper: Hz & Frequencies
What is Frequency (Hz)?
For 5th graders: Frequency is how many times something vibrates per second. Like when you pluck a guitar string, it moves back and forth really fast. More vibrations per second = higher pitch!
For scientists: Frequency (f) is measured in Hertz (Hz), where 1 Hz = 1 cycle per second. Human hearing range: ~20 Hz to 20,000 Hz.
Musical Note Examples
Middle C (C4) = 261.63 Hz This means the string vibrates 261.63 times every second!
Hz is the universal language of sound! Whether you're in China, Nigeria, or Brazil, 440 Hz always sounds the same. It's physics, not culture. This lets musicians from different traditions tune together.
Historical note: Before Hz, people used vague terms like "high" or "low." German physicist Heinrich Hertz gave us this precise measurement in the 1880s!
For 5th graders: Imagine cutting a pizza into 12 exactly equal slices. 12-TET cuts each octave into 12 equal musical steps. This is how pianos are tuned!
For scientists: 12-TET divides the octave (2:1 frequency ratio) into 12 logarithmically equal parts called semitones. Each semitone = 2112 ≈ 1.05946.
MIDI Note to Frequency Formula
Every note has a MIDI number. A4 = 69 (the reference).
Baroque (415 Hz): -99.3 cents from 440 Hz
Classical (432 Hz): -31.8 cents from 440 Hz
Modern (440 Hz): Standard reference
High (443 Hz): +11.8 cents from 440 Hz
Cents difference = 1200 × log2(new_freq)440
Example: 432 vs 440
= 1200 × log2432440 = -31.8¢
Why A4 = 440 Hz?
It's actually arbitrary! The ISO standard (1955) chose 440 Hz, but historically, orchestras used 415 Hz (Baroque), 432 Hz (Classical), or even 443 Hz (modern European).
Fun fact: Some believe 432 Hz has "healing properties," but scientifically, it's just -31.8 cents from 440 Hz. The important thing is that everyone tunes to the same reference!
Layer 2: Tuning System
Offset:0¢
Reference Pitch Class = origin for calculating tuning system intervals | Offset = microtonal adjustment (±100¢)
(R marker indicates reference pitch class / degree 0 lines on the grid)
▼Under the Hood: Tuning Systems
What are Cents?
For 5th graders: Cents are like measuring sticks for musical distances! Just like you measure height in inches, we measure pitch differences in cents. 100 cents = 1 piano key step (semitone).
For scientists: A cent is 1/100th of a semitone, or 1/1200th of an octave. It's a logarithmic unit that makes interval calculations additive rather than multiplicative.
Ratios multiply, cents add! This makes calculations easier:
With ratios: Fifth (3/2) + Fourth (4/3) = 3/2 × 4/3 = 2/1 (octave) → multiplication is hard
With cents: 701.955¢ + 498.045¢ = 1200¢ (octave) → addition is easy!
Historical context: Alexander Ellis invented cents in 1885 to compare tuning systems worldwide. Before that, every culture had different ways to describe intervals. Now we have a universal measurement!
Why logarithmic? Human hearing is logarithmic! We perceive equal ratios as equal distances. From 100→200 Hz sounds the same as 1000→2000 Hz (both octaves). Cents capture this.
Layer 3: Scale Pattern
Scale pattern (degrees from Layer 2) - drawn from anchor
Custom Scale - Select Degrees:
▼Explore the Math: Scales & Patterns
What is a Scale Pattern?
For 5th graders: A scale pattern is like choosing which rungs to climb on a ladder! Not all rungs—just the special ones that sound good together. Like picking 1st, 3rd, 5th, 6th, and 8th rungs = Major Pentatonic!
For scientists: A scale is a subset of pitches selected from the tuning system (Layer 2). Scales are defined by degree numbers, not absolute frequencies.
Current Settings: Major Pentatonic in 12-EDO
Major Pentatonic uses degrees: [0, 2, 4, 7, 9] from the 12-EDO system
The SAME Major Pentatonic pattern [0, 3, 6, 11, 15] sounds different in 19-EDO:
19-EDO step size = 1200¢19 = 63.16¢ per step
Degree 0: 0 × 63.16¢ = 0¢
Degree 3: 3 × 63.16¢ = 189.5¢ (closer to whole tone)
Degree 6: 6 × 63.16¢ = 379.0¢ (purer major third!)
Degree 11: 11 × 63.16¢ = 694.7¢ (closer to just fifth)
Degree 15: 15 × 63.16¢ = 947.4¢
19-EDO is famous for better major thirds!
Why Separate Pattern from Tuning?
This is the MAML Tuner philosophy! By separating the scale PATTERN (which notes) from the TUNING (exact frequencies), we can explore the same musical ideas across different cultures:
• Vietnamese đàn tranh uses pentatonic patterns but different tunings
• Turkish music uses familiar patterns but in 17-EDO or 53-EDO
• Jazz musicians use altered scales that work in 12-EDO
This lets us find common ground between traditions while respecting their uniqueness!
Layer 4: Mode Rotation
Select which scale degree becomes the tonal center (home)
Mode pitches and frequencies:
▼Modal Magic: How Rotation Works
What is Modal Rotation?
For 5th graders: Imagine climbing a ladder. You can start from any rung and still climb the same pattern! Modal rotation is like starting a scale from a different note while keeping the same steps between notes.
For scientists: Modal rotation is a cyclic permutation of a scale's interval structure. By choosing different scale degrees as the tonal center, we create modes with distinct emotional characters despite using the same pitch collection.
Greek Modes from the Major Scale
The 7 modes of the major scale (Ionian, Dorian, Phrygian, Lydian, Mixolydian, Aeolian, Locrian) are created by starting on different degrees:
C Major scale degrees: [0, 2, 4, 5, 7, 9, 11]
Mode 1 (Ionian): Start on C
Pattern: W-W-H-W-W-W-H (Major scale)
Intervals: 0→2→4→5→7→9→11
Mode 2 (Dorian): Start on D
Pattern: W-H-W-W-W-H-W (Minor with raised 6th)
Intervals: 2→4→5→7→9→11→0 (rotated by 1)
Mode 3 (Phrygian): Start on E
Pattern: H-W-W-W-H-W-W (Minor with flat 2nd)
Intervals: 4→5→7→9→11→0→2 (rotated by 2)
W = Whole step (2 semitones), H = Half step (1 semitone)
Even though modes use the exact same pitches, they sound different because:
• Tonal center matters: Starting on C vs D changes which note feels like "home"
• Interval relationships: The pattern of intervals from the root changes
• Emotional character: Dorian sounds jazzy, Phrygian sounds Spanish/exotic, Lydian sounds dreamy
Example: C Ionian (C-D-E-F-G-A-B) sounds happy/bright. D Dorian (D-E-F-G-A-B-C) uses the same notes but sounds more contemplative because D is the center and the intervals from D are different (has minor 3rd but major 6th).
Layer 5: Target Scales/Multiple Target Pitches
Select multiple target pitches to visualize on the grid (can be more than one).
Preset frequency collection:
--
No pitches detected yet. Play your instrument...
Auto-detects and shows matching scales as you type
Enter any frequencies to visualize as custom target pitches.
▼Behind the Scenes: Target Selection
What are Target Pitches?
For 5th graders: Target pitches are the specific notes you want to focus on! Like choosing which crayons to use from a big box. You can pick notes from a scale, use an instrument's strings, or even detect what you're playing!
For scientists: Layer 5 maps abstract modal pitches (Layer 4) to concrete frequency targets for visualization or tuning. Three modes: Forward (subset selection), Preset (instrument templates), and Analyze (real-time detection).
Forward Mode: Building a Melody
Choose specific scale notes to highlight. Example: From C Major Pentatonic mode, select notes 1, 3, 5 to create a chord:
Full scale: C4, D4, E4, G4, A4 (262, 294, 330, 392, 440 Hz)
Select: Notes 1, 3, 5
Result: C4, E4, A4 (262, 330, 440 Hz)
This creates a C Major add6 chord!
Lowest note: C4 (MIDI 60)
Total notes: 3
Octaves to show: Specify how many octaves up from lowest
Preset Mode: Real Instruments
Use frequencies of real instruments. Example: Guitar in standard tuning:
Detect what pitches are currently playing via microphone. Uses pitch detection algorithms to identify fundamental frequencies and display them on the grid in real-time.
Why Three Modes?
Different musical tasks need different approaches:
¢Forward Mode: Theory-first. Start with a scale, pick which notes to emphasize. Great for composition and learning chord voicings.
¢Preset Mode: Instrument-first. Match your actual instrument's tuning. Perfect for practicing or comparing equal temperament vs just intonation.
¢Analyze Mode: Performance-first. See what you're actually playing. Ideal for checking tuning accuracy or transcribing melodies.
The MAML philosophy: theory (scales), practice (instruments), and performance (detection) should all connect!
Layer 6: Audio Detection
¢¢ No target pitches selected in Layer 5. Please select target pitches above to see them on the grid for comparison.
Detected:----
Real-time pitch detection using YIN algorithm
¢Geek Out: Pitch Detection Algorithm
How Does Pitch Detection Work?
For 5th graders: Your device's microphone listens to sound waves. The computer counts how many times per second the wave repeats (the frequency), then tells you which musical note that is!
For scientists: Pitch detection algorithms analyze the periodicity of audio signals. This app uses the YIN algorithm, which estimates the fundamental frequency by finding the best autocorrelation match in the time domain.
The YIN Algorithm
YIN (2002, de Cheveigné & Kawahara) is one of the most accurate pitch detection algorithms:
Step 1: Calculate difference function
d(¢) = Σ[x(t) ¢x(t + ¢)]²
Measures how different the signal is from itself delayed by ¢
Step 2: Cumulative mean normalized difference
d'(¢) = d(¢)1¢ Σd(k)
Step 3: Find first minimum below threshold
Period π where d'(π) < threshold
Step 4: Convert period to frequency
frequency = sample_rateπ
YIN is more robust than autocorrelation alone because the normalization step reduces octave errors
From Frequency to Note Name
Once we detect a frequency (e.g., 265 Hz), we find the closest 12-TET note:
Real-world sounds are messy compared to pure sine waves:
¢Harmonics: Musical instruments produce overtones (2×, 3×, 4× the fundamental frequency). The algorithm must identify the true fundamental, not an overtone.
¢Noise: Background sounds, room acoustics, and microphone quality affect accuracy.
¢Attack transients: The initial "thwack" of a guitar string is noisy and momentarily pitchless.
¢Vibrato: Singers and string players constantly vary pitch by a few Hz.
YIN handles these challenges better than simple autocorrelation by using normalized differences and threshold-based period selection. Still, very low notes (<80 Hz) and very high notes (>4000 Hz) are harder to detect accurately!
Layer 7: Single Target Pitch for Tuning
TARGET PITCH
--
-- Hz
CURRENT PITCH
--
-- Hz
--
Select one target pitch at a time for tuning. Box turns green when your pitch matches the target!
¢Tuning Secrets: Tolerance & Perception
What is Tuning Tolerance?
For 5th graders: Imagine trying to hit a bullseye with an arrow. Being "in tune" means your arrow lands close enough to the center¢within a small circle around the target. That circle is your tuning tolerance!
For scientists: Tuning tolerance defines an acceptable frequency deviation from the target pitch, measured in cents. Professional musicians typically tune within ¢2-5 cents, while amateur musicians may be content with ¢10 cents.
Calculating "In Tune" Status
Example: Target is E2 (82.41 Hz), detected pitch is 83.1 Hz, tolerance is ¢2 cents:
Target frequency: 82.41 Hz (E2)
Current frequency: 83.1 Hz
Tolerance: ¢2 cents
Step 1: Calculate cent difference
cents = 1200 × log283.182.41
= 1200 × log2(1.00837)
= 1200 × 0.01203
= +14.4 cents
Step 2: Compare to tolerance
|14.4| > 2 cents ¢OUT OF TUNE (too sharp)
Display: E2 +14¢(red border)
If within ¢2¢: Box turns GREEN If outside: Box stays RED or ORANGE
Just Noticeable Difference (JND)
Human pitch perception has limits:
Average person: Can hear ~5-10 cent differences
Trained musicians: Can hear ~3-5 cent differences
Professional tuners: Can hear ~1-2 cent differences
Context matters:
¢Slow melodies: 2-3 cents noticeable
¢Fast passages: 5-8 cents might be acceptable
¢Harmony (chords): 1-2 cents matters a lot!
¢Solo performance: 3-5 cents acceptable
Frequency difference for 1 cent at different pitches:
At A4 (440 Hz): 1¢= 0.255 Hz
At E2 (82.41 Hz): 1¢= 0.048 Hz
At C8 (4186 Hz): 1¢= 2.43 Hz
Formula: ¢f = f × 211200 ¢f ¢¢ f × 0.0005778
Why Is Perfect Tuning Impossible?
Even with the best equipment, perfect tuning is elusive:
¢Physical instability: String tension changes with temperature, humidity, and playing force. A guitar string drifts ¢5-10 cents during a performance!
¢Inharmonicity: Real strings don't produce perfect harmonic ratios. Piano strings are slightly sharp in the upper register due to stiffness.
¢Measurement noise: Microphones pick up room resonances and harmonics, making the detected pitch "jitter" by ¢1-3 cents even when the string is perfectly still.
¢Human perception: Our ears adapt! After hearing a slightly flat note for a while, it starts to sound "in tune" (context-dependent tuning).
Professional approach: Tune within ¢2-3 cents, check tuning frequently, and adjust for the specific piece and acoustic environment. Perfect is the enemy of good!