Dsp lib: function dsp_adaptive_lms() have undesired outpu Topic is solved

Voice related projects and technical discussions
link0513
Member++
Posts: 26
Joined: Tue Jul 02, 2019 8:38 am

Dsp lib: function dsp_adaptive_lms() have undesired outpu

Post by link0513 »

I try to use adaptive filter to do some signal procession. When I input a 1K Hz sine data as input sample and reference sample for the dsp_adaptive_nlms(), return output is strange. I use printf to get the output data is all show 7FFFFFFF and 80000000. Whether do I misunderstand the function usage ? Please help.

adapt_array[128]= 7FFFFFFF 7FFFFFFF 80000000 7FFFFFFF 80000000 7FFFFFFF 80000000 8000000
0 80000000 7FFFFFFF 80000000 7FFFFFFF 7FFFFFFF 7FFFFFFF 80000000 80000000 7FFFFFFF 80000000 7FF
FFFFF 7FFFFFFF 7FFFFFFF 7FFFFFFF 80000000 80000000 7FFFFFFF 7FFFFFFF 80000000 7FFFFFFF 7FFFFFFF
7FFFFFFF 7FFFFFFF 7FFFFFFF 80000000 7FFFFFFF 80000000 80000000 7FFFFFFF 80000000 7FFFFFFF 7FFFF
FFF 7FFFFFFF 7FFFFFFF 80000000 80000000 7FFFFFFF 7FFFFFFF 80000000 80000000 7FFFFFFF 7FFFFFFF 7
FFFFFFF 7FFFFFFF 80000000 7FFFFFFF 7FFFFFFF 7FFFFFFF 80000000 80000000 80000000 80000000 7FFFFFF
F 7FFFFFFF 7FFFFFFF 7FFFFFFF
Last edited by link0513 on Fri Jul 05, 2019 1:30 am, edited 1 time in total.
View Solution
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Use of printf is blocking on the XMOS CPU. Please review the use of printf in real time application as documented here:

https://www.xmos.com/developer/debug-pr ... ion=X1093A

If this is not the issue, please post your code (and use the above code-format tags) for others to review and supply more ideas.
link0513
Member++
Posts: 26
Joined: Tue Jul 02, 2019 8:38 am

Post by link0513 »

Thanks. The problem is solved. The root of case is that I use Q28 format and cause the data overflow. I use Q31 is ok.
link0513
Member++
Posts: 26
Joined: Tue Jul 02, 2019 8:38 am

Post by link0513 »

Hi,when I input a voice data to the dsp_adaptive_lms for a time, the problem is reproduced and it keep output the noise even if stop the input.


below is part of code:

sample = old_sample;
sample1 = sample - preSample;
preSample = dsp_adaptive_lms(sample, sample1, &error_sample, coeffs, state, 100, Q31(0.01), 31);
old_sample = sample1;

return sample;