<effect>
  <name>PConvXtended</name>
  <enabled>true</enabled>
  <numIns>2</numIns>
  <numOuts>2</numOuts>
  <code>if (&lt;PConvXtendedON&gt; == 1) then
    kwet    =   &lt;PConvXtended_wetDry&gt;                                                            ;mix wet/dry
    kdry    =   1 - kwet
    kwet    *=  &lt;PConvXtended_volume wet&gt;

    ivld      filevalid &quot;&lt;PConvXtended_impulseResponse&gt;&quot;                                                 ; check if valid impilse is imported
    if ivld &gt; 0 then
    iNrChannels filenchnls  &quot;&lt;PConvXtended_impulseResponse&gt;&quot;

    ipartitionsize = &lt;PConvXtended_paritionSize&gt;                                                 ;for best performance, this parameter needs to be tweaked

    idel    = (ksmps &lt; ipartitionsize ? ipartitionsize + ksmps : ipartitionsize)/sr ;calculate latency of pconvolve opcode

    prints &quot;Convolving with a latency of %f seconds%n&quot;, idel

        if (iNrChannels == 2) then
            awetl, awetr pconvolve    kwet*((ain1+ain2)*.5), &quot;&lt;PConvXtended_impulseResponse&gt;&quot;, ipartitionsize
        else
            awetl pconvolve    kwet*((ain1+ain2)*.5), &quot;&lt;PConvXtended_impulseResponse&gt;&quot;, ipartitionsize
            awetr = awetl
        endif

    if (&lt;PConvXtended_EQ_on&gt; == 1) then                                                          ;turn Equalizer on/off
        awetl eqfil awetl, 150, 80, &lt;PConvXtended_gain bass&gt;                                     ;3 band eq
        awetr eqfil awetr, 150, 80, &lt;PConvXtended_gain bass&gt;
        awetl eqfil awetl, 1200, 500, &lt;PConvXtended_gain mid&gt;
        awetr eqfil awetr, 1200, 500, &lt;PConvXtended_gain mid&gt;
        awetl eqfil awetl, &lt;PConvXtended_freq high&gt;, 3000, &lt;PConvXtended_gain high&gt;
        awetr eqfil awetr, &lt;PConvXtended_freq high&gt;, 3000, &lt;PConvXtended_gain high&gt;
    endif

    awetl   delay   awetl, i(&lt;PConvXtended_reflection&gt;)                                          ;early reflection
    awetr   delay   awetr, i(&lt;PConvXtended_reflection&gt;)

    adryl   delay   kdry * ain1, idel                                               ;delay dry signal, to align it with the convoled sig
    adryr   delay   kdry * ain2, idel

    aout1 = (adryl*2)+(awetl*.1)
    aout2 = (adryr*2)+(awetr*.1)

    else
        prints &quot;\n\n\nNO OR INVALID IMPULSE. PLEASE ENTER ONE!!\nEFFECT IS NOT WORKING, YOU HEAR THE DIRECT SIGNAL ONLY.\n\n\n&quot;
        aout1 = ain1
        aout2 = ain2
    endif

else
    aout1   =   ain1
    aout2   =   ain2
endif</code>
  <comments>
DESCRIPTION:

Convolution Effect using pconvolve opcode by Matt Ingalls
The code for this effect is based on code by Matt Ingalls found in the Csound Manual; please see the manual for more information regarding pconvolve.
Supports mono or stereo Impulse Response files.


CONTROLLERS:

ON/OFF          -       bypass
File Selector   -       import an impulse response
partisionsize   -       the size in samples of each partition of the impulse file
wet volume      -       gain of effect
ER              -       Early Reflection. The effect is delayed in time
Dry/Wet         -       mix direct signal with effect
Equalizer       -       on/off for equalizer section
high            -       set frequency and gain for highest frequencies
mid/bass        -       gain for fixed mid and bass frequency gain

---

version 1.22, July 2020
- added BSB information comments

version 1.21, May 2020
- added comments on controllers

version 1.2, February 2018
- added warning when no or invalid impulse sound is used
- if no or incorrect impulse, then the effect is bypassed

version 1.1, September 2017
- latest GUI (Blue 2.7.0 or greater)

version 1.0, februari 2017
- initial version by Menno Knevel
- Mix wet/dry fader can be moved while playing
- added wet volume to be set in order to prevent distortion of Impulse Response file
- added 3 way equalizer to spice up the Impulse Response file
- added Early Reflection


</comments>
  <opcodeList/>
  <graphicInterface editEnabled='false'>
    <gridSettings>
      <width>5</width>
      <height>2</height>
      <gridStyle>LINE</gridStyle>
      <snapGridEnabled>true</snapGridEnabled>
    </gridSettings>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
      <objectName></objectName>
      <x>0</x>
      <y>0</y>
      <groupName>Group</groupName>
      <backgroundColor>0x00000033</backgroundColor>
      <borderColor>0x000000ff</borderColor>
      <labelTextColor>0xffffffff</labelTextColor>
      <titleEnabled>true</titleEnabled>
      <width>20</width>
      <height>20</height>
      <bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
        <objectName></objectName>
        <x>10</x>
        <y>10</y>
        <groupName>Group</groupName>
        <backgroundColor>0x4d8080ff</backgroundColor>
        <borderColor>0x000000ff</borderColor>
        <labelTextColor>0xffffffff</labelTextColor>
        <titleEnabled>false</titleEnabled>
        <width>20</width>
        <height>20</height>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
          <objectName></objectName>
          <x>10</x>
          <y>10</y>
          <groupName>impulse</groupName>
          <backgroundColor>0x4d8080ff</backgroundColor>
          <borderColor>0x000000ff</borderColor>
          <labelTextColor>0xffffffff</labelTextColor>
          <titleEnabled>false</titleEnabled>
          <width>20</width>
          <height>129</height>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>455</x>
            <y>5</y>
            <label>ER</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
            <objectName>PConvXtended_wetDry</objectName>
            <x>105</x>
            <y>85</y>
            <comment>mix direct signal with effect</comment>
            <automationAllowed>true</automationAllowed>
            <minimum>0.0</minimum>
            <maximum>1.0</maximum>
            <bdresolution>0.01</bdresolution>
            <value>0.5</value>
            <sliderWidth>325</sliderWidth>
            <randomizable>true</randomizable>
            <valueDisplayEnabled>false</valueDisplayEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBFileSelector'>
            <objectName>PConvXtended_impulseResponse</objectName>
            <x>11</x>
            <y>23</y>
            <comment>import an impulse response</comment>
            <fileName>import impulse file</fileName>
            <textFieldWidth>400</textFieldWidth>
            <stringChannelEnabled>false</stringChannelEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>14</x>
            <y>93</y>
            <label>Wet/Dry Mix</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBDropdown' version='2'>
            <objectName>PConvXtended_paritionSize</objectName>
            <x>101</x>
            <y>64</y>
            <comment>the size in samples of each partition of the impulse file</comment>
            <automationAllowed>false</automationAllowed>
            <selectedIndex>10</selectedIndex>
            <fontSize>12</fontSize>
            <randomizable>true</randomizable>
            <bsbDropdownItemList>
              <bsbDropdownItem uniqueId='1881946695'>
                <name>1</name>
                <value>1</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946696'>
                <name>2</name>
                <value>2</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946697'>
                <name>4</name>
                <value>4</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946698'>
                <name>8</name>
                <value>8</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946699'>
                <name>16</name>
                <value>16</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946700'>
                <name>32</name>
                <value>32</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946701'>
                <name>64</name>
                <value>64</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946702'>
                <name>128</name>
                <value>128</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946703'>
                <name>256</name>
                <value>256</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946704'>
                <name>512</name>
                <value>512</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946705'>
                <name>1024</name>
                <value>1024</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946706'>
                <name>2048</name>
                <value>2048</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946707'>
                <name>4096</name>
                <value>4096</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946708'>
                <name>8192</name>
                <value>8192</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946709'>
                <name>16384</name>
                <value>16384</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946710'>
                <name>32768</name>
                <value>32768</value>
              </bsbDropdownItem>
              <bsbDropdownItem uniqueId='1881946711'>
                <name>65536</name>
                <value>65536</value>
              </bsbDropdownItem>
            </bsbDropdownItemList>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>14</x>
            <y>67</y>
            <label>Partition Size</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>105</x>
            <y>105</y>
            <label>Dry</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
            <objectName>PConvXtended_reflection</objectName>
            <x>450</x>
            <y>20</y>
            <comment>Early Reflection. The effect is delayed in time</comment>
            <automationAllowed>true</automationAllowed>
            <minimum>1.0E-4</minimum>
            <maximum>0.7</maximum>
            <bdresolution>0.1</bdresolution>
            <value>1.0E-4</value>
            <sliderHeight>90</sliderHeight>
            <randomizable>true</randomizable>
            <valueDisplayEnabled>false</valueDisplayEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
            <objectName>PConvXtended_volume wet</objectName>
            <x>280</x>
            <y>65</y>
            <comment>gain of effect</comment>
            <automationAllowed>true</automationAllowed>
            <minimum>0.0</minimum>
            <maximum>1.0</maximum>
            <bdresolution>0.1</bdresolution>
            <value>0.5</value>
            <sliderWidth>150</sliderWidth>
            <randomizable>true</randomizable>
            <valueDisplayEnabled>false</valueDisplayEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>400</x>
            <y>105</y>
            <label>Wet</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>200</x>
            <y>70</y>
            <label>Wet volume</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBGroup'>
          <objectName></objectName>
          <x>500</x>
          <y>10</y>
          <groupName>timbre</groupName>
          <backgroundColor>0x4d8080ff</backgroundColor>
          <borderColor>0x000000ff</borderColor>
          <labelTextColor>0xffffffff</labelTextColor>
          <titleEnabled>false</titleEnabled>
          <width>20</width>
          <height>129</height>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
            <objectName>PConvXtended_EQ_on</objectName>
            <x>10</x>
            <y>10</y>
            <comment>on/off for equalizer section</comment>
            <automationAllowed>true</automationAllowed>
            <label>equalizer</label>
            <selected>false</selected>
            <randomizable>true</randomizable>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>180</x>
            <y>96</y>
            <label>bass</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
            <objectName>PConvXtended_gain bass</objectName>
            <x>10</x>
            <y>90</y>
            <comment>gain for fixed bass frequency gain</comment>
            <automationAllowed>true</automationAllowed>
            <minimum>0.0</minimum>
            <maximum>15.0</maximum>
            <bdresolution>0.1</bdresolution>
            <value>1.0</value>
            <sliderWidth>120</sliderWidth>
            <randomizable>true</randomizable>
            <valueDisplayEnabled>true</valueDisplayEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
            <objectName>PConvXtended_gain mid</objectName>
            <x>10</x>
            <y>70</y>
            <comment>gain for fixed mid frequency gain</comment>
            <automationAllowed>true</automationAllowed>
            <minimum>0.0</minimum>
            <maximum>15.0</maximum>
            <bdresolution>0.1</bdresolution>
            <value>1.0</value>
            <sliderWidth>120</sliderWidth>
            <randomizable>true</randomizable>
            <valueDisplayEnabled>true</valueDisplayEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
            <objectName>PConvXtended_gain high</objectName>
            <x>10</x>
            <y>50</y>
            <comment>gain for highest frequencies</comment>
            <automationAllowed>true</automationAllowed>
            <minimum>0.0</minimum>
            <maximum>15.0</maximum>
            <bdresolution>0.1</bdresolution>
            <value>1.0</value>
            <sliderWidth>120</sliderWidth>
            <randomizable>true</randomizable>
            <valueDisplayEnabled>true</valueDisplayEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBHSlider' version='2'>
            <objectName>PConvXtended_freq high</objectName>
            <x>10</x>
            <y>30</y>
            <comment>set high frequency</comment>
            <automationAllowed>true</automationAllowed>
            <minimum>4000.0</minimum>
            <maximum>10000.0</maximum>
            <bdresolution>0.1</bdresolution>
            <value>4000.0</value>
            <sliderWidth>120</sliderWidth>
            <randomizable>true</randomizable>
            <valueDisplayEnabled>true</valueDisplayEnabled>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>180</x>
            <y>45</y>
            <label>high</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
          <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
            <objectName></objectName>
            <x>180</x>
            <y>78</y>
            <label>mid</label>
            <font>
              <name>System Regular</name>
              <size>12.0</size>
            </font>
          </bsbObject>
        </bsbObject>
      </bsbObject>
      <bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
        <objectName>PConvXtendedON</objectName>
        <x>0</x>
        <y>0</y>
        <comment>bypass</comment>
        <automationAllowed>true</automationAllowed>
        <label/>
        <selected>true</selected>
        <randomizable>true</randomizable>
      </bsbObject>
    </bsbObject>
  </graphicInterface>
  <parameterList>
    <parameter uniqueId='172823078' name='PConvXtended_EQ_on' label='' min='0.0' max='1.0' bdresolution='1' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='1.0' min='0.0' bdresolution='1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='172823080' name='PConvXtended_gain bass' label='' min='0.0' max='15.0' bdresolution='0.1' automationEnabled='false' value='1.0'>
      <line name='' version='2' max='15.0' min='0.0' bdresolution='0.1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='1.0'/>
      </line>
    </parameter>
    <parameter uniqueId='172823082' name='PConvXtended_freq high' label='' min='4000.0' max='10000.0' bdresolution='0.1' automationEnabled='false' value='4000.0'>
      <line name='' version='2' max='10000.0' min='4000.0' bdresolution='0.1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='4000.0'/>
      </line>
    </parameter>
    <parameter uniqueId='172823084' name='PConvXtended_gain mid' label='' min='0.0' max='15.0' bdresolution='0.1' automationEnabled='false' value='1.0'>
      <line name='' version='2' max='15.0' min='0.0' bdresolution='0.1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='1.0'/>
      </line>
    </parameter>
    <parameter uniqueId='172823086' name='PConvXtended_gain high' label='' min='0.0' max='15.0' bdresolution='0.1' automationEnabled='false' value='1.0'>
      <line name='' version='2' max='15.0' min='0.0' bdresolution='0.1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='1.0'/>
      </line>
    </parameter>
    <parameter uniqueId='172823088' name='PConvXtended_reflection' label='' min='1.0E-4' max='0.7' bdresolution='0.1' automationEnabled='false' value='1.0E-4'>
      <line name='' version='2' max='0.7' min='1.0E-4' bdresolution='0.1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='1.0E-4'/>
      </line>
    </parameter>
    <parameter uniqueId='172823090' name='PConvXtended_volume wet' label='' min='0.0' max='1.0' bdresolution='0.1' automationEnabled='false' value='0.5'>
      <line name='' version='2' max='1.0' min='0.0' bdresolution='0.1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.5'/>
      </line>
    </parameter>
    <parameter uniqueId='172823092' name='PConvXtended_wetDry' label='' min='0.0' max='1.0' bdresolution='0.01' automationEnabled='false' value='0.5'>
      <line name='' version='2' max='1.0' min='0.0' bdresolution='0.01' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.5'/>
      </line>
    </parameter>
    <parameter uniqueId='-104104175' name='PConvXtendedON' label='' min='0.0' max='1.0' bdresolution='1' automationEnabled='false' value='1.0'>
      <line name='' version='2' max='1.0' min='0.0' bdresolution='1' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='1.0'/>
      </line>
    </parameter>
  </parameterList>
</effect>