record audio and get data in real time
Mostrar comentarios más antiguos
Hello, i want to make a recorder in real time, and i get data every 0.01 second with recording parameters(Fs = 8000, nbits = 16 bits, nbChannel = 1), so i want to get the 80 samples (every 0.01) second to analyse them and apply my work. i used audiorecorder object but no result, when i try to get data it is empty. Thank you
2 comentarios
Geoff Hayes
el 27 de Mayo de 2016
dz - please show the code that you have written to use the audio player. Have you created a GUI to start the recording and display the results in real-time? Provide some context as to what you are attempting.
Geoff Hayes
el 28 de Mayo de 2016
dz's answer moved here
clear all
clc
close all
global dt dtt c
%%Create a timer object:
time_rec = 2;
recObj = audiorecorder(8000,16,1);
set(recObj,'TimerPeriod',0.01,'TimerFcn',@VADML);
record(recObj,time_rec)
%%below function is to try to read data by samples for each 0.01 sec
function [dt] = VADML(h,~)
global dt dtt c
% Get data from each sample
dt = getaudiodata(h)
% compute energy
c=0;
if mod(length(dt),80)==0
c=c+1
dtt=dt(1:80)
end
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Audio and Video Data 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!