# Query how Juce reorders channels

**URL:** <https://forum.juce.com/t/query-how-juce-reorders-channels/50333>\
**Category:** General JUCE discussion\
**Created:** [February 23, 2022, 8:16pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333 "2022-02-23T20:16:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 23, 2022, 8:16pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/1 "2022-02-23T20:16:32Z")

</div>

Hi everyone,

is there a way to query how juce internally reorders the input and output channel to convert from the internal speaker layout to those used in the hosts, like Logic for example?

I want to check this to actually have my meters move on channel 1 when the hosts meter also moves on channel 1 etc. It is also important for me to know this because I want to provide the user a channel assignment feature for the inputs which of course must reflect the incoming channels.

Best,

Thomas

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 23, 2022, 8:49pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/2 "2022-02-23T20:49:17Z")

</div>

JUCE channels are ordered using `AudioChannelSet`. You can query the `AudioChannelSet` for each bus from the `AudioProcessor`, and use `AudioChannelSet::getTypeOfChannel(int)` to find the kind of channel at a specific index in the bus.

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 23, 2022, 9:23pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/3 "2022-02-23T21:23:11Z")

</div>

Hi reuk,

hm, let me give you an example. In Logic pro the Quadro channel set is ordered from 1-4 like this:  
LS, L, R, RS. In Juce however the order is L, R, LS, RS and juce then converts back and forth.

I need the info about what is converted to what as int. That means, what juce internal channel nr. corresponds to which channel nr. in Logic?

Is that available in AudioChannelSet?

Thanks.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 23, 2022, 9:43pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/4 "2022-02-23T21:43:27Z")

</div>

I don’t think it necessarily makes sense to think about the ‘channel number’ in Logic. Instead, you should probably use the ‘channel type’ to differentiate channels. You can query the channel type of a particular channel using `getTypeOfChannel`, or find the index of a particular channel type using `getChannelIndexForType`.

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 23, 2022, 10:03pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/5 "2022-02-23T22:03:53Z")

</div>

In my case it makes sense. Otherwise I would not ask.

In the example I gave in my previous post, how could I implement multichannel metering which moves in the same way as the multichannel metering on the logic channel? Meaning, if channel 1 moves in the plugin it should also be channel 1 in Logic, etc…

And metering is just an example.

By trying to take off the burden of thinking about channel order of the Juce user through this channel reordering abstraction layer, this problem now arises. Except I could switch off the reordering or get the info about which channel nr. in Juce is mapped to which channel nr. in Logic/Protools/etc…

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 23, 2022, 10:12pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/6 "2022-02-23T22:12:12Z")

</div>

Another problem is also that in certain layouts the azimuth values of L and R are 30° or -30°, while in others 45° and -45°. The channel type is not telling me anything about that. So I need to create a solution for that by myself to have correct rendering.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 24, 2022, 12:10pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/7 "2022-02-24T12:10:32Z")

</div>

> [@fiedleraudio](#):
>
> In the example I gave in my previous post, how could I implement multichannel metering which moves in the same way as the multichannel metering on the logic channel? Meaning, if channel 1 moves in the plugin it should also be channel 1 in Logic, etc…

There’s no way to do this. The channel order that Logic displays in its UI does not correspond to the channel order that is passed to the plugin’s processing callback, and there’s no way to query the order in which channels are displayed in the host UI.

Instead, a better approach is to pick a channel order that you want to use in your plugin (e.g. LS L C R RS LFE) and then to use `getChannelIndexForType` to find the index of the channel with a particular type. As long as the channel meters are labelled clearly, the channel ordering will be obvious to the user.

I checked out a couple of 5.1 AU plugins in Logic. FabFilter ProQ 3 displays the channels in the order `L C R LS RS LFE`, and Izotope Neutron 3 uses `L R C LS RS LFE`. Both of these layouts differ from Logic’s built-in Level Meter, which uses `LS L C R RS LFE`. In all cases, the interface is easy to understand because the meters are clearly labelled.

Unfortunately I don’t think there’s a way to query the speaker locations/angles using the current JUCE API.

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 24, 2022, 1:01pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/8 "2022-02-24T13:01:05Z")

</div>

So if i understand this correctly, Logic/AU is not communicating to Juce any kind of channel numbers associated with channel types, such as left, right etc.?

I know that I currently have no way of knowing anything about what Logic does from within the process callback or any other part of my PluginProcessor implementation. Thats why I ask. I also have the problem on the input side. On the input side the user of my plugin can choose what to do with each input channel, by number, not by name…

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 24, 2022, 1:06pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/9 "2022-02-24T13:06:29Z")

</div>

AU hosts pass the channels in an order specified by a channel tag, e.g. `kAudioChannelLayoutTag_MPEG_5_1_A` (L R C LFE LS RS). This channel layout is not guaranteed to match the layout displayed in the host’s UI. As far as I’m aware, there’s no way to query the channel number/order that a host uses in its UI.

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 24, 2022, 1:15pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/10 "2022-02-24T13:15:07Z")

</div>

Ok, got it. Now, for 5.1 Juce uses left, right, centre, LFE, leftSurround, rightSurround. Is there a way to query this conversion?

And, is this kind of conversion host specific or plugin format specific (VST3, AU, AAX)?

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 24, 2022, 1:25pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/11 "2022-02-24T13:25:15Z")

</div>

> [@fiedleraudio](#):
>
> Ok, got it. Now, for 5.1 Juce uses left, right, centre, LFE, leftSurround, rightSurround. Is there a way to query this conversion?

Yes; look at the documentation for AudioChannelSet. You can use `getChannelTypes` to find the types of the channels in the set, and their orders. You can also use `getTypeOfChannel` to find the type of a channel at a particular index; and `getChannelIndexForType` to find the index of a channel with a particular type.

> [@fiedleraudio](#):
>
> And, is this kind of conversion host specific or plugin format specific (VST3, AU, AAX)?

The ordering is consistent across hosts and plugin formats. A 5.1 layout will always use the order `L R C LFE LS RS`.

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 24, 2022, 1:32pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/12 "2022-02-24T13:32:30Z")

</div>

Sorry, but you just wrote that kAudioChannelLayoutTag\_MPEG\_5\_1\_A (L R C LFE LS RS).

This order is different from the Juce order. I need to query this conversion between this order and the Juce internal order.

`getChannelTypes`, `getTypeOfChannel` and `getChannelIndexForType` only refer to the Juce internal order, as far as i understand and this i already use. Or am i getting something totally wrong?

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 24, 2022, 1:50pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/13 "2022-02-24T13:50:43Z")

</div>

> [@fiedleraudio](#):
>
> I need to query this conversion between this order and the Juce internal order.

There’s no way to query the host’s original layout. It’s only possible to query the JUCE layout.

Can you give some more details about what you’re trying to achieve? At the moment, I don’t understand why you would need to query the host’s channel layout.

In case it wasn’t clear, the order in which the host passes channels to the plugin’s processing callback is likely to be different from the order in which the host displays those channels in its UI.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [February 24, 2022, 2:11pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/14 "2022-02-24T14:11:00Z")

</div>

There cannot be an answer, since the user can even change the displayed order of the channels:

 ![Bildschirmfoto 2022-02-24 um 15.08.19](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/7/789c7ac9a8257f7f61932168d818c36c9486faec.jpeg)

(Sorry for the German, I thought I had my system set to English UK…)  
Kanalreihenfolge == Channel order

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 24, 2022, 2:15pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/15 "2022-02-24T14:15:57Z")

</div>

@reuk Ok, got it. Well originally i wanted to make everything line up correctly, metering, input selection and output format. Since that idea just fell apart with the Logic meters having nothing to do with the actual channels I have to look for another way to do what I want without knowing the external format. But thanks for digging into this.

@daniel Danke für diese Info, kein Problem. 😉

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [February 24, 2022, 2:17pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/16 "2022-02-24T14:17:44Z")

</div>

Kein Problem 🙂

I would go the same route and offer the user those choices, so they can select their preferred order.  
Just save it in a PropertiesFile rather than in the plugin instance, so it becomes a global setting for your plugin.

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 24, 2022, 2:20pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/17 "2022-02-24T14:20:18Z")

</div>

Nah, since this only makes sense for Logic, not worth the effort. Other DAWs don’t care about this or do it another way so I do not want to create too much dependency on DAW specifics. The plugin I am developing is already complex.

---

<div class="post-metadata">

**Author:** ![fiedleraudio](https://avatars.discourse-cdn.com/v4/letter/f/5daacb/32.png) [@fiedleraudio](https://forum.juce.com/u/fiedleraudio)\
**Post date:** [February 24, 2022, 8:35pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/18 "2022-02-24T20:35:43Z")

</div>

@reuk Ok, so i am doing some further testing with Logic and hell, things seem to be wrong. Here it comes:

LCRS in Logic is identified as Quadraphonic  
6.1 (ES/EX) in Logic is identified as 7.0 Surround  
7.1 (SDDS) in Logic is identified as 7.1 Surround  
5.1.2 in Logic is identified as 7.1 Surround  
5.1.4 in Logic is identified as Discrete #10  
7.1.2 in Logic is identified as Discrete #10  
7.1.4 in Logic is identified as Discrete #12

Logic 10.7.2 and Juce master 6.1.5

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [February 25, 2022, 8:14pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/19 "2022-02-25T20:14:50Z")

</div>

See also:

> [@Logic Pro wrong channel layouts](https://forum.juce.com/t/logic-pro-wrong-channel-layouts/50358/5):
>
> I’ve lost the best part of a day to this issue, but I think it does mostly work after all. Logic caches channel layouts of plugins in a slightly obscure way that doesn’t always seem to be cleared by running killall -9 AudioComponentRegistrar. This means if you modify the isBusesLayoutFunction and reload the plugin in Logic, it’s not guaranteed to query the allowed bus configurations. I think I must have accidentally tested and debugged with a plugin that had cached channel information. After cha…

---

<div class="post-metadata">

**Author:** ![dylanmach1](https://avatars.discourse-cdn.com/v4/letter/d/4bbf92/32.png) [@dylanmach1](https://forum.juce.com/u/dylanmach1)\
**Post date:** [January 31, 2024, 6:51pm UTC](https://forum.juce.com/t/query-how-juce-reorders-channels/50333/20 "2024-01-31T18:51:34Z")

</div>

sorry to resurrect this but I still am confused with the implementation of this and why this cannot be achieved

to give an example i know that in PT on a 7.1 bus the index is expected as:

```auto
[0] = juce::AudioChannelSet::ChannelType::left;
[1] = juce::AudioChannelSet::ChannelType::centre;
[2] = juce::AudioChannelSet::ChannelType::right;
[3] = juce::AudioChannelSet::ChannelType::leftSurroundSide;
[4] = juce::AudioChannelSet::ChannelType::rightSurroundSide;
[5] = juce::AudioChannelSet::ChannelType::leftSurroundRear;
[6] = juce::AudioChannelSet::ChannelType::rightSurroundRear;
[7] = juce::AudioChannelSet::ChannelType::LFE;

```

however when checking for non-discrete channel layouts via the suggested `getTypeOfChannel(int index)` I get this returned:

```auto
[0]	juce::AudioChannelSet::ChannelType::left
[1]	juce::AudioChannelSet::ChannelType::right
[2]	juce::AudioChannelSet::ChannelType::centre
[3]	juce::AudioChannelSet::ChannelType::LFE
[4]	juce::AudioChannelSet::ChannelType::leftSurroundSide
[5]	juce::AudioChannelSet::ChannelType::rightSurroundSide
[6]	juce::AudioChannelSet::ChannelType::leftSurroundRear
[7]	juce::AudioChannelSet::ChannelType::rightSurroundRear

```

previously i had to maintain an ever growing list of what each DAW expects the order of each channel layout for non-discrete multichannel formats and I dont understand why this cant be maintained in JUCE since thats what some of the functions in `AudioChannelSet` led me to believe was possible, happy to hear more of a picture outside of this case but ultimately im not sure i understand what the purpose of `getTypeOfChannel(int)` is if it can report back an incorrect order

also I understand that some host settings can change the channel order outside the scope/view of the plugin SDK, but at the very least in PT (as an example) the order that function returns is never correct as far as I can see and I don’t see why it cant at least capture the default known layout order and let this become a function needed from the AAX SDK side

[Next page](https://forum.juce.com/t/query-how-juce-reorders-channels/50333.md?page=2)
