# A AU plugin has error with auval

**URL:** <https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049>\
**Category:** Audio Plugins\
**Created:** [February 19, 2023, 12:30pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049 "2023-02-19T12:30:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredofaure](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fredofaure/32/18205_2.png) [@fredofaure](https://forum.juce.com/u/fredofaure)\
**Post date:** [February 19, 2023, 12:30pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/1 "2023-02-19T12:30:19Z")

</div>

Hello, i have a AU plugin midi to midi, on Mac OS that works fine with Juce\_Host, but I don’t see it proposed with garageband.  
The command:

```auto
 auvaltool -v aumi Cbcj Manu

```

gives an error:

```auto

--------------------------------------------------
VERIFYING DEFAULT SCOPE FORMATS:
Input Scope Bus Configuration:
 Default Bus Count:0

Output Scope Bus Configuration:
 Default Bus Count:1
    Default Format: AudioStreamBasicDescription: 2 ch, 44100 Hz, Float32, deinterleaved

ERROR: Default Format of unit does not match reported Channel handling capabilities
* * FAIL
AU VALIDATION FAILED: CORRECT THE ERRORS ABOVE.

```

But I don’t understand this error. Do you have an idea please?

---

<div class="post-metadata">

**Author:** ![marcushobbs](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/marcushobbs/32/4982_2.png) [@marcushobbs](https://forum.juce.com/u/marcushobbs)\
**Post date:** [September 16, 2023, 7:42pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/2 "2023-09-16T19:42:13Z")

</div>

I’m getting the same error. Has anyone else seen this before?

---

<div class="post-metadata">

**Author:** ![battaglia01](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@battaglia01](https://forum.juce.com/u/battaglia01)\
**Post date:** [May 24, 2024, 7:07pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/3 "2024-05-24T19:07:15Z")

</div>

Same thing here, and it’s even happening with a totally default MIDI Plugin:

```auto
VERIFYING DEFAULT SCOPE FORMATS:
Input Scope Bus Configuration:
 Default Bus Count:0

Output Scope Bus Configuration:
 Default Bus Count:1
    Default Format: AudioStreamBasicDescription: 2 ch, 44100 Hz, Float32, deinterleaved

ERROR: Default Format of unit does not match reported Channel handling capabilities
* * FAIL

```

Here’s the settings I used:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/c/c/cccf950df3da9e22ddd4b0d8f299916bc0b32f8f.png)

This is probably related to another bug I’ve noticed, which is that MIDI Processor effects seem to always have a stereo output bus when loaded in AudioPluginHost.

---

<div class="post-metadata">

**Author:** ![battaglia01](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@battaglia01](https://forum.juce.com/u/battaglia01)\
**Post date:** [May 24, 2024, 7:19pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/4 "2024-05-24T19:19:26Z")

</div>

As a quick workaround, actually setting {0, 2} in “Plugin Channel Configurations” seems to get it to pass auval, but I don’t get why it’s generating this spurious output bus at all. I would think this is some bug with JUCE. Who is the right person to direct this to? @dave96 ?

---

<div class="post-metadata">

**Author:** ![battaglia01](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@battaglia01](https://forum.juce.com/u/battaglia01)\
**Post date:** [May 24, 2024, 7:38pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/5 "2024-05-24T19:38:16Z")

</div>

Figured it out. There’s basically this:

```auto
    JuceAU (AudioUnit component)
        : MusicDeviceBase (component,
                           (UInt32) AudioUnitHelpers::getBusCountForWrapper (*juceFilter, true),
                           (UInt32) AudioUnitHelpers::getBusCountForWrapper (*juceFilter, false))
    {
        // ...
    }

```

Which calls this:

```auto
    static int getBusCountForWrapper (const AudioProcessor& juceFilter, bool isInput)
    {
       #if JucePlugin_IsMidiEffect
        const auto numRequiredBuses = isInput ? 0 : 1;
       #else
        const auto numRequiredBuses = 0;
       #endif

        return jmax (numRequiredBuses, getBusCount (juceFilter, isInput));
    }

```

So we have `numRequiredBuses = 1` for the output for MIDI effects. I’m not sure why; maybe AU MIDI processors require this or something. But then later we call this

```auto
    static Array<AUChannelInfo> getAUChannelInfo (const AudioProcessor& processor)
    {
        Array<AUChannelInfo> channelInfo;

        auto hasMainInputBus = (AudioUnitHelpers::getBusCountForWrapper (processor, true) > 0);
        auto hasMainOutputBus = (AudioUnitHelpers::getBusCountForWrapper (processor, false) > 0);

        if ((! hasMainInputBus) && (! hasMainOutputBus))
        {
            // midi effect plug-in: no audio
            AUChannelInfo info;
            info.inChannels = 0;
            info.outChannels = 0;

            return { &info, 1 };
        }
    // ... all kinds of stuff ...
    }

```

And it turns out that `hasMainOutputBus` is always set to 1, even if it is a MIDI effect plugin. So, the `if` statement which seems intended to run for MIDI effects doesn’t actually run.

Because of a fairly elaborate sequence of things thereafter, `JuceAU::channelInfo` is then set incorrectly unless `{something, 2}` is manually specified in Plugin Channel Configurations. Just having `isBusesLayoutSupported()` always `return true;` which is what’s happening currently for MIDI effects, doesn’t work.

I would guess that what’s happened is initially it wasn’t required to have an output bus for MIDI effects, and then for some reason that requirement was added - but certain parts of the rest of the library still assume that MIDI effects have no output bus.

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [May 24, 2024, 7:46pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/6 "2024-05-24T19:46:54Z")

</div>

Looks like some great investigative work, thanks. I’ll pass this on to the team. We’ll try and take a look at this at some point but I can’t promise when that will be right now.

---

<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:** [May 29, 2024, 12:55pm UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/7 "2024-05-29T12:55:51Z")

</div>

> [@battaglia01](#):
>
> This is probably related to another bug I’ve noticed, which is that MIDI Processor effects seem to always have a stereo output bus when loaded in AudioPluginHost.

This isn’t a bug. As far as I’m aware, there’s no way for an AUv2 plugin to determine the current processing samplerate unless it has an output bus. The bus is required in order for the plugin to function correctly.

> [@battaglia01](#):
>
> I would guess that what’s happened is initially it wasn’t required to have an output bus for MIDI effects, and then for some reason that requirement was added - but certain parts of the rest of the library still assume that MIDI effects have no output bus.

That’s correct. Originally JUCE AU MIDI FX did not have an output bus, but they also frequently misreported the current sampling rate, leading to incorrect playback. I missed the check in `getAUChannelInfo` when adding the new bus. I believe this can be fixed just by returning an AUChannelInfo of `{ 0, -1 }` when the plugin is a MIDI effect. We’ll get that merged shortly. In the meantime, it would be helpful if you could test out that change and see whether it resolves the issue for you.

---

<div class="post-metadata">

**Author:** ![battaglia01](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@battaglia01](https://forum.juce.com/u/battaglia01)\
**Post date:** [June 2, 2024, 4:42am UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/8 "2024-06-02T04:42:27Z")

</div>

@reuk Thanks, makes sense. Where would this be returned?

---

<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:** [June 27, 2024, 10:23am UTC](https://forum.juce.com/t/a-au-plugin-has-error-with-auval/55049/9 "2024-06-27T10:23:02Z")

</div>

Thanks for your patience, a fix for this issue is now available on the develop branch:

> <https://github.com/juce-framework/JUCE/commit/a66fd53630a5697d65f986f8668ec29ceadc5559>
>
> Previously, MIDI FX would report an input and output channel count of 0.
> However…, a non-empty output bus is required in order to retrieve the
> processing sample rate.
> 
> With this change in place, MIDI FX plugins will now report an output
> channel count of -1, which indicates that any number of output channels
> is valid.
