Borrar filtros
Borrar filtros

streaming sound in realtime

2 visualizaciones (últimos 30 días)
Partha Ghosh
Partha Ghosh el 15 de Ag. de 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

Respuesta aceptada

Daniel Shub
Daniel Shub el 2 de Sept. de 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.

Más respuestas (1)

Walter Roberson
Walter Roberson el 15 de Ag. de 2011
Please see this previous discussion
Short answer: 1 ms is not feasible with that configuration.
  1 comentario
Partha Ghosh
Partha Ghosh el 2 de Sept. de 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

Iniciar sesión para comentar.

Categorías

Más información sobre Audio Processing Algorithm Design en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by