Is there a way to open music and play it?
87 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rainaire Hansford
am 5 Jul. 2018
Kommentiert: Rahul Gulia
am 7 Mär. 2022
Is there a way for MATLAB to read all music files and work like a music player
1 Kommentar
Rahul Gulia
am 7 Mär. 2022
How can we play Youtube songs links like this? I tried using the webread() function, but it gives me an error "Too many output arguments".
Akzeptierte Antwort
Anton Semechko
am 5 Jul. 2018
Yeah, there is a way. Here is an example:
% Get sample audio file from the web
[y,Fs]=webread('http://www.worldnationalanthem.com/wp-content/uploads/2015/05/canada-national-anthem-mp3-free-download.mp3');
% Create a 'player' object
PO=audioplayer(y,Fs);
% Play audio
play(PO)
% Stop audio
%stop(PO)
12 Kommentare
Walter Roberson
am 17 Okt. 2018
fullname = 'C:\Users\rain\Documents\MATLAB\ProjectGreen\abalone_sound7.wav'; %change as required
try
[y, Fs] = audioread(fullname);
PO=audioplayer(y,Fs);
% Play audio
playblocking(PO)
catch ME
uiwait(msgbox('Could not open that file with audioread'));
end
Weitere Antworten (1)
Rainaire Hansford
am 21 Okt. 2018
1 Kommentar
Walter Roberson
am 21 Okt. 2018
Use play() instead of playblocking() . Then put in a button that uses the pause() method on the audioplayer object.
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!