0
0
Simulinkdata~10 mins

Audio processing model in Simulink - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to read an audio file into the model.

Simulink
audioData = audioread([1]);
Drag options to blanks, or click blank then click option'
A'input.wav'
Binput.wav
CreadAudio('input.wav')
Daudio.read('input.wav')
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the filename
Using a function that does not exist in Simulink
2fill in blank
medium

Complete the code to extract the sampling frequency from the audio file.

Simulink
[audioData, [1]] = audioread('input.wav');
Drag options to blanks, or click blank then click option'
AsampleRate
Bfreq
Cfs
Drate
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names that are not standard
Confusing sampling frequency with audio data
3fill in blank
hard

Fix the error in the code to play the audio data correctly.

Simulink
sound([1], fs);
Drag options to blanks, or click blank then click option'
Aaudio
BaudioData
Caudio_data
DsoundData
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that was not defined
Mixing underscores and camelCase
4fill in blank
hard

Fill both blanks to create a filter that applies a gain of 0.5 to the audio signal.

Simulink
filteredAudio = [1] * [2];
Drag options to blanks, or click blank then click option'
A0.5
BaudioData
Caudio_data
D1.5
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong variable name for audio data
Using a gain value greater than 1 which increases volume
5fill in blank
hard

Fill all three blanks to create a dictionary mapping words to their lengths for words longer than 3 characters.

Simulink
lengths = { [1]: [2] for [3] in words if len([3]) > 3 }
Drag options to blanks, or click blank then click option'
Aword
Blen(word)
Dw
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently
Not filtering words by length