MATLAB Answers


Is there a way to open music and play it?

Rainaire Hansford さんによって質問されました 2018 年 7 月 5 日
最新アクティビティ Walter Roberson
さんによって コメントされました 2018 年 10 月 21 日
Is there a way for MATLAB to read all music files and work like a music player

  0 件のコメント

サインイン to comment.

2 件の回答

回答者: Anton Semechko 2018 年 7 月 5 日

Yeah, there is a way. Here is an example:
% Get sample audio file from the web
% Create a 'player' object
% Play audio
% Stop audio
You can find more info about 'audioplayer' here

  12 件のコメント

Walter Roberson
2018 年 10 月 1 日
The uigetfile() code prompts the user to select a file. If you want to skip that, then store the name of the file (preferably complete with directory) in fullname and then carry on from the "try" statement.
Rainaire Hansford 2018 年 10 月 17 日
Ok I tried running this code and put in the directory but it was keep given me error. Could some share a example code I might be missing something.
Sorry for taking so long.
Walter Roberson
2018 年 10 月 17 日
fullname = 'C:\Users\rain\Documents\MATLAB\ProjectGreen\abalone_sound7.wav'; %change as required
[y, Fs] = audioread(fullname);
% Play audio
catch ME
uiwait(msgbox('Could not open that file with audioread'));

サインイン to comment.

回答者: Rainaire Hansford 2018 年 10 月 21 日

Yes I got it thank you. Now next step is to implement pause and stop and play in this code cause I really need it lol But Walter your the best

  1 件のコメント

Walter Roberson
2018 年 10 月 21 日
Use play() instead of playblocking() . Then put in a button that uses the pause() method on the audioplayer object.

サインイン to comment.

Translated by