MATLAB: Problems playing .wav file in matlab online

audioplayerMATLAB Online Serversoundwav

I am trying to read and play a .wav file but there is always an error that i cannot explain. None of the .wav files that i used worked.
Error message:
"Error using sound (line 79)
Index exceeds the number of array elements (0).
Error in basico_som (line 5)
sound(y,fs)"
Here is the code i'm using:
[y,fs]=audioread('Clarinet.wav');
fs
L=length(y)
sound(y,fs)

Best Answer

  • This is a known issue, and was reported in MathWorks Bug Report Notification on 6 Oct 2020. See sound and soundsc fail to play audio in MATLAB Online (2337090) for details and a workaround.