Bird
Raised Fist0
Signal Processingdata~10 mins

Audio equalization in Signal Processing - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Audio equalization
Input Audio Signal
↓
Split into Frequency Bands
↓
Apply Gain to Each Band
↓
Combine Bands Back
↓
Output Equalized Audio
Audio equalization splits sound into frequency parts, adjusts each part's volume, then mixes them back to change the sound.
Execution Sample
Signal Processing
import numpy as np
from scipy.signal import butter, filtfilt

def equalize(audio, gains_db, fs):
    # gains_db = [low_gain_db, mid_gain_db, high_gain_db], e.g., [3, -2, 0]
    gains = 10 ** (np.array(gains_db) / 20.0)
    
    # Low band: lowpass 250 Hz
    b_low, a_low = butter(5, 250 / (fs / 2), btype='low')
    low_sig = filtfilt(b_low, a_low, audio) * gains[0]
    
    # Mid band: bandpass 250-4000 Hz
    b_mid, a_mid = butter(5, [250 / (fs / 2), 4000 / (fs / 2)], btype='band')
    mid_sig = filtfilt(b_mid, a_mid, audio) * gains[1]
    
    # High band: highpass 4000 Hz
    b_high, a_high = butter(5, 4000 / (fs / 2), btype='high')
    high_sig = filtfilt(b_high, a_high, audio) * gains[2]
    
    equalized_audio = low_sig + mid_sig + high_sig
    return equalized_audio
This code splits audio into low (0-250 Hz), mid (250-4000 Hz), and high (4000+ Hz) bands using Butterworth filters, applies gains in dB converted to linear scale, and sums them for equalization.
Execution Table
StepActionFrequency Band (Hz)Gain AppliedResulting Signal Segment
1Input audio receivedFull spectrumN/ARaw audio waveform
2Split into low band20-250N/ALow frequency segment extracted
3Split into mid band250-4000N/AMid frequency segment extracted
4Split into high band4000-20000N/AHigh frequency segment extracted
5Apply gain to low band20-250+3 dBLow band volume increased
6Apply gain to mid band250-4000-2 dBMid band volume decreased
7Apply gain to high band4000-200000 dBHigh band unchanged
8Combine all bandsFull spectrumN/AEqualized audio waveform
9Output equalized audioFull spectrumN/AFinal adjusted audio signal
💡 All frequency bands processed and combined, equalization complete
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5After Step 6After Step 7After Step 8Final
audioRaw waveformLow freq segmentMid freq segmentHigh freq segmentLow band adjustedMid band adjustedHigh band unchangedBands combinedEqualized audio
Key Moments - 3 Insights
Why do we split the audio into frequency bands before applying gain?
Splitting lets us adjust specific parts of sound separately, as shown in steps 2-4 of the execution table.
What happens if we apply gain directly to the full audio without splitting?
We would change all frequencies equally, losing control over tone, unlike the selective changes in steps 5-7.
Why do we combine the bands after adjusting gains?
Combining (step 8) merges all adjusted parts back into one signal to produce the final equalized audio.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what gain is applied to the mid frequency band at step 6?
A+3 dB
B0 dB
C-2 dB
D+5 dB
💡 Hint
Check the 'Gain Applied' column for step 6 in the execution table.
At which step are all frequency bands combined back into one signal?
AStep 8
BStep 7
CStep 4
DStep 9
💡 Hint
Look for the action 'Combine all bands' in the execution table.
If we increase the gain on the high band at step 7 to +4 dB, what changes in the variable tracker?
AThe 'Mid band adjusted' changes to +4 dB
BThe 'High band unchanged' becomes 'High band increased volume'
CThe 'Low band adjusted' changes to +4 dB
DNo change in variable tracker
💡 Hint
Refer to the 'After Step 7' column in variable tracker and relate it to gain changes in execution table step 7.
Concept Snapshot
Audio equalization splits sound into frequency bands.
Each band gets a gain adjustment (volume up/down).
Bands are combined back to form the final sound.
This changes tone by boosting or cutting frequencies.
Common bands: low (20-250 Hz), mid (250-4000 Hz), high (4000-20000 Hz).
Full Transcript
Audio equalization is a process where an audio signal is split into different frequency bands. Each band represents a range of sound frequencies like low, mid, and high. We then apply gain changes to each band separately to increase or decrease their volume. After adjusting, we combine all bands back into one audio signal. This lets us change the tone or balance of the sound, making some parts louder or softer. The execution table shows each step: receiving audio, splitting bands, applying gains, and combining bands. The variable tracker follows how the audio signal changes after each step. Key moments clarify why splitting is needed, why gains are applied separately, and why bands are combined. The quiz tests understanding of gain values, combination step, and effects of changing gain on the high band.

Practice

(1/5)
1. What is the main purpose of audio equalization in signal processing?
easy
A. To convert audio signals into text
B. To increase the volume of the audio signal only
C. To adjust the balance of frequency components in an audio signal
D. To remove all background noise completely

Solution

  1. Step 1: Understand audio equalization

    Audio equalization changes the levels of different frequency parts of sound to improve or customize it.
  2. Step 2: Identify the main function

    It adjusts bass, mid, and treble frequencies, not just volume or noise removal.
  3. Final Answer:

    To adjust the balance of frequency components in an audio signal -> Option C
  4. Quick Check:

    Audio equalization = frequency adjustment [OK]
Hint: Think: equalization means balancing frequencies [OK]
Common Mistakes:
  • Confusing equalization with volume control
  • Assuming it converts audio to text
  • Believing it removes all noise
2. Which of the following is the correct way to represent a simple bass boost filter gain in code?
easy
A. gain = 1.5 # Boost bass frequencies by 50%
B. gain = -1.5 # Boost bass frequencies by 50%
C. gain = 0 # No change to bass frequencies
D. gain = 'boost' # String value for gain

Solution

  1. Step 1: Understand gain values in filters

    Positive gain values increase (boost) frequency levels; negative values reduce (cut) them.
  2. Step 2: Identify correct gain for bass boost

    Gain of 1.5 means 50% increase, which is a boost; negative or zero values do not boost.
  3. Final Answer:

    gain = 1.5 # Boost bass frequencies by 50% -> Option A
  4. Quick Check:

    Positive gain boosts frequencies [OK]
Hint: Positive gain means boost, negative means cut [OK]
Common Mistakes:
  • Using negative gain to boost frequencies
  • Setting gain to zero expecting boost
  • Using non-numeric gain values
3. Given this Python code snippet for equalizing audio frequencies, what will be the output?
frequencies = {'bass': 100, 'mid': 500, 'treble': 10000}
gain = {'bass': 1.2, 'mid': 1.0, 'treble': 0.8}
equalized = {k: frequencies[k] * gain[k] for k in frequencies}
print(equalized)
medium
A. {'bass': 120.0, 'mid': 500.0, 'treble': 8000.0}
B. {'bass': 100, 'mid': 500, 'treble': 10000}
C. {'bass': 1.2, 'mid': 1.0, 'treble': 0.8}
D. SyntaxError due to dictionary comprehension

Solution

  1. Step 1: Multiply each frequency by its gain

    bass: 100 * 1.2 = 120.0, mid: 500 * 1.0 = 500.0, treble: 10000 * 0.8 = 8000.0
  2. Step 2: Construct the equalized dictionary

    Result is {'bass': 120.0, 'mid': 500.0, 'treble': 8000.0}
  3. Final Answer:

    {'bass': 120.0, 'mid': 500.0, 'treble': 8000.0} -> Option A
  4. Quick Check:

    frequency * gain = equalized value [OK]
Hint: Multiply each frequency by its gain [OK]
Common Mistakes:
  • Confusing keys and values in comprehension
  • Expecting original frequencies without gain
  • Thinking dictionary comprehension causes syntax error
4. Identify the error in this code snippet for applying a treble cut filter:
frequencies = {'bass': 100, 'mid': 500, 'treble': 10000}
gain = {'bass': 1.0, 'mid': 1.0, 'treble': 0.5}
for freq in frequencies:
    frequencies[freq] = frequencies[freq] * gain['freq']
print(frequencies)
medium
A. Multiplying frequencies by gain is incorrect
B. The print statement is missing parentheses
C. The for loop should iterate over gain, not frequencies
D. Using 'freq' as a string key instead of variable freq in gain dictionary

Solution

  1. Step 1: Check dictionary key usage in loop

    The code uses gain['freq'], which looks for key 'freq' literally, not the variable freq.
  2. Step 2: Correct key access

    It should be gain[freq] without quotes to use the variable's value as key.
  3. Final Answer:

    Using 'freq' as a string key instead of variable freq in gain dictionary -> Option D
  4. Quick Check:

    Variable keys need no quotes [OK]
Hint: Use variable keys without quotes in dictionaries [OK]
Common Mistakes:
  • Using string keys instead of variables
  • Thinking multiplication is wrong
  • Confusing loop iteration variable
5. You have an audio signal with frequency bands: bass=80Hz, mid=1000Hz, treble=12000Hz. You want to reduce bass by 20%, keep mid unchanged, and boost treble by 30%. Which gain dictionary correctly applies this equalization?
hard
A. {'bass': 1.2, 'mid': 1.0, 'treble': 0.7}
B. {'bass': 0.8, 'mid': 1.0, 'treble': 1.3}
C. {'bass': 0.2, 'mid': 1.3, 'treble': 1.0}
D. {'bass': 0.8, 'mid': 0.7, 'treble': 1.3}

Solution

  1. Step 1: Calculate gain values for each band

    Reduce bass by 20% means multiply by 0.8; mid unchanged means 1.0; boost treble by 30% means multiply by 1.3.
  2. Step 2: Match gains to options

    {'bass': 0.8, 'mid': 1.0, 'treble': 1.3} matches these values exactly; others do not.
  3. Final Answer:

    {'bass': 0.8, 'mid': 1.0, 'treble': 1.3} -> Option B
  4. Quick Check:

    Gain = 1 ± percentage change [OK]
Hint: Gain = 1 ± percentage change (0.8 means 20% cut) [OK]
Common Mistakes:
  • Mixing boost and cut values
  • Applying wrong percentages
  • Changing mid frequency unintentionally
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard