I have this code that is do plotting while recording at the same time, and I want to add lines so that it takes a decision when it detects some pattern from the plotted figure

1 次查看(过去 30 天)
close all
clear all
clc
%Define parameters
fs = 96000; % Sampling frequency
nBits = 24; % Number of bits
nChannels = 1; % Number of channels
duration = inf; % Duration of recording in seconds
%Create recorder object
recObj = audiorecorder(fs, nBits, nChannels);
disp('Start Recording:')
recObj.record(duration);
while recObj.isrecording()
pause(0.1);
plot(recObj.getaudiodata());
title('The recording of ')
xlabel('Time')
ylabel('Audio Signal')
drawnow();
%Check for key press
if isequal(get(gcf,'CurrentKey'),'escape')
%Stop recording if 'Escape' is pressed
break;
end
end
disp('End of Recording');

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by