From: Aurele JAMI on
Hi all,

I've created a simulink model able to acquire real time sounds with an important overlap and -also in real time- able to do different operations and everything is working fine !

What I'm looking for is to create the same function but in MatLab. I have some problems because of the real time buffering. How can I create an overlap ('buffer') and analyse each of those frames in real time while the acquisition continues...?!

Here is my script :

AI = analoginput('winsound');
chan = addchannel(AI,1);
chans = addchannel(AI,2);


Fech = 8000; % Sample Rate
d = 20; % parameters
l = 1.5; % parameters
set(AI,'SampleRate',Fech);
Fe = get(AI,'SampleRate');
set(AI,'TriggerRepeat',inf);

start(AI);

AI1=getdata(AI,l*Fe*(d-1),'double');
AI2=AI1(:,2); %Only interested by the 2nd channel

%--------------------
% buffering |
AIbuff = buffer(AI2,l*d*Fe,l*Fe*(d-1));

Followed by a few analyses...

I hope I've been as clear as possible and I'll be pleased to answer to any questions.

Aurèle.