map audio n channels to m audio channels

Roman Thilenius's icon


one of the many things on my to do list is to make a generic abstraction for mapping a matrix of audio channels to another matrix.

while it is easy for "2 into 4" or "6 into 3", i never managed to find the correct math for "11 into 19".

the most basic setup of mapping a number of inputs into a number of outputs is a simple as that:


any input is connected to any output and then the amplitude change has to be calculated.

(amplitudes of 0 can later still be used to script-delete the non-used parts, we dont need to worry about this kind of stuff atm.)

in the past i´ve tried that several times and with quite different approaches, but i think i have blockades there for some reason.

maybe somenbody knows by heart?

let me know if any info is missing...

Roman Thilenius's icon


not all at once please, i can´t read so much stuff.

Dimitri Aatos's icon

how do you handle the amplitudes in cases where m is not a multiple of n? for example 2 into 3.

Roman Thilenius's icon


it is difficult to explain (which i why i didnt find the expression yet). the individual channels represent the space between the channels. together they represent the whole field. so the weighting depends on the position / how many channels there are. imagine 7 water canals split into 11. each of the incoming has the same amplitude, each of the outcoming should have that too.

Dimitri Aatos's icon

Can you give an example with amplitude values?
What would you put in these number boxes?

Source Audio's icon

If you imagine 7 amps/loudspeakers positioned in a circle as "surround" installation,
and you play some audio channels into them, pan arround etc
Then you want to reproduce exactly same hearing experience,
using same 7 channel source, but this time output to 11 amps/speakers
positioned in a circle ...
Sound should spread into space same way, but 360 degrees
get divided into 11 slices instead of 7, and overall power should
match between the 2 variants, means reduction in amplification
with 11 speakers variant, because more amps would get involved when covering
a range in the circle.
7 / 11 = 0.636
now how do we route the channels ?
channel 1 should be sent to channels 2 and 11
1 * 0.318
2 * 0.159
11 * 0.159
a narrow variant
1 * 0.4
2 * 0.118
11 * 0.118
----------------
or something in between ...

Dimitri Aatos's icon

I see, I'll give it some thought.

Roman Thilenius's icon


source audio has it right.

for m beeing less than 2*n and no offset (first in/out is at the same position), the 2 neighbours are getting n/(m/2) amplitide of input and that´s it.
then you can "move the rests" to the next outputs and everyrhting will magically sum up to the same output amplitudes.

and the "radial" version will be simpler than the "line" version, and you may leave out the weighting (amplitude*in/out), too.

but of course this approach of looking at it and beeing clever does not really describe what is happening. you wont be able to the same thing for 413 into 34 via mental arithmetic.

when i try to find a general description in german or english, i always get stuck at one point.

Roman Thilenius's icon


for example i use this for the 1 to m conversion for VBAP. (inserting a mono source into a soundfield in a channel based format).

it would work for n to m, too.



the first input is the degree/position/number of the outputchannel, everything else are constants.

the n to m thing should be much, much simpler, since it kinda has a square window.

it should fit all into one expr in/out-(a *whatnot+offset)

Source Audio's icon

I must confess that my personal interest in any kind of channel mappig
is restricted to what I experienced in real life use, and I am not interested at all
to calculate any soundfield, theoretical calculations to get perfect distance, relations or anything like that.
Most I ever got envolved in, was project for 2 x quad installation, one above the other,
and doing some pan/up down mix thingy to it, but at the end all that possibly perfect calculations will again
fail ( I mean will turn to sound in a different way than expected) because of real world environment, speaker characteristics, room reflections, people populating the room or hall etc etc.
At the end one is satisfied if all cables are in perfect condition, no amp fails,
everything sounds acceptable, and public more or less realises that there is some
sound movement in the room.
That is the reason I did not reply to the initial post.
Because I have no idea...

Roman Thilenius's icon


there were no answers because my question was shit.

i am not even able to formulate what i want. if i knew, i could easily code it. it is like chasing your own tail.

it all about amplitudes. we could approach it using floats (and stop thinking about signals) as well.

Jan M's icon

Not sure if this is actually a contribution to the topic aka not sure if I understand you right.so… thinking: The MIAP system from Meyer Sound - there is also a great port to Max available - uses a simplified formula based on the space devided into triangles for 1 to m channel mapping. Maybe some inspiration could be found there…..
The MIAP approach follows more Source Audio’s line of: maybe not theoretically correct but as long as it works afaiu …
and in case I am am off topic just ignore my reply ;)

Roman Thilenius's icon