D513 of 13
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

D5 · Lesson 13 · Capstone

A melody buried under mains hum and hiss, deciding which filter removes which noise, notches for the hum and its harmonic, a windowed-sinc low-pass for the hiss, lining the output up after the filter's delay, and measuring the signal-to-noise ratio before and after

A recording made near a fluorescent light picks up a 60 Hz hum and its harmonics; a cheap microphone preamp adds a steady hiss across the whole band. Here's a one-second melody, four notes from 440 to 880 Hz, recorded with both, so badly that the noise carries more power than the music. Cleaning it up takes this course's tools in the right order: look at where each kind of noise lives in frequency, design a filter for each, apply them, and measure the improvement.

  • The response of two cascaded notch filters, at 60 Hz and 180 Hz, for a 16 kHz recording, with pole radius r.
  • A notch close to the unit circle (r near 1) is narrow and leaves the music untouched, but rings for longer when the hum starts, letting hum through at the beginning.
  • The readouts give each notch's −3 dB width and its transient's time constant.

Predict

The melody's notes all lie between 440 and 880 Hz; the hiss is spread evenly from 0 to 8 kHz. If a low-pass at 1.5 kHz removed all the hiss above it, how much would the hiss's power fall?

Name it

A plan for the noise

  1. Hum at 60 Hz and 180 Hz: two narrow notches (lesson 6), with zeros on the unit circle and poles at radius r. A narrow notch spares the music; its transient lasts about −1/ln⁡r samples.
  2. Hiss spread over the whole band: a low-pass just above the music. A windowed-sinc FIR filter (lesson 4) with 201 taps and a Hann window, cutting off at 1.5 kHz, attenuates 3 kHz by more than 100 dB and delays everything by exactly 100 samples.
  3. Alignment: to compare the output with the clean signal, remove the FIR filter's delay by dropping its first (N − 1)/2 output samples.
  4. Measurement: SNR = 10 log₁₀ of the clean signal's energy over the energy of the difference between the result and the clean signal.

What each step buys

In the Python step's recording, the clean melody has 0.045 of power, the hum 0.145 and the hiss 0.0064. The SNR starts at −5.4 dB. The low-pass alone barely helps, −5.3 dB, because the hum is inside its passband; the notches alone reach 7.5 dB, limited by hiss; together they reach 12.4 dB.

Worked example

What are the notches' width and transient at r = 0.995 for 16 kHz audio?

Show the solution
  1. Notch width. W=(1−0.995)×16000πHz=25.5Hz so 440 Hz is untouched.
  2. Transient. τ=−1ln⁡0.995=199.5samples=12.5ms so the hum fades out over the first few tens of milliseconds.

Answer each notch is 25.5 Hz wide, and its transient has a time constant of 12.5 ms.

Worked example

How much delay does the 201-tap low-pass add, and what's the SNR limit set by the hiss it leaves?

Show the solution
  1. Delay. The 201-tap filter delays everything by 100 samples: 10016000Hz=6.25ms
  2. Hiss left. The low-pass keeps 1.5 kHz of the hiss's 8 kHz band: 0.0064×1.58=0.0012 of power, against the melody's 0.045.
  3. Best SNR. 10log10⁡0.0450.0012=15.7dB
  4. Measured SNR. The measured 12.4 dB also includes the notches' start-up transients and the hum that leaks through them.

Answer a delay of 100 samples (6.25 ms), and the hiss it leaves limits the SNR to 15.7 dB at best.

Worked example

A recording has music at 0 dBFS, 60 Hz hum at −20 dBFS and hiss at −50 dBFS. A notch removes 40 dB of the hum. What SNR results?

Show the solution
  1. Noise before. Add the hum and hiss powers: N=10log10⁡(10−2+10−5)=−20.0dBFS an SNR of 20 dB.
  2. Hum after the notch. It drops 40 dB, to −60 dBFS.
  3. Noise after. Together with the hiss: N=10log10⁡(10−6+10−5)=−49.6dBFS an SNR of 49.6 dB, now set by the hiss.

Answer the SNR rises from 20 dB to 49.6 dB, now set by the hiss.

Check

Build the notch, the low-pass and the SNR meter, then clean the recording.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

A notch with poles at radius 0.995 runs at 8 kHz. About how wide is it at −3 dB?

Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.

Check

White noise fills 0 to half of 16 kHz. A low-pass at 1 kHz removes everything above it. By how much does the noise power fall?

Check

A 201-tap linear-phase filter runs at 16 kHz. How much must the output be advanced to line up with the input?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

Check

A signal of power 0.045 carries noise of power 0.001. What's the SNR?

Check

Music at 0 dBFS carries hum at −20 dBFS and hiss at −40 dBFS. A notch removes 40 dB of the hum.

(a)

What is the SNR before?

(b)

And after?

Check

A notch with pole radius 0.995 runs at 8 kHz.

(a)

How wide is it?

Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.

(b)

What is its transient's time constant?

Explain why

Why does the low-pass filter alone barely improve this recording?

Practice

Keep practicing

8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.