Error when trying to play mp3 file
24 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Rohan Thomas
le 1 Déc 2022
Réponse apportée : Walter Roberson
le 2 Déc 2022
So for some reason this was working perfectly a couple hours ago, but now it seems like I cant play any audio files at all. Whenever I run the code, I get "Device error: invalid number of channels". Anyone know why?
heres the code:
A test I did with 1 file (same error)
[y, Fs] = audioread('old-victory-sound-roblox.mp3');
player = audioplayer(y, Fs);
play(player)
this is my og code that was working before:
[y,Fs]=audioread('old-victory-sound-roblox.mp3');
pw =audioplayer(y,Fs);
[y,Fs]=audioread('gaming-sound-effect-hd.mp3');
pl =audioplayer(y,Fs);
[y,Fs]=audioread('Kids Cheering - Gaming Sound Effect (HD).mp3');
wn =audioplayer(y,Fs);
0 commentaires
Réponse acceptée
Walter Roberson
le 2 Déc 2022
Your current directory is not one where old-victory-sound-roblox.mp3 can be found.
It is recommended that you construct fully qualified file names. For example,
sounddir = 'C:\Users\Rohan\Desktop\MATLAB\project7b\samples';
file1 = fullfile(sounddir, 'old-victory-sound-roblox.mp3');
file2 = fullfile(sounddir, 'gaming-sound-effect-hd.mp3' );
file3 = fullfile(sounddir, 'Kids Cheering - Gaming Sound Effect (HD).mp3');
[y1, Fs1] = audioread(file1);
pw = audioplayer(y1, Fs1);
[y2, Fs2] = audioread(file2);
pl = audioplayer(y2, Fs2);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!