Warning: Unable to play audio because no audio outputs were found.

647 ビュー (過去 30 日間)
Anthony Birch
Anthony Birch 2020 年 4 月 10 日
コメント済み: 沁禾 彭 2022 年 7 月 28 日
Hey, I'm trying to play an mp3 file on MATLAB, but it's giving me this error:
Warning: Unable to play audio because no audio outputs were found.
> In audiovideo.internal/audioplayerDesktop/hasNoAudioHardware (line 565)
In audiovideo.internal/audioplayerDesktop/play (line 228)
In audioplayer/play (line 349)
In sound (line 77)
This is my code:
[y,Fs] = audioread('Applause.mp3');
sound(y,Fs);
I'm not sure what I'm doing wrong...

回答 (4 件)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi 2020 年 4 月 13 日
Hello Anthony,
This error could be the result of the path being modified, or the necessary libraries being removed to access the sound components on the computer. To fix this, in the command window, use -
restoredefaultpath
rehash toolboxcache
savepath
Further, evaluate if MATLAB is able to read the available outputs for audio on your PC using the function audiodevinfo. This results in a struct array containing all available & recognized audio inputs/outputs.
info = audiodevinfo
In case info returns an empty struct, it could be because of faulty drivers. Update all your drivers or disable devices one at a time and restart MATLAB and try 'audiodevinfo' to figure out if one or more devices has a possible faulty driver.
Instead, if info returns a struct with available outputs for audio (non-empty), you should be able to play the audio using audioplayer object. Additionally, if info has recognized multiple audio outputs, you can also use "device ID" to specify the output audio device.
Hope this helps!
  4 件のコメント
沁禾 彭
沁禾 彭 2022 年 7 月 28 日
thanks a lot! Your answer helps me so much!

サインインしてコメントする。


Guilherme Vitor Santos
Guilherme Vitor Santos 2022 年 6 月 3 日
estou com esse poblema matlab online
Error evaluating 'InitFcn' callback of Audio Device Writer block (mask) 'lllabtetecom/Audio Device Writer'.
Callback string is 'audioblkAudioDeviceIO(gcbh, 'initfcn');'
Caused by:
No audio input device detected
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 6 月 3 日
If you are using matlab online then audio can only be used with Chrome browser.

サインインしてコメントする。


Image Analyst
Image Analyst 2022 年 6 月 3 日
This happens to me a lot. I have a PlaySoundFile() function that plays a sound file through the speakers. I'm using MATLAB desktop, not online. I have to do the restoredefaultpath to fix it. Then it's fixed for a while but something causes it to break again and I'll get the error message again
In PlaySoundFile (line 74)
Warning: Unable to play audio because no audio outputs were found.
> In audiovideo.internal/audioplayerDesktop/hasNoAudioHardware (line 565)
In audiovideo.internal/audioplayerDesktop/play (line 228)
In audioplayer/play (line 349)
In sound (line 77)
In PlaySoundFile (line 74)
I wish I could figure out what is causing it to break. I don't believe it's because I'm removing sound libraries. I do set the path to some folders in my startup.m file but that happens every time I start MATLAB and it works fine until some mysterious process causes it to break, so it's not adding things to the path that's causing it to break.

Jonas
Jonas 2022 年 7 月 13 日
anything new on this topic? can't make matlab to play sounds again, there are audio devices available, resetting/rehashing has not the effect i hoped to see. Only a matlab restart can resolve this for me, but i need to reset on runtime, e.g. if this issue comes up during use of a self created app
  6 件のコメント
Image Analyst
Image Analyst 2022 年 7 月 19 日
@Jonas, no because I restarted and it's working again. It's not currently broken (yet). That (audiodevreset) might be a faster way to fix it than restarting. I can try it. But we'd really like to know what happened to break it in the first place so we don't have to fix it.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by