필터 지우기
필터 지우기

How to use recordblocking for an infinite interval?

조회 수: 1 (최근 30일)
Marie Kate Palau
Marie Kate Palau 2021년 10월 28일
댓글: Walter Roberson 2021년 10월 28일
I need to record an audio until I stop the recording (using a button or something), do you know how to do it?

답변 (1개)

Geoff Hayes
Geoff Hayes 2021년 10월 28일
@Marie Kate Palau I don't think you want to use recordblocking since that would prevent you from stopping the recording after an unknown period of time. Try using record instead. I'm assuming that you have a GUI to start and stop the recording?
  댓글 수: 4
Marie Kate Palau
Marie Kate Palau 2021년 10월 28일
I'm not sure if I'm using it the way it should be, but it doesn't work as I expected, don't know if can you please check it just to notice what I'm doing wrong
clearvars;
myRecorder = audiorecorder(1000,16,1); % Crea el elemento de MATLAB para grabar audio
disp ("Hable ahora");
record(myRecorder);
% Graba durante 2 segundos
disp("Deje de hablar");
stop(myRecorder);
play(myRecorder);
audioArray=getaudiodata(myRecorder);
% Pone los datos de la grabación en un vector de MATLAB
plot(audioArray)
title('Visualizacion del Sonido','FontSize',16,'Interpreter','latex')
xlabel('Tiempo ($mseg$)','FontSize',14,'Interpreter','latex')
ylabel('Amplitud','FontSize',14,'Interpreter','latex')
set(gcf,'color','w')
set(gca,'FontSize',12,'TickLabelInterpreter','latex')
grid on
Walter Roberson
Walter Roberson 2021년 10월 28일
Your code is stopping recording immediately after sending out the message 'Deje de hablar' .
Consider something like
record(myRecorder);
% Graba durante 2 segundos
menu("Deje de hablar", "para de grabar");
stop(myRecorder);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by