<instrument type='blue.orchestra.BlueSynthBuilder' editEnabled='true'>
  <name>Supersaw</name>
  <comment>A supersaw is available on some synthesizers as an extra waveform,
besides the familiar sine, triangle, square and saw. A supersaw is
typically seven saws that are slightly detuned. I found out that you also
get a nice sound if you replace a saw with a square, so I made this
instrument that lets you choose between them. They are called pulse
in the interface because you can select the pulse width (does not
apply if saw is selected).

I did not add presets because it usually sounds good, unless the
lo pass knob is too low, and because it does not have that much
diversity (but a nice instrument anyway). It sounds best around
pitch 7.00 to 9.06, especially in chords.

Usage:
p4: pitch or frequency
p5: in decibels below 0dbfs if 0 or negative, otherwise amplitude as fraction of 0dbfs (0-1)

Example:
i1 0 2 8.00 -10
i1 0 . 8.02 -10
i1 0 . 8.04 -10
</comment>
  <globalOrc>gi_cosine ftgen	0, 0, 2^18+1, 11, 1, 1</globalOrc>
  <globalSco/>
  <instrumentText>ifreq getFrequency p4
iamp = ((p5 &gt; 0) ? 0dbfs*p5 : ampdbfs(p5))*ampdb(&lt;vol_adjust&gt;)
iamp = iamp/7

kdiff1 = &lt;diff_1&gt;
kdiff2 = &lt;diff_2&gt;
kdiff3 = &lt;diff_3&gt;

asig = 0

; my experiments show that it sounds a lot better when
; components with opposite frequencies have the same
; wave type and pulse width,
; and that the phases should all be the same
if (&lt;comp1&gt;!=0) then
	asig1 vco2 iamp*&lt;amp1&gt;, ifreq,        &lt;type1&gt;, &lt;pw1&gt;
	asig = asig+asig1
endif

if (&lt;comp2_3&gt;!=0) then
	asig2 vco2 iamp*&lt;amp2&gt;, ifreq+kdiff1, &lt;type2&gt;, &lt;pw2&gt;
	asig3 vco2 iamp*&lt;amp2&gt;, ifreq-kdiff1, &lt;type2&gt;, &lt;pw2&gt;
	asig = asig+asig2+asig3
endif

if (&lt;comp4_5&gt;!=0) then
	asig4 vco2 iamp*&lt;amp3&gt;, ifreq+kdiff2, &lt;type3&gt;, &lt;pw3&gt;
	asig5 vco2 iamp*&lt;amp3&gt;, ifreq-kdiff2, &lt;type3&gt;, &lt;pw3&gt;
	asig = asig+asig4+asig5
endif

if (&lt;comp6_7&gt;!=0) then
	asig6 vco2 iamp*&lt;amp4&gt;, ifreq+kdiff3, &lt;type4&gt;, &lt;pw4&gt;
	asig7 vco2 iamp*&lt;amp4&gt;, ifreq-kdiff3, &lt;type4&gt;, &lt;pw4&gt;
	asig = asig+asig6+asig7
endif

icutoff = ifreq*i(&lt;lo_pass&gt;)
if (icutoff&lt;sr/2) then
	asig butterlp asig, icutoff
endif

kenv mvpEnvelope i(&lt;attack&gt;), i(&lt;decay&gt;), i(&lt;sustain&gt;), i(&lt;release&gt;)

asig = asig*kenv

kleft, kright panner &lt;pan&gt;&lt;pan_mod&gt;
blueMixerOut asig*kleft, asig*kright
</instrumentText>
  <graphicInterface editEnabled='false'>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>decay</objectName>
      <x>193</x>
      <y>76</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>10.0</maximum>
      <value>0.08289698</value>
      <knobWidth>50</knobWidth>
      <randomizable>false</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>sustain</objectName>
      <x>246</x>
      <y>76</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.5930366</value>
      <knobWidth>50</knobWidth>
      <randomizable>false</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>release</objectName>
      <x>300</x>
      <y>76</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>10.0</maximum>
      <value>0.70730567</value>
      <knobWidth>50</knobWidth>
      <randomizable>false</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>attack</objectName>
      <x>140</x>
      <y>76</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>10.0</maximum>
      <value>0.13778517</value>
      <knobWidth>50</knobWidth>
      <randomizable>false</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>144</x>
      <y>57</y>
      <label>Attack</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>197</x>
      <y>57</y>
      <label>Decay</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>247</x>
      <y>57</y>
      <label>Sustain</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>300</x>
      <y>57</y>
      <label>Release</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>143</x>
      <y>27</y>
      <label>&lt;html&gt;&lt;font size=&quot;+1&quot;&gt;Envelope&lt;/font&gt;&lt;/html&gt;</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>984</x>
      <y>318</y>
      <label>&lt;html&gt;&lt;font size=&quot;+1&quot;&gt;Volume adjust (db)&lt;/font&gt;&lt;/html&gt;</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>vol_adjust</objectName>
      <x>1028</x>
      <y>350</y>
      <automationAllowed>false</automationAllowed>
      <minimum>-40.0</minimum>
      <maximum>40.0</maximum>
      <value>11.612381</value>
      <knobWidth>60</knobWidth>
      <randomizable>false</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBDropdown'>
      <objectName>type1</objectName>
      <x>117</x>
      <y>183</y>
      <bsbDropdownItemList>
        <bsbDropdownItem>
          <name>Saw</name>
          <value>0</value>
        </bsbDropdownItem>
        <bsbDropdownItem>
          <name>Pulse</name>
          <value>2</value>
        </bsbDropdownItem>
      </bsbDropdownItemList>
      <selectedIndex>1</selectedIndex>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>pw1</objectName>
      <x>260</x>
      <y>204</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.05411869</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>277</x>
      <y>184</y>
      <label>pw</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>amp1</objectName>
      <x>193</x>
      <y>204</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.04845392</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>206</x>
      <y>184</y>
      <label>amp</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBDropdown'>
      <objectName>type2</objectName>
      <x>117</x>
      <y>282</y>
      <bsbDropdownItemList>
        <bsbDropdownItem>
          <name>Saw</name>
          <value>0</value>
        </bsbDropdownItem>
        <bsbDropdownItem>
          <name>Pulse</name>
          <value>2</value>
        </bsbDropdownItem>
      </bsbDropdownItemList>
      <selectedIndex>0</selectedIndex>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>pw2</objectName>
      <x>260</x>
      <y>303</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.6060633</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>277</x>
      <y>283</y>
      <label>pw</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>amp2</objectName>
      <x>193</x>
      <y>303</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.9652921</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>206</x>
      <y>283</y>
      <label>amp</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBDropdown'>
      <objectName>type3</objectName>
      <x>592</x>
      <y>181</y>
      <bsbDropdownItemList>
        <bsbDropdownItem>
          <name>Saw</name>
          <value>0</value>
        </bsbDropdownItem>
        <bsbDropdownItem>
          <name>Pulse</name>
          <value>2</value>
        </bsbDropdownItem>
      </bsbDropdownItemList>
      <selectedIndex>0</selectedIndex>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>pw3</objectName>
      <x>740</x>
      <y>202</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.1303014</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>757</x>
      <y>182</y>
      <label>pw</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>amp3</objectName>
      <x>673</x>
      <y>202</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.3946069</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>686</x>
      <y>182</y>
      <label>amp</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBDropdown'>
      <objectName>type4</objectName>
      <x>592</x>
      <y>282</y>
      <bsbDropdownItemList>
        <bsbDropdownItem>
          <name>Saw</name>
          <value>0</value>
        </bsbDropdownItem>
        <bsbDropdownItem>
          <name>Pulse</name>
          <value>2</value>
        </bsbDropdownItem>
      </bsbDropdownItemList>
      <selectedIndex>1</selectedIndex>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>pw4</objectName>
      <x>740</x>
      <y>303</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.36728287</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>757</x>
      <y>283</y>
      <label>pw</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>amp4</objectName>
      <x>673</x>
      <y>303</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.5888107</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>686</x>
      <y>283</y>
      <label>amp</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>diff_1</objectName>
      <x>327</x>
      <y>303</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.19435695</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>332</x>
      <y>283</y>
      <label>diff (Hz)</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>diff_2</objectName>
      <x>806</x>
      <y>202</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.2819123</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>811</x>
      <y>182</y>
      <label>diff (Hz)</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>diff_3</objectName>
      <x>804</x>
      <y>303</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>1.0</maximum>
      <value>0.73613167</value>
      <knobWidth>50</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>809</x>
      <y>283</y>
      <label>diff (Hz)</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>pan</objectName>
      <x>1028</x>
      <y>197</y>
      <automationAllowed>true</automationAllowed>
      <minimum>-1.0</minimum>
      <maximum>1.0</maximum>
      <value>0.0</value>
      <knobWidth>60</knobWidth>
      <randomizable>false</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBTextField'>
      <objectName>pan_mod</objectName>
      <x>1029</x>
      <y>274</y>
      <value></value>
      <textFieldWidth>60</textFieldWidth>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>1045</x>
      <y>172</y>
      <label>Pan</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
      <objectName>comp1</objectName>
      <x>10</x>
      <y>183</y>
      <label>Component 1</label>
      <selected>true</selected>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
      <objectName>comp2_3</objectName>
      <x>8</x>
      <y>281</y>
      <label>Component 2,3</label>
      <selected>true</selected>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
      <objectName>comp4_5</objectName>
      <x>479</x>
      <y>180</y>
      <label>Component 4,5</label>
      <selected>true</selected>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBCheckBox'>
      <objectName>comp6_7</objectName>
      <x>481</x>
      <y>281</y>
      <label>Component 6,7</label>
      <selected>true</selected>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>lo_pass</objectName>
      <x>470</x>
      <y>57</y>
      <automationAllowed>true</automationAllowed>
      <minimum>0.0</minimum>
      <maximum>40.0</maximum>
      <value>19.797112</value>
      <knobWidth>60</knobWidth>
      <randomizable>true</randomizable>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>476</x>
      <y>29</y>
      <label>Lo Pass</label>
    </bsbObject>
  </graphicInterface>
  <bsbParameterList>
    <parameter uniqueId='2062578196' name='amp1' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.04845392'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.04845392'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578200' name='amp2' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.9652921'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.9652921'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578204' name='amp3' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.3946069'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.3946069'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578208' name='amp4' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.5888107'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.5888107'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578192' name='attack' label='' min='0.0' max='10.0' resolution='-1.0' automationEnabled='false' value='0.13778517'>
      <line name='' version='2' max='10.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.13778517'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578186' name='decay' label='' min='0.0' max='10.0' resolution='-1.0' automationEnabled='false' value='0.08289698'>
      <line name='' version='2' max='10.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.08289698'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578210' name='diff_1' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.19435695'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.19435695'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578212' name='diff_2' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.2819123'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.2819123'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578214' name='diff_3' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.73613167'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.73613167'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578218' name='lo_pass' label='' min='0.0' max='40.0' resolution='-1.0' automationEnabled='false' value='19.797112'>
      <line name='' version='2' max='40.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='19.797112'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578216' name='pan' label='' min='-1.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.0'>
      <line name='' version='2' max='1.0' min='-1.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.0'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578194' name='pw1' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.05411869'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.05411869'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578198' name='pw2' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.6060633'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.6060633'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578202' name='pw3' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.1303014'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.1303014'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578206' name='pw4' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.36728287'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.36728287'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578190' name='release' label='' min='0.0' max='10.0' resolution='-1.0' automationEnabled='false' value='0.70730567'>
      <line name='' version='2' max='10.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.70730567'/>
      </line>
    </parameter>
    <parameter uniqueId='2062578188' name='sustain' label='' min='0.0' max='1.0' resolution='-1.0' automationEnabled='false' value='0.5930366'>
      <line name='' version='2' max='1.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false' endPointsLinked='false'>
        <linePoint x='0.0' y='0.5930366'/>
      </line>
    </parameter>
  </bsbParameterList>
  <presetGroup name='Presets'/>
  <opcodeList>
    <udo>
      <opcodeName>panner</opcodeName>
      <outTypes>kk</outTypes>
      <inTypes>k</inTypes>
      <codeBody>; sin/cos taper, constant power.
kPanpos xin
kPanpos = kPanpos/2

kPanpos	= kPanpos * 3.14159265359 * .5
kLeft     	= sqrt(2) / 2 * (cos(kPanpos) - sin(kPanpos)) 
kRight    	= sqrt(2) / 2 * (cos(kPanpos) + sin(kPanpos))
xout kLeft,kRight</codeBody>
      <comments></comments>
    </udo>
    <udo>
      <opcodeName>getFrequency</opcodeName>
      <outTypes>i</outTypes>
      <inTypes>i</inTypes>
      <codeBody>ipch 	xin

iout	= (ipch &lt; 15 ? cpspch(ipch) : ipch)
	
	xout	iout
</codeBody>
      <comments></comments>
    </udo>
    <udo>
      <opcodeName>mvpLFO</opcodeName>
      <outTypes>k</outTypes>
      <inTypes>iiiiiiiiii</inTypes>
      <codeBody>itype, ispeed1, ispeed2, imirror, idelay, iphase, icurve, ipw, iflat, ispeedup xin

; you can see easily that and ispeedup is not really necessary
; because it only changeq the other input values in a trivial way,
; but it makes it easy to change the speed of the created signal, and is ideal for automation

ispeed1 = ispeed1*ispeedup
ispeed2 = ispeed2*ispeedup
idelay  = idelay/ispeedup

; generate signal

ishort = 0.03
if (idelay&gt;0) then
	if (imirror==0) then
		kspeed linseg ispeed1, 2*idelay, ispeed1, ishort, ispeed2, p3-2*idelay-ishort, ispeed1
	elseif (imirror==1) then
		kspeed linseg ispeed1, 2*idelay, ispeed1, p3-2*idelay, ispeed2
	else
		kspeed linseg ispeed1, 2*idelay, ispeed1, (p3-2*idelay)*imirror, ispeed2, (p3-2*idelay)*(1-imirror), ispeed1
	endif
else
	if (imirror==0) then
		kspeed linseg ispeed2, p3, ispeed1
	elseif (imirror==1) then
		kspeed linseg ispeed1, p3, ispeed2
	else
		kspeed linseg ispeed1, p3*imirror, ispeed2, p3*(1-imirror), ispeed1
	endif
endif

if (itype==1) then ; Sine
	kph phasor kspeed, iphase
	kidx loopsegp kph, 0, iflat/2, 0, (1-iflat)*ipw, 0.5, iflat/2, 0.5, (1-iflat)*(1-ipw), 1
	kvar tablei kidx, gi_cosine, 1, 0, 1
	kvar = (kvar+1)/2 ; make it between 0 and 1
elseif (itype==2) then ; Triangles
	kph phasor kspeed, iphase
	kvar loopsegp kph, 1, (1-iflat)*ipw, 0, iflat, 0, (1-iflat)*(1-ipw), 1
elseif (itype==3) then ; Trapezoids / Squares
	kph phasor kspeed, iphase
	kvar loopsegp kph, 1, ipw*iflat, 1, ipw*(1-iflat), 0, (1-ipw)*iflat, 0, (1-ipw)*(1-iflat), 1
elseif (itype==10) then ; random hold
	kvar randh 0.5, kspeed, 1
	kvar = kvar+0.5 ; make it between 0 and 1
elseif (itype==11) then ; random hold with port
	kvar randh 0.5, kspeed, 1
	kvar tonek kvar, 20
	kvar = kvar+0.5 ; make it between 0 and 1
elseif (itype==12) then ; random lines
	kvar randi 0.5, kspeed
	kvar = kvar+0.5 ; make it between 0 and 1
elseif (itype==50) then; Jitter
	kvar jitter 0.5, ispeed1, ispeed2
	kvar = kvar+0.5 ; make it between 0 and 1
elseif (itype==51) then; Jspline
	kvar jspline 0.5, ispeed1, ispeed2
	kvar = kvar+0.5 ; make it between 0 and 1
endif

; now kvar is between 0 and 1

if (icurve&gt;0) then
	kvar expcurve kvar, icurve+1
elseif (icurve&lt;0) then
	kvar logcurve kvar, 1-icurve
endif

; now kvar is still between 0 and 1

if (idelay&gt;0) then
	kamp linseg 0, idelay, 0, idelay, 2, p3-2*idelay, 2
	kvar = kamp*(kvar-0.5)
else
	kvar = 2*(kvar-0.5)
endif

; now kvar is between -1 and 1

xout kvar
</codeBody>
      <comments>mvpLFO by Mark Van Peteghem

This UDO can create LFO signals of different types with many parameters.

The in parameters are itype, ispeed1, ispeed2, imirror, idelay, iphase, icurve, ipw, iflat, ispeedup
* itype is the type of LFO:
	+ 1: Warped sine; pw determines ratio between rising and descending part of the sine
		flat is how long the flat parts are (1 for squares, 0 for no flat parts)
	+ 2: Triangles; pw determines ratio between rising and descending part of the triangle
		flat is the length of the flat parts between triangles (0 for only triangles)
	+ 3: Trapezoids / squares; pw determines ratio between rising and descending part of the trapezoids
		flat is how long the flat parts are (1 for squares, 0 for triangles)
	+10: Random hold; doesn&apos;t use iphase, ipw and iflat
	+11: Random hold with port; doesn&apos;t use iphase, ipw and iflat
	+12: Random lines; doesn&apos;t use iphase, ipw and iflat
	+ 50: Jitter; doesn&apos;t use imirror, iphase, ipw and iflat
	+ 51: Jitter splines; doesn&apos;t use imirror, iphase, ipw and iflat

* ispeed1: initial and end speed, except for jitter and jitter spline where it is the minimum frequency
* ispeed2: middle speed, except for jitter and jitter spline where it is the maximum frequency
* imirror: between 0 and 1; determines where as a fraction after the delay the ispeed2 is reached, after which it goes back to ispeed1;
     make this 1 to end with ispeed2, 0 to nearly begin with ispeed2
* idelay: amount of time that the signal is zero; after that, it takes the same amount of time to rise to the maximum amplitude
* icurve: if positive, expcurve is applied with 1+icurve to the signal; otherwise logcurve is applied with 1-icurve
* ipw: depends on itype
* iflat: length of the flat parts
* ispeedup: multiplyer for ispeed1 and ispeed2, and divider of idelay


The out parameter is klfo, a signal between -1 and 1 (with jitter spline it may be a little out of that range)


Requirements:
- there should be a table with a cosine, stored in the global variable gi_cosine
</comments>
    </udo>
    <udo>
      <opcodeName>mvpEnvelope</opcodeName>
      <outTypes>k</outTypes>
      <inTypes>iiii</inTypes>
      <codeBody>iatk, idec, isus, irel xin

ifrac = (iatk+idec+irel)/p3
if ( ifrac &gt; 1 ) then
	iatk = iatk / ifrac
	idec = idec / ifrac
	irel = irel / ifrac
endif

kenv adsr iatk, idec, isus, irel

xout kenv</codeBody>
      <comments></comments>
    </udo>
  </opcodeList>
</instrument>