Introduction: By designing a simple music player with Matlab GUI, I get to learn more about coding and the processing of audio signal.
User Interface: You can add a song from the computer and it will show the song name and its sound wave then you can play/pause/resume playing your song just like any music player, and while you enjoying the music, if there's some adjustment you'd like to make, you can always easily control the speed and volume with the slide bars.
Code:
function pushbutton4_Callback(hObject, eventdata, handles)[filename, filepath] = uigetfile('*.mp3');[fullpath] = [filepath filename];handles.data = audioread([fullpath]);handles.path = [fullpath];set(handles.edit1,'string',filename);axes(handles.axes1);plot(handles.data);guidata(hObject,handles);function pushbutton1_Callback(hObject, eventdata, handles)handles.player = audioplayer(handles.data, 44100)play(handles.player);guidata(hObject,handles);function pushbutton2_Callback(hObject, eventdata, handles)pause(handles.player);guidata(hObject,handles);function pushbutton3_Callback(hObject, eventdata, handles)resume(handles.player);guidata(hObject,handles);function slider5_Callback(hObject, eventdata, handles)slider_value = get(handles.slider5, 'Value');set(handles.edit6,'String',slider_value);fs=48000;n=1;cutOffFreq=1000;[b,a]=butter(n,cutOffFreq/(fs/2),'High');handles.data = filter(b,a,handles.data);axes(handles.axes2);plot(handles.data);guidata(hObject,handles);fs=48000;n=6;cutOffFreq=1000;[b,a]=butter(n,cutOffFreq/(fs/2),'low');handles.data = filter(b,a,handles.data);axes(handles.axes3);plot(handles.data);guidata(hObject,handles);