How to record audio with start and stop pushbuttons in gui and plot the fft
Mostrar comentarios más antiguos
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
Kevin Chng
el 31 de Ag. de 2018
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);
mohanish
el 4 de Sept. de 2018
Kevin Chng
el 5 de Sept. de 2018
Editada: Kevin Chng
el 5 de Sept. de 2018
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.
mohanish
el 5 de Sept. de 2018
mohanish
el 6 de Sept. de 2018
Respuestas (1)
Kevin Chng
el 7 de Sept. de 2018
0 votos
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
mohanish
el 10 de Sept. de 2018
Kevin Chng
el 11 de Sept. de 2018
Okay, try to help you write up guide code if I have time this week. However, the concept is similar.
mohanish
el 11 de Sept. de 2018
Categorías
Más información sobre Audio I/O and Waveform Generation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!