How to record audio with start and stop pushbuttons in gui and plot the fft

I am writing a program to record an audio file with start and stop push buttons. how do I set an audiorecorder in first place? and then how to make the pushbuttons start the recording and stop the recording?

5 comentarios

Do you familiar with app designer in MATLAB?
Here is the code for audio recording
% Record your voice for 5 seconds.
recObj = audiorecorder;
disp('Start speaking.')
recordblocking(recObj, 5);
disp('End of Recording.');
% Play back the recording.
play(recObj);
% Store data in double-precision array.
myRecording = getaudiodata(recObj);
% Plot the waveform.
plot(myRecording);
I am familiar with the app designer but I have programmed all my code using Guide and I want to develop this by Guide as well
Great!You may do this :
callback for first button : Start Recording
global recObj
recObj = audiarecorder ; %create object
record(recObj); %start Recording
Callback for 2nd button : Stop recording
global recObj
stop(recObj) % Stop
Callback for 3rd button ; % Play Recording
global recObj
play(recObj) % Play
Let me know if it is working for you.However, in the third button, you must write code to check the existing of recObj before playing it.
Don't I have to first set an audiorecorder?
here is the code and fig file that i am working on

Iniciar sesión para comentar.

Respuestas (1)

Hi Mohanish,
Please refer to the attached m.file which consist the function of record, stop record, plot and play the audio. However, I constructed them in app designer instead of guide.
If you have any question, just let me know

3 comentarios

thanks for your help Kevin, but I am looking for guide code. I cannot link them together.
Okay, try to help you write up guide code if I have time this week. However, the concept is similar.
yes. thanks. I got the it to record an audio from microphone and plot the frequency domain. playing the recording back is remaining. i would also like to know how to plot the frequency domain simultaneously with the audio input.

Iniciar sesión para comentar.

Categorías

Más información sobre Audio I/O and Waveform Generation en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Ag. de 2018

Comentada:

el 11 de Sept. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by