charanbandi
Junior Member level 1
I have been working on my ANC project. For this I have two microphone inputs and one loud speaker output, but initially I am using single microphone and dspStreamingPassthrough to pass microphone input to loud speaker. Here is my code
I am using Windows DirectSound Audio driver ( I cannot use ASIO driver as I cannot access individual audio devices names. ! ) Now I have the audio latency of 1.2 seconds i.e if I say ''hello'' in microphone now, after 1.2 seconds speaker is saying ''hello''(this is absolutely with out any audio input data processing just 'dspStreamingPassthrough'). How to reduce this incredible delay ?
For my project of 1 meter length pipe(air duct), I should be able to process the data in 1.7 msec or less !! I have tried with lowest 'BufferSize' and lowest 'QueueDuration' possible !!
What other parameters can influence to speed up this process? Is it possible with MATLAB or not ?
PS: -sorry for whole code. -I am using a cheap quality Sound card (7 euros)
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 { % Initialization numIterations = 500; % Construct sources (for all inputs) src1 = dsp.AudioRecorder('DeviceName','Mikrofon (USB-Audiogerät)','NumChannels',1); % Construct sinks (for all outputs) sink1_1 = dsp.SpectrumAnalyzer('SampleRate',44100, ... 'PlotAsTwoSidedSpectrum',false, ... 'ShowLegend',true); sink1_2 = dsp.TimeScope('BufferLength',44100, ... 'SampleRate',44100, ... 'TimeSpan',1, ... 'ShowLegend',true, ... 'ShowGrid',true, ... 'YLimits',[-0.5 0.5]); sink1_3 = dsp.AudioPlayer('BufferSizeSource','Property','BufferSize',1024,... 'QueueDuration',0,'OutputNumUnderrunSamples',true); sink1_3.DeviceName = 'Lautsprecher (USB-Audiogerät)'; % Stream processing loop clear dspStreamingPassthrough; for i = 1:numIterations % Sources in1 = step(src1); % User Algorithm out1 = dspStreamingPassthrough(in1); % Sinks step(sink1_3,out1); step(sink1_1,out1); step(sink1_2,out1); nUnderrun=step(sink1_3,out1); end % Clean up release(src1); release(sink1_1); release(sink1_2); }
I am using Windows DirectSound Audio driver ( I cannot use ASIO driver as I cannot access individual audio devices names. ! ) Now I have the audio latency of 1.2 seconds i.e if I say ''hello'' in microphone now, after 1.2 seconds speaker is saying ''hello''(this is absolutely with out any audio input data processing just 'dspStreamingPassthrough'). How to reduce this incredible delay ?
For my project of 1 meter length pipe(air duct), I should be able to process the data in 1.7 msec or less !! I have tried with lowest 'BufferSize' and lowest 'QueueDuration' possible !!
What other parameters can influence to speed up this process? Is it possible with MATLAB or not ?
PS: -sorry for whole code. -I am using a cheap quality Sound card (7 euros)
Last edited by a moderator: