Learn to measure audio quality in 10 minutes.
β What SNR actually measures
β The math behind decibels
β A critical bug in common implementations
β How to estimate SNR from real audio
A signal is what you want to hear. Let's create a 440 Hz tone (musical note A).
Noise is what you don't want to hear. It's randomβno pattern, unpredictable.
In the real world, you hear signal + noise combined. Use the slider to see how noise affects the signal.
SNR measures the ratio of signal power to noise power.
Power = average of squared values
P = mean(xΒ²)
Ratios can be huge (10x, 100x, 1000x). dB compresses the scale.
| 30 dB | 1000Γ | Excellent |
| 20 dB | 100Γ | Good |
| 10 dB | 10Γ | Poor |
| 0 dB | 1Γ | Signal = Noise |
Adjust the signal and noise levels to see how SNR changes.
Here's code found in production systems. Can you spot the bug?
def calculate_snr(audio, noise): signal_power = mean(audio ** 2) # β THE BUG noise_power = mean(noise ** 2) return 10 * log10(signal_power / noise_power)
audio contains BOTH signal AND noise!| True SNR | Buggy Result | Error |
| -10 dB | +0.4 dB | +10.4 dB! |
| 0 dB | +3.0 dB | +3.0 dB |
| 10 dB | +10.4 dB | +0.4 dB |
| 20 dB | +20.0 dB | ~0 dB |
In practice, you only have the mixed audio. How do you estimate SNR?
Speech has pauses. Music has quiet moments. During silence, you only hear noise!
Test your understanding with 3 questions.
Signal power = 0.5, Noise power = 0.005. What is the SNR?
| β₯ 30 dB | EXCELLENT | Studio recording |
| β₯ 20 dB | GOOD | Clear phone call |
| β₯ 15 dB | ACCEPTABLE | Office background |
| β₯ 10 dB | POOR | Noisy environment |
| < 10 dB | VERY POOR | Hard to understand |
β SNR = ratio of signal power to noise power (in dB)
β Every +10 dB = 10Γ more signal power
β Common bug: using (S+N)/N instead of S/N
β Estimate noise from quiet frames (percentile method)
You've mastered the fundamentals of SNR.
β What SNR measures and why it matters
β The math behind power and decibels
β The critical bug in common implementations
β How to estimate SNR without ground truth