How do I convert a piece of music in .mp3 format to a .mat format?

I'm building an app using the guide function in matlab and would like to include a music file as part of my app. I know that one way to do this is to use a .mat file, how do I convert an .mp3 file to a .mat file? or is there a better way to include an audio file into a GUI?

Answers (1)

[y,fs]=audioread('youfile.mp3');
save new_file y fs
% to listen to the music type
sound(y,fs)

2 Comments

when I try to use the audioread function matlab says it cant find the function.
Just what I was searching for, thanks!

Sign in to comment.

Asked:

on 1 Aug 2013

Commented:

on 29 Apr 2021

Community Treasure Hunt

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

Start Hunting!