Challenge - 5 Problems
Audio Signal Processing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output of this MATLAB code for audio normalization?
Consider the following MATLAB code that normalizes an audio signal to the range [-1, 1]. What will be the maximum absolute value of the output signal
y?MATLAB
x = [-0.5, 0.2, 0.8, -0.9, 0.4]; max_val = max(abs(x)); y = x / max_val; max_abs_y = max(abs(y)); disp(max_abs_y);
Attempts:
2 left
💡 Hint
Normalization divides all values by the maximum absolute value in the signal.
✗ Incorrect
The code finds the maximum absolute value in x, which is 0.9, then divides all elements by 0.9. This scales the signal so the maximum absolute value becomes 1.
🧠 Conceptual
intermediateWhat does the MATLAB function
audioread return?When you use
[y, Fs] = audioread('sound.wav'); in MATLAB, what do the variables y and Fs represent?Attempts:
2 left
💡 Hint
Think about what you need to play or process audio: the sound data and how fast it was recorded.
✗ Incorrect
audioread returns the audio samples in y and the sampling rate (samples per second) in Fs.🔧 Debug
advancedWhy does this MATLAB code produce an error when playing audio?
The following code attempts to play an audio signal but causes an error. What is the cause?
MATLAB
y = rand(1000, 2); % stereo noise sound(y, 44100); sound(y(:,1), 44100);
Attempts:
2 left
💡 Hint
Check the shape of the input to
sound and what it accepts for stereo and mono.✗ Incorrect
The
sound function accepts both mono and stereo signals. y is a 1000x2 matrix (stereo), and y(:,1) is a 1000x1 column vector (mono). Both calls are valid and produce sound without error.📝 Syntax
advancedWhich MATLAB code snippet correctly applies a low-pass filter to an audio signal?
Given an audio signal
x sampled at 44100 Hz, which code correctly applies a low-pass FIR filter with cutoff 5000 Hz?Attempts:
2 left
💡 Hint
The cutoff frequency must be normalized by half the sampling rate (Nyquist frequency).
✗ Incorrect
The
fir1 function expects the cutoff frequency normalized to the Nyquist frequency, which is half the sampling rate. Option A correctly uses fc/(fs/2).🚀 Application
expertHow many samples are in the output after downsampling this audio signal?
An audio signal
x has 88200 samples sampled at 44100 Hz. You downsample it by a factor of 4 using y = downsample(x, 4);. How many samples does y contain?Attempts:
2 left
💡 Hint
Downsampling by 4 keeps every 4th sample, reducing the total number of samples by 4.
✗ Incorrect
Downsampling by 4 reduces the number of samples to one fourth. 88200 / 4 = 22050 samples.
