<effect>
  <name>Leslie Emulation</name>
  <enabled>true</enabled>
  <numIns>2</numIns>
  <numOuts>2</numOuts>
  <code>ain = ain1 + ain2

aout1, aout2 	leslieEmulation	ain, &lt;SPEED&gt;

</code>
  <comments>Based on Hans Mikelson&apos;s Leslie Emulation</comments>
  <opcodeList>
    <udo>
      <opcodeName>leslieEmulation</opcodeName>
      <outTypes>aa</outTypes>
      <inTypes>ak</inTypes>
      <codeBody>asig, kspeed xin

isine 		chnget &quot;leslie_sine&quot;
ifilter1 	chnget &quot;leslie_filter1&quot;
ifilter2 	chnget &quot;leslie_filter2&quot;
idistort	chnget &quot;leslie_distort&quot;

if (isine == 0) then
	isine 		ftgen 	0, 0, 1024, 10, 1
	ifilter1 	ftgen 	0, 0, 256, 7, 0, 110, .3, 18, 1, 18, .3, 110, 0
	ifilter2 	ftgen 	0, 0, 256, 7, 0, 80, .5, 16, 1, 64, 1, 16, .5, 80, 0
	idistort 	ftgen 	0, 0, 1024, 8, -.8, 42, -.78, 100, -.7, 740, .7, 100, .78, 42, .8

	chnset	isine, &quot;leslie_sine&quot;
	chnset	ifilter1, &quot;leslie_filter1&quot;
	chnset	ifilter2, &quot;leslie_filter2&quot;
	chnset	idistort, &quot;leslie_distort&quot;
endif


isep      =         .2

; DISTORTION EFFECT
asig      =         asig/40000
aclip     tablei    asig, idistort, 1, .5
aclip     =         aclip*30000

aleslie   delayr    .02, 1

; ACCELERATION
kenv      linseg    p4, p3+.02, p5

; DOPPLER EFFECT
koscl     oscil     1, kspeed, isine, 0
koscr     oscil     1, kspeed, isine, isep
kdopl     =         .01-koscl*.0002
kdopr     =         .012-koscr*.0002
aleft     deltapi   kdopl
aright    deltapi   kdopr

delayw    aclip

; FILTER EFFECT
; DIVIDE INTO THREE FREQUENCY RANGES FOR DIRECTIONAL SOUND. 

; HIGH PASS
alfhi     atone     aleft, 8000
arfhi     atone     aright, 8000
alfhi     tone      alfhi, 12000
arfhi     tone      arfhi, 12000

; BAND PASS
alfmid    atone     aleft, 4000
arfmid    atone     aright, 4000
alfmid    tone      alfmid, 8000
arfmid    tone      arfmid, 8000

; LOW PASS
alflow    tone      aleft, 4000
arflow    tone      aright, 4000

kflohi    oscil     1, kspeed, ifilter1, 0
kfrohi    oscil     1, kspeed, ifilter1, isep
kflomid   oscil     1, kspeed, ifilter2, 0
kfromid   oscil     1, kspeed, ifilter2, isep

; AMPLITUDE EFFECT
kalosc    =         koscl * .1 + 1
karosc    =         koscr * .1 + 1


          outs      alfhi*kflohi+alfmid*kflomid+alflow*kalosc,arfhi*kfrohi+arfmid*kfromid+arflow*karosc</codeBody>
    </udo>
  </opcodeList>
  <graphicInterface editEnabled='false'>
    <uniqueNameManager nameIndex='-1' defaultPrefix='bsbObj'/>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBKnob' version='2'>
      <objectName>SPEED</objectName>
      <x>48</x>
      <y>53</y>
      <minimum>0.0</minimum>
      <maximum>20.0</maximum>
      <value>4.0</value>
      <knobWidth>60</knobWidth>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>7</x>
      <y>6</y>
      <label>&lt;html&gt;&lt;font size=&quot;+1&quot;&gt;Leslie Emulation&lt;/font&gt;&lt;/html&gt;</label>
    </bsbObject>
    <bsbObject type='blue.orchestra.blueSynthBuilder.BSBLabel'>
      <objectName></objectName>
      <x>60</x>
      <y>35</y>
      <label>Speed</label>
    </bsbObject>
  </graphicInterface>
  <bsbParameterList>
    <parameter uniqueId='583162081' name='SPEED' label='' min='0.0' max='20.0' resolution='-1.0' automationEnabled='false'>
      <line name='' version='2' max='20.0' min='0.0' resolution='-1.0' color='-8355712' rightBound='false'>
        <linePoint x='0.0' y='4.0'/>
      </line>
    </parameter>
  </bsbParameterList>
</effect>