Audio Player And Audio Recoder in Matlab (GUI)

Posted on at


Audio Player And Audio Recorder in Matlab GUI

I have made Audio Player and Audio recoder in Matlab GUI.

Project is mainly divided into main three section.

  • Audio player
  • Audio recorder
  • Echo generation

Audio player has following features.

  • Load file from  user
  • Save  File with file  duration enter by user.
  • Play
  • Pause
  • Resume
  • Replay
  • Vol+
  • Vol-
  • Speed+
  • Speed-

Audio recoder has following features.

  • Record audio by audio input through microphone
  • Save recording on user desire location
  • Play

Echo generation section include

  • Atten enter by user
  • Dealy enter by user
  • Save

 

 

DETAIL DESCRIPTION:

 project mainly consists of three section.

  • Audio player (section)  load audio  file from the user from any location  and play it.If user select no file then msg is displayed(No file selected). User can also enter the file duration and save it with his desire location and play.First section have following button.
  • Play
  • pause
  • Resume
  • Replay
  • volume up
  • volume down
  • fast forword
  • fast backword

 

  • Second section is the audio recoder which take the audio input from the microphone and save it on user desire location by Save recording button. User have to first set  the recording time (in sec).Recording section have following features.
  • Recording time set by user.
  • start recording
  • stop recording
  • save recording
  • play recording

 

  • Third and last section is Echo Generation section.

Echo signal is the delaye and attenuated version of the sound signal which is added in the original sound wave to produce noise.

This section include following features.

  • Attenenter  by user.
  • Delay enter by user.
  • Save file.

 

Code:

Load file

functionload_Callback(hObject, eventdata, handles)

globalssfs n right_channel p y

 

   [a,b] = uigetfile('*.wav','Select the .wav file to play');

if(a==0)

msgbox('No file selected!!!!')

 

else

file=sprintf('%s',b,a);

 

 [ss,fs,n]=wavread(file);

left_channel=ss(:,1);

right_channel=ss(:,2);

halfsig=right_channel(1:2:length(right_channel));

reverse=flipud(halfsig);

 

end

play

 

functionstart_Callback(hObject, eventdata, handles)

% hObject    handle to start (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

globalfsss p

p=audioplayer(ss,fs)

 

play(p)

end

 

Pause

 

functionp_Callback(hObject, eventdata, handles)

% hObject    handle to p (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

globalfsss p

pause(p)

 

RESUME

 

functionrs_Callback(hObject, eventdata, handles)

% hObject    handle to rs (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

globalfsss p

resume(p)

 

Replay

 

functionr_Callback(hObject, eventdata, handles)

% hObject    handle to r (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

globalssfs p

stop(p)

play(p)

 

Volume up

 

functionvolume_up_Callback(hObject, eventdata, handles)

% hObject    handle to volume_up (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

% --- Executes on button press in enter.

globalss p fs

ss = ss*2;

    p = audioplayer(ss,fs);

play(p)

end

 

volume_down 

functionvolume_down_Callback(hObject, eventdata, handles)

% hObject    handle to volume_down (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

globalss p fs

ss = ss/2;

            p = audioplayer(ss,fs);

play(p)

end

speed up

% --- Executes on button press in s_up.

functions_up_Callback(hObject, eventdata, handles)

% hObject    handle to s_up (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

global  pssfs n right_channel

fs = fs*2;

            p = audioplayer(ss,fs);

play(p)

end

Speed down

functions_down_Callback(hObject, eventdata, handles)

% hObject    handle to s_down (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

globalssfs n right_channel p

fs = fs/2;

            p = audioplayer(ss,fs);

play(p)

Save recording

functionsave_recording_Callback(hObject, eventdata, handles)

% hObject    handle to save_recording (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

global f y  nbits

 [p k]=uiputfile();

if(p==0)

msgbox('File not save')

else

new=sprintf('%s',k,p);

wavwrite(y, f, nbits, new);

msgbox('Recording Save successfully...')

end

 

play recording

functionplay_recording_Callback(hObject, eventdata, handles)

% hObject    handle to play_recording (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

global f y wavfile

wavplay(y,f)  % Start

 



About the author

arslan-ali-423

I'm a Student of BS ELECTRONIC ENGINEERING at FET/DEE/IIUI H-10 , Islamabad , Pakistan

Subscribe 0
160