<effect>
  <name>AudaxEQ</name>
  <enabled>true</enabled>
  <numIns>2</numIns>
  <numOuts>2</numOuts>
  <code>if (&lt;AudaxON&gt; == 1) then

    aout1 audaciouseq ain1, &lt;31.25&gt;, &lt;52.6&gt;, &lt;125&gt;, &lt;250&gt;, &lt;500&gt;, &lt;1000&gt;, &lt;2000&gt;, &lt;4000&gt;, &lt;8000&gt;, &lt;16000&gt;
    aout2 audaciouseq ain2, &lt;31.25&gt;, &lt;52.6&gt;, &lt;125&gt;, &lt;250&gt;, &lt;500&gt;, &lt;1000&gt;, &lt;2000&gt;, &lt;4000&gt;, &lt;8000&gt;, &lt;16000&gt;

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

a 10-band EQ  equalizer, using the UDO from Steven Yi: https://github.com/kunstmusik/libsyi/blob/master/audaciouseq.udo
that, in turn, is a Csound UDO implementation of Audacious&apos; EQ:
https://github.com/audacious-media-player/audacious/blob/master/src/libaudcore/equalizer.cc

CONTROLLERS:

please check the help balloons, that can be viewed when hoovering overthe BSB elements.

---

version 1.0, October 2021
- initial version by Menno Knevel</comments>
  <opcodeList>
    <udo>
      <opcodeName>audacious_bp2</opcodeName>
      <outTypes>k</outTypes>
      <inTypes>kik</inTypes>
      <codeBody>#define Q # 1.2247449 #
/* single-sample, 2nd order IIR filter */

kin, ifC, kgain xin

;; Calc Coefficients
ith = 2 * $M_PI * (ifC / sr)
iC  = (1 - tan(ith * $Q / 2)) / (1 + tan(ith * $Q / 2))

ia0 = (1 + iC) * cos(ith)
ia1 = -iC 
ib0 = (1 - iC) / 2 
ib1 = -1.005

kout init 0
kwq0 init 0
kwq1 init 0

kG = pow(10, kgain / 20)  - 1

;; Filter Code
kyt = kin 
kw = kyt * ib0 + kwq0 * ia0 + kwq1 * ia1
kyt += (kw + kwq1 * ib1) * kG 

;; Memory
kwq1 = kwq0
kwq0 = kw

xout kyt </codeBody>
      <comments>/* audaciouseq - multi-band equalizer 
   
   A Csound UDO implementation of Audacious&apos; EQ:
   https://github.com/audacious-media-player/audacious/blob/master/src/libaudcore/equalizer.cc
*/


/* Q value for band-pass filters 1.2247 = (3/2)^(1/2)
 * Gives 4 dB suppression at Fc*2 and Fc/2 */</comments>
    </udo>
    <udo>
      <opcodeName>audaciouseq</opcodeName>
      <outTypes>a</outTypes>
      <inTypes>akkkkkkkkkk</inTypes>
      <codeBody>ain, kgain1, kgain2, kgain3, kgain4, kgain5, 
     kgain6, kgain7, kgain8, kgain9, kgain10 xin
aout = 0
kndx = 0
while (kndx &lt; ksmps) do
  ksamp audacious_bp2 ain[kndx], 31.25, kgain1
  ksamp audacious_bp2 ksamp, 62.5, kgain2
  ksamp audacious_bp2 ksamp, 125, kgain3
  ksamp audacious_bp2 ksamp, 250, kgain4
  ksamp audacious_bp2 ksamp, 500, kgain5
  ksamp audacious_bp2 ksamp, 1000, kgain6
  ksamp audacious_bp2 ksamp, 2000, kgain7
  ksamp audacious_bp2 ksamp, 4000, kgain8
  ksamp audacious_bp2 ksamp, 8000, kgain9
  aout[kndx] audacious_bp2 ksamp, 16000, kgain10
  kndx += 1
od
xout aout
</codeBody>
      <comments>/* 10-band EQ 
   Input: asig, kgain1, kgain2, ...
   Output: aout
   10 kgain arguments maps to each band
   Bands are: 31.25, 52.6, 125, 250, 500, 1000, 
              2000, 4000, 8000, 16000 
*/</comments>
    </udo>
  </opcodeList>
  <graphicInterface editEnabled='false'>
    <gridSettings>
      <width>5</width>
      <height>5</height>
      <gridStyle>DOT</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.BSBLabel' version='2'>
          <objectName></objectName>
          <x>464</x>
          <y>10</y>
          <label>16000</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>52.6</objectName>
          <x>60</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>8000</objectName>
          <x>407</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>125</objectName>
          <x>110</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>500</objectName>
          <x>210</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>317</x>
          <y>10</y>
          <label>2000</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>419</x>
          <y>10</y>
          <label>8000</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>16000</objectName>
          <x>457</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>267</x>
          <y>10</y>
          <label>1000</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>369</x>
          <y>10</y>
          <label>4000</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>2000</objectName>
          <x>310</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>20</x>
          <y>10</y>
          <label>31.25</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>4000</objectName>
          <x>357</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>222</x>
          <y>10</y>
          <label>500</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>172</x>
          <y>10</y>
          <label>250</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>72</x>
          <y>10</y>
          <label>52.6</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>1000</objectName>
          <x>260</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel' version='2'>
          <objectName></objectName>
          <x>122</x>
          <y>10</y>
          <label>125</label>
          <font>
            <name>System Bold</name>
            <size>12.0</size>
          </font>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>31.25</objectName>
          <x>13</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
        <bsbObject type='blue.orchestra.blueSynthBuilder.BSBVSlider' version='2'>
          <objectName>250</objectName>
          <x>160</x>
          <y>20</y>
          <automationAllowed>true</automationAllowed>
          <minimum>-12.0</minimum>
          <maximum>12.0</maximum>
          <bdresolution>0.2</bdresolution>
          <value>0.0</value>
          <sliderHeight>150</sliderHeight>
          <randomizable>true</randomizable>
          <valueDisplayEnabled>true</valueDisplayEnabled>
        </bsbObject>
      </bsbObject>
      <bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
        <objectName>AudaxON</objectName>
        <x>0</x>
        <y>0</y>
        <comment>turn effect ON/OFF</comment>
        <automationAllowed>true</automationAllowed>
        <label/>
        <selected>true</selected>
        <randomizable>true</randomizable>
      </bsbObject>
    </bsbObject>
  </graphicInterface>
  <parameterList>
    <parameter uniqueId='-975167845' name='52.6' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167843' name='8000' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167841' name='125' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167839' name='500' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167837' name='16000' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167835' name='2000' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167833' name='4000' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167831' name='1000' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167829' name='31.25' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167827' name='250' label='' min='-12.0' max='12.0' bdresolution='0.2' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='12.0' min='-12.0' bdresolution='0.2' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='-975167825' name='AudaxON' 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>