필터 지우기
필터 지우기

streaming sound in realtime

조회 수: 2 (최근 30일)
Partha Ghosh
Partha Ghosh 2011년 8월 15일
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

채택된 답변

Daniel Shub
Daniel Shub 2011년 9월 2일
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.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 8월 15일
Please see this previous discussion
Short answer: 1 ms is not feasible with that configuration.
  댓글 수: 1
Partha Ghosh
Partha Ghosh 2011년 9월 2일
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

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

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by