Start storing the recorded sound with pressing the button in real time
2 views (last 30 days)
Show older comments
I record speech from the microphone, I use audiorecorder and a timer function fire every one second and doing some process (as FFT) the plot data captured in that last one second. I want to store FFT samples in a csv file when I push store button and stop storing when I push StopStore button. (for example I push store button in 4th second of recording and I push Stop button in 10th second, I want to save fft for 6 seconds (4s-10s) in csv file).
Could somebody help me how to do that. Thanks
10 Comments
Answers (1)
Geoff Hayes
on 6 Jun 2018
hoda - since handles.samples is an array of all collected samples (since starting the audio recorder), then when you press the store button (to start storing the data), just keep track of the number of samples that have been collected so far
function store_Callback(hObject, ~, handles)
handles.storeStartIdx = length(handles.samples);
guidata(hObject, handles);
Then in your stop (storing) button callback, you would create the file
function stopStore_Callback(hObject, ~, handles)
T=strrep(datestr(now),':','-');
filename=['record''-',T,'.wav'];
audiowrite(filename,handles.samples(handles. storeStartIdx:end),handles.FS,);
0 Comments
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!