# \[FR\] Cannot convolve mono input thru stereo IR

**URL:** <https://forum.juce.com/t/fr-cannot-convolve-mono-input-thru-stereo-ir/52141>\
**Category:** General JUCE discussion\
**Created:** [July 8, 2022, 8:55pm UTC](https://forum.juce.com/t/fr-cannot-convolve-mono-input-thru-stereo-ir/52141 "2022-07-08T20:55:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![p-i](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/p-i/32/1785_2.png) [@p-i](https://forum.juce.com/u/p-i)\
**Post date:** [July 8, 2022, 8:55pm UTC](https://forum.juce.com/t/fr-cannot-convolve-mono-input-thru-stereo-ir/52141/1 "2022-07-08T20:55:24Z")

</div>

I’m encountering a gotcha in JUCE’s `dsp::Convolution`

This assert-fails (`numInputChannels != numOutputChannels`) within the JUCE code:

```auto
        juce::dsp::ProcessContextNonReplacing<float> ctx(mono_in, stereo_out);
        convolver.process(ctx);

```

As a workaround I’ve done this:

```auto
    void feed(const dsp::AudioBlock<float> in_mono)
    {
        const float* pointers[] = {
            in_mono.getChannelPointer(0),
            in_mono.getChannelPointer(0)
        };

        AudioBlock<float>tmpBlk((float * const *)&pointers, 2, (int)in_mono.getNumSamples());
        auto outBlock = getOutBlock();

        juce::dsp::ProcessContextNonReplacing<float> ctx(tmpBlk, outBlock);
        convolver.process(ctx);
    }

```

(`const`s are not required, it seems)

It avoids allocation or even copying. But it’s clumsy.  
Please can we have a fix for this teamJUCE? This is a beautiful component.

There’s another lesser issue: I can’t supply rValues. `ctx(getSrcBlock(), getDstBlock())` fails. I think that should be fixable with `&&`.

NOTE: Maybe clearer to write `add_pointer_t<const add_pointer_t<float>>` instead of `float * const *`

Ref: [Copy block (mono-\>stereo)](https://forum.juce.com/t/copy-block-mono-stereo/30809)

---

<div class="post-metadata">

**Author:** ![p-i](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/p-i/32/1785_2.png) [@p-i](https://forum.juce.com/u/p-i)\
**Post date:** [July 9, 2022, 9:12pm UTC](https://forum.juce.com/t/fr-cannot-convolve-mono-input-thru-stereo-ir/52141/2 "2022-07-09T21:12:19Z")

</div>

This code is cleaner (and works):

```auto
        float* pointers[] = {
            in_mono.getChannelPointer(0),
            in_mono.getChannelPointer(0)
        };

        AudioBlock<float>tmpBlk(pointers, 2, in_mono.getNumSamples());

```

The original code was poor form. It works because for `T arr[];`, both `arr` and `&arr` give the same memory address.
