doesn't find audio harware
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 10 Ott 2024
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.
Risposte (1)
Hitesh
il 14 Ott 2024
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.
0 Commenti
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!