doesn't find audio harware

조회 수: 10 (최근 30일)
Kevin
Kevin 2024년 10월 10일
답변: Hitesh 2024년 10월 14일
when i want to play audio through matlab by use of audioread i get this error saying it doesn't find any audio hardware
> In audiovideo.internal.audioplayerDesktop.hasNoAudioHardware (line 566)
  댓글 수: 1
Walter Roberson
Walter Roberson 2024년 10월 10일
Playing audio would require a function such as audiowrite() or sound() . audioread() is for inputting sound into MATLAB.
Quesiton: are you using MATLAB Online? If so then there is only audio capabilities if you are using the Chrome browser.

댓글을 달려면 로그인하십시오.

답변 (1개)

Hitesh
Hitesh 2024년 10월 14일
Hi Kevin,
The issue might occur because of multiple reasons, to troubleshoot, please ensure the following:
Verify the Audio File:
  • Ensure that the audio file is not corrupted.
  • Try playing the audio file using any media player to confirm it is working correctly.
Check MATLAB Preferences:
  • Open MATLAB and navigate to Home > Preferences > MATLAB > Audio.
  • Ensure that the correct audio device is selected. If no device is listed, MATLAB may not be detecting your audio hardware.
Use Appropriate Functions:
  • Use the audioread function to read the audio file.
  • Use the sound function to play the audio file.
Refer to the code below to help identify the root cause of the error:
% Read the audio file
filename = 'sample-3s.wav'; % Replace with your audio file
[y, Fs] = audioread(filename);
% Check if audio data is successfully read
if isempty(y)
error('Audio data could not be read. Check the file path and format.');
end
% Play the audio using the sound function
try
sound(y, Fs);
disp('Playing audio...');
catch ME
disp('An error occurred while trying to play audio.');
disp(ME.message);
end
For more information about the "audioread" and "sound", refer to the below MATLAB documenation,
If the issue persists, could you please share the audio file that is causing this error? So that I can investigate the issue.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by