Hi Sanusha,
I understand that you are trying to reduce noise from the audio signal, but the provided code is not working.
On debugging the code, I found that ‘y_clean’ variable is of dimension ‘1024 x 1147’ which signifies that ‘1147’ audio channels are present in the provided audio signal.
After referring to the MathWorks Documentation of ‘audiowrite’ function, I discovered that ‘audiowrite’ function does not support large number of audio channels like ‘1147’, hence the provided code throws an error as ‘Unsupported number of channels.’
For more information, you can refer to the MATLAB Documentation of ‘audiowrite’ function.
This issue can be resolved by converting the ‘y_clean’ channel into mono channel form by averaging the channels to maintain the balance of all available channels.
You can refer to the implementation below for better understanding:
% Ensure y_clean is a column vector if the input is mono
if size(y_clean, 2) > 1
y_clean = mean(y_clean, 2);
end
I hope this resolves the issue.