Reputation: 113
i've got a matlab code that load a wav audio file and play some special part of it. it used to play sound on my pc but now there is no sound. algorithm works properly and show the results but in silence i.e it doesn't play any sound. i examine it on my laptop and it works right and play sound. i do n't know what to do?
the only thing that i've done and that may be caused the problem is:i had got two versions of matlab on my pc:matlab 7.1 and matlab r2013a(8.1), i've deleted matlab 7.1,did it really cause the problem?
i reinstall matlab 7.1 then but it didn't help.
matlab can't play sound at all, e.g i try this code but it wont play sound:
[y,Fs] = audioread('1.wav');
sound(y,Fs);
and the code that i was working with is:silence removal
Upvotes: 2
Views: 7628
Reputation: 21
I struggled with this issue for a long time. My laptop played sound just fine, but
info = audiodevinfo
returned an empty structure.
It turns out that it was a file path issue.
I saved my custom file path, then restored the default file path:
restoredefaultpath
rehash toolboxcache
I then slowly added the subfolders back into my filepath and it worked fine.
Upvotes: 2
Reputation: 7817
As the output of daqhwinfo('winsound') shows:
InstalledBoardIds: {'0' '1'}
This means that Matlab is seeing more than one sound card/possible audio output. It will default to whichever one is "0", I believe. Look at the content of "BoardNames" and "ObjectConstructorName" to determine what is happening. You could try (for each BoardID):
load handel;
% last input for audioplayer can be 1 or 0 to choose which audio output
player = audioplayer(y, Fs, 16, 1);
play(player);
Another way to check:
ao = analogoutput('winsound',0); %should be default device
ao2 = analogoutput('winsound',1);
out = daqhwinfo(ao)
out2 = daqhwinfo(ao2)
Compare these with the values you get from your laptop, where the sound does work.
Upvotes: 1