record audio and get data in real time
Show older comments
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 Comments
Geoff Hayes
on 27 May 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
on 28 May 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
Accepted Answer
More Answers (0)
Categories
Find more on Audio and Video Data 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!