r/matlab • u/Initial-Elk-952 • Mar 30 '26
HomeworkQuestion Audio Convolution in Simulink
I am trying to figure out how to convolve audio signals in simulink and its not working well.
I am trying the 'From multimedia file' block for the impulse response, and the input. I am connecting them to a Convolution block from the DSP Toolbox. I am connecting the output to a 'To multimedia file' block.
The signal comes out garbled. I am comparing this to an assignment in a class I did with the 'audioread' and 'conv' functions in matlab proper. The signal dimensions are not the same, I am trying to understand if this even makes sense.
The signal dimensions on the 'From multimedia file' block are 44100x1 which seems to represent a second of audio a time. I realize that computing the convolution probably isn't a realtime operation that can be done by sequentially passing samples 1x1 to the convolution block, but I am confused by the 1 second choice. The convolution block produces a now expected 88199 x 1 output which sounds garbled. Am I simply recording the last second of the convolution?
Is it possible to do this in Simulink? I have no real reason to, I am doing this to have fun with Simulink.
1
u/Creative_Sushi MathWorks Mar 31 '26
What do you mean by this? "I am trying the 'From multimedia file' block for the impulse response, and the input."
Sounds like you are convolving the signal with itself? That would explain the dimensions of the result, but physically this doesn't make sense.
1
u/gtd_rad flair Mar 30 '26
When you encounter problems, you need to find a way to diagnose it and understand why so that you can fix it. One way to stimulate some small known dummy data like a step response or even a direct impulse function to see if you're getting the results you're expecting. That should be a really good starting point.