Filter löschen
Filter löschen

streaming sound in realtime

2 Ansichten (letzte 30 Tage)
Partha Ghosh
Partha Ghosh am 15 Aug. 2011
I want to stream sound from the microphone,perform some processing on it(though i have done nothing in this code here) and play it back.The lower the phase lag the better it serves me(less than a millisecond(For when i'm using 1000 HZ audio)is needed).(Initial phase i haven't taken care of that much though it can be reduced)To achieve that i tried the following code, but if you run it u may see that the phase lag is increasing as time goes on!!! and that should be also because of 600 additional data in 13 line is introduced! But if i don't do that the buffer runs out of data. So what do you suggest?
clc
clear all
close all
ao = analogoutput('winsound');
addchannel(ao,1:2);
data=wavrecord(11025,11025,1);
set(ao,'SampleRate',11025);
set(ao,'SamplesOutputFcnCount',1);
putdata(ao,[data data]);
start(ao)
for i=1:100000
clear data
data=wavrecord(5512,11025,1);
data=[data;data(4912:5512)];
putdata(ao,[data data])
end

Akzeptierte Antwort

Daniel Shub
Daniel Shub am 2 Sep. 2011
You will probably have better control if you use the DAQ toolbox for everything (i.e create an analogoutput and an analogutinput object) instead of mixing it with wavrecord. That said, if you want reasonable good sound streaming you have to switch to port audio.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 15 Aug. 2011
Please see this previous discussion
Short answer: 1 ms is not feasible with that configuration.
  1 Kommentar
Partha Ghosh
Partha Ghosh am 2 Sep. 2011
ok if 1ms is too short for matlab, lets forget about the phase shift. CAN YOU MAKE SOMETHING WICH WILL STREAM AUDIO SMOOTHLY? i mean some way in which i neednt do the following silly thing!!
data=[data;data(4912:5512)];
about 400 false data eachtime!!
thanks

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Audio Processing Algorithm Design finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by