I am trying to play a sound when I press a button using MATLAB app designer 2021a; I use the following lines
[x, fs] = audioread('abc.wav');
freq = 2 * fs;
player = audioplayer(x, freq);
play(player);
But I don't get the audio. However, when I copy the same lines in the command box, I get the audio after I wrote the following lines there:
restoredefaultpath
rehash toolboxcache
savepath
Can someone please tell me how I can play using app designer cause the lines above create lag there? Thank you
For anyone facing a similar issue, I used
instead of