Adding a BiQuad filter to the Long Delay demo

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
millenliam
Member++
Posts: 23
Joined: Fri Feb 14, 2014 2:51 pm
Contact:

Adding a BiQuad filter to the Long Delay demo

Post by millenliam »

Hey
I'm attempting to merge the app_slicekit_biquad project with the app_slicekit_long_delay project so that the delayed signal will have a filter applied to it.

When I'm only delaying the signal or only filtering the signal all works fine, however when I try to combine both processes the audio signal goes all glitchy/distorted.

Is this because the filtering process needs to run on it's own core? If so, how do I modify the project so that I can set this?

Thanks.


User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm
Contact:

Post by johned »

Hi Liam,

In theory it would be possible to implement both of these on a single core but you should check issues such as available MIPS and memory i.e. depending on your sample rates, filter lengths etc. you may use up all of the MIPS available.

Hopefully the links I sent you in my reply to your earlier question will help with this but I'll monitor the thread in case you have any further questions.

All the best,
John
User avatar
millenliam
Member++
Posts: 23
Joined: Fri Feb 14, 2014 2:51 pm
Contact:

Post by millenliam »

Hey John,
Thanks for the response.

In the end I got this working by putting the filtering on it's own core, though I'd be interested to find out if I am able to put it all on the same core.

Thanks for the DSP links too - I'll look into improving the filtering algorithm.

A couple of other issues (though slightly off topic) I've experienced since posting this question that I was wondering if you could help me with:

1. My delay effect app is now running a 5th process on it's own core for providing the wet and dry audio signals with independent gain controls. Originally this process was being run on tile 0 of the sliceKIT board, however this was causing occasional random garbage on the right audio channel, but moving this to tile 1 (which includes all the other processes other than the filtering) has fixed this problem. Any idea why this being on tile 0 was causing this problem?

2. I've started to notice that certain delays times are causing a brief 'test-tone' like sound. This has become more apparent within a Flanger effect I'm working on where I'm modulating the delay time with an LFO. In regards to reading and writing audio samples to the buffer/RAM I'm just using the code from the sliceKIT long delay demo app. Any idea what could be causing these unwanted sounds?

Thanks,
Liam.
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm
Contact:

Post by johned »

Hi Liam,

I am sure you would be able to put the delay and filtering on the same core but it would depend on the MIPS available and also the architecture regarding the xCONNECT links.

For 1 and 2, these could also be related to the xCONNECT links or maybe a memory issue.

For both the above you might like to use the -report command line option and see what the compiler reports.

All the best,
John
User avatar
millenliam
Member++
Posts: 23
Joined: Fri Feb 14, 2014 2:51 pm
Contact:

Post by millenliam »

Hey John

Please excuse my lack of knowledge of xtimecomposer, but can you please explain how I can use the -report command line option?

Thanks,
Liam.
markb
Member++
Posts: 18
Joined: Tue Oct 08, 2013 1:53 pm

Post by markb »

Hi Liam,

-report tells the compiler (xcc) to "Display a summary of resource usage"
e.g.
Constraint check for "tile[0]" (node "0", tile 0):
Cores available: 8, used: 2 . OKAY
Timers available: 10, used: 3 . OKAY
Chanends available: 32, used: 5 . OKAY
Memory available: 65536, used: 12108 . OKAY
(Stack: 1828, Code: 8636, Data: 1644)
Constraints checks PASSED.
Constraint check for "tile[1]" (node "1", tile 0):
Cores available: 8, used: 6 . OKAY
Timers available: 10, used: 7 . OKAY
Chanends available: 32, used: 23 . OKAY
Memory available: 65536, used: 60836 . OKAY
(Stack: 28848, Code: 26248, Data: 5740)
Constraints checks PASSED.

On the command line, for more info type
xcc --help

Regarding your previous problems, have a look at the application
sw_audio_effects/app_slicekit_long_reverb
this combines a long-delay and a filter.

When 'strange noises' appear, they could be due to reading the wrong area of memory.
If you write zero's to the whole SDRAM before starting your program, do the noise disappear?


Cheers Mark_B
User avatar
millenliam
Member++
Posts: 23
Joined: Fri Feb 14, 2014 2:51 pm
Contact:

Post by millenliam »

Hey Mark

Ah ok.
I'm guessing this is the same info that I'm being displayed when I build my project within xtimecomposer. Everything here passes, apart from occasionally the 'memory used' parameter displays something like '19512+ MAYBE'.

Yes I ended up using the reverb example app to add a filter to me delay - this has been working fine for me.

I've tried initialising the SDRAM with all zeros but this doesn't seem to fix the noise problem, but I'm starting to think that it's a problem with my delay algorithm. Using the long delay example as a template, I've created a stereo delay algorithm with two delay lines/tap - line 1 is for the left channel and line 2 is for the right channel, with each delay line having it's own delay time and feedback values. I seem to be getting this weird test-tone-like sound if either of the delay time sample values are of a division of 4000 (e.g. 24000, 32000, 40000); possibly something to do with the sampling frequency which is currently 48000? However when I disable the buffer reading for the second delay line this problem doesn't appear.
Does anything there raise any obvious flags?

Thanks,
Liam
User avatar
millenliam
Member++
Posts: 23
Joined: Fri Feb 14, 2014 2:51 pm
Contact:

Post by millenliam »

I'm also getting this strange noise issue if both delay lines have the same delay time sample value.

It's also worth noting that along with this high tone sound it also causes all audio to go distorted, which I've experienced before when using up the processing resources of a core.
markb
Member++
Posts: 18
Joined: Tue Oct 08, 2013 1:53 pm

Post by markb »

Hi Liam,

It is difficult to know exactly where the problem may be with-out some sort of flow-diagram for your audio data. However, a number a thinks to check would be ...

1) The test tone type noises could be produced by writing/reading the memory at the wrong time.
E.g. With a sample frequency of 48kHz, a 1kHZ tone would be created if 48 samples are looped.

2) Are you inadvertantly tapping off left channel data and then feeding it into the right delay channel (and vice versa), this will create a fast loop giving a test tone?

3) When you have complex delay loops and feedback, you could be trying to read data, before it has been written.

4) Are you trying to use one area of memory for storing both left and right channels?

Cheers Mark_B
User avatar
millenliam
Member++
Posts: 23
Joined: Fri Feb 14, 2014 2:51 pm
Contact:

Post by millenliam »

Hey Mark

I've finally figured out what was causing the problem, but have no idea why.

There was a problem with this line in my delay algorithm:

Code: Select all

//Add the processed samples mutiplied by a feedback value to the input samples...
cntrl_gs.src_set.samps[chan_cnt] += delayed_set_s.samps[chan_cnt] * cur_param_s.feedback[chan_cnt];
where cur_param_s.feedback[chan_cnt] is a R32_T value between 0 and 0.99.

If I change this line to something like:

Code: Select all

//Add the processed samples mutiplied by a feedback value to the input samples...
cntrl_gs.src_set.samps[chan_cnt] += delayed_set_s.samps[chan_cnt] / 2;
where '2' is the new feedback value and I'm using division instead of multiplication, the test tone doesn't appear when the delay time sample value is set to 8000/16000/24000/32000 etc…

Is this an issue to do with using fixed-point audio sample data rather than floating-point?
Any idea why this could have caused delay times of 8000 sample divisions to cause this tone?

Most importantly, how can I go about applying a gain/feedback value if I can't multiply or can't divide by a float? The above example would only give me a gain value of 0.5, but I need to be able to go up to 0.99.

Thanks,
Liam.
Post Reply