[Layout config] 2 mic + 1 speaker == 3 channels? or 2 HW inputs with 2 & 1 channel(s) each?

2 posts / 0 new
Last post
Last seen: 3 months 1 week ago
Joined: 03/09/2018 - 12:07am
[Layout config] 2 mic + 1 speaker == 3 channels? or 2 HW inputs with 2 & 1 channel(s) each?

I'm trying to design a system where we want to add in some sort of an echo cancellation block, which will need the output signal fed into the mic signal.

Should I go for single HW input with 3 channels in the layout? or two HW inputs with one for 2 mics and one for the speaker(output)?

Also, mics vs the speaker run in different sampling rate, so I'm hoping the latter case works.

If it doesn't (which the documentation seems to suggest), is there any way to handle the downsampling on the output signal inside the AWE core?

If it can't, my only option would be to perform downsampling outside the AWE core and then feed it to the AWE with DMA right?


Axel Nilsson
Last seen: 8 hours 28 min ago
Joined: 12/19/2016 - 2:02pm


Hi Mo, This is a great question. 

Generally, all your audio data needs to be synchronous; it can be different block-sizes, but it must be driven off the same master clock.  If your signals aren’t synchronous, an ASRC is required upstream of the AWE Core. (DSP Concepts sells a software ASRC library independently of AWE Core - please contact info@dspconcepts.com if you're interested in details on that.)

Typically, you’ll have just one HW input pin into an Audio Weaver system, and your firmware will interleave the data appropriately.  For example, if you had a stereo input and a mic input, all with the sample rate, your data would look like this:

[L0,R0,M0,  L1,R1,M1,  L2,R2,M2 ... L31,R31,M31] 

Then in you’re layout, you could use a Deinterleaver or Router module to separate out those channels.

If your input data is synchronous, but doesn’t have have the same block size, that’s ok, as long as you deal with that appropriately in the Layout.  There are a couple of ways to do this, depending on if you want to process at the higher or lower rate.

1. Zero fill in firmware:  In your code that copies from the DMA RX buffer into the AWE Core, upsample (insert 0's into) your lower sampling rate signal by N to match the higher sampling rate, SR.  e.g. If you had a mic running at ½ the rate of your stereo signal, it would look like this:

[L0,R0,M0,  L1,R1,0,  L2,R2,M1,  … L30,R30,M15,  L31,R31,0]

Then, in your Audio Weaver layout, you can split this channel off using a Router module and use the SetWireProperties module to “cast” that single channel to be 2 channels of with a sampling rate of SR/N and a block size of BS/N. The first channel of this modified wire will be your original signal at it's original sample rate and block size, which you can isolate again using a Router module.

2. Alternatively, outside of Audio Weaver, you can 'deinterleave' your higher-sample rate signal into L channels, where channel 1 is samples [1, L+1, 2L+1, 3L+1...], channel 2 is [2, L+2, 2L+2, 3L+1], etc. At this point, your input to Audio Weaver will have L extra channels for each of the original higher sample rate signals. Using a Router module, isolate the first L channels into a seperate wire, and the use SetWireProperties to override the number of channels to 1, the sampling rate to L*SR and the block size to BS*L. The resulting wire will be your original signal at the higher sampling rate. 

The 'deinterleave' portion of this method can be seen in the diagram below:

Note that for these two methods to work you must have synchronous audio signals - that is, your mic input and your stereo signal must come from the same clock source.