Extra "ports" of juce-based plugins using the distrho build system
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
4.0KB

  1. <Cabbage>
  2. form caption("Envelope Follower") size(440, 100), pluginID("envf")
  3. image pos(0, 0), size(440, 100), colour("brown"), shape("rounded"), outline("white"), line(4)
  4. checkbox bounds(15, 70, 15, 15), channel("lev1"), value(0), colour(200,220,0,255),shape("ellipse")
  5. checkbox bounds(15, 55, 15, 15), channel("lev2"), value(0), colour(250,190,0,255),shape("ellipse")
  6. checkbox bounds(15, 40, 15, 15), channel("lev3"), value(0), colour(255,120,0,255),shape("ellipse")
  7. checkbox bounds(15, 25, 15, 15), channel("lev4"), value(0), colour(255, 60,0,255),shape("ellipse")
  8. checkbox bounds(15, 10, 15, 15), channel("lev5"), value(0), colour(255, 0,0,255),shape("ellipse")
  9. rslider bounds( 40, 11, 75, 75), text("Sensitivity"), channel("sens"), range(0, 1, 0.65), colour(255,100,100), fontcolour(255,255,200), trackercolour(255,255,150)
  10. rslider bounds(110, 6, 45, 45), text("Att."), channel("att"), range(0.001, 0.5, 0.01, 0.5, 0.001), colour(255,200,100), fontcolour(255,255,200), trackercolour(255,255,150)
  11. rslider bounds(110, 51, 45, 45), text("Dec."), channel("rel"), range(0.001, 0.5, 0.2, 0.5, 0.001), colour(255,200,100), fontcolour(255,255,200), trackercolour(255,255,150)
  12. rslider bounds(150, 11, 75, 75), text("Frequency"), channel("freq"), range(10, 10000, 1000, 0.5), colour(255,100,100), fontcolour(255,255,200), trackercolour(255,255,150)
  13. rslider bounds(220, 11, 75, 75), text("Resonance"), channel("res"), range(0, 1, 0.75), colour(255,100,100), fontcolour(255,255,200), trackercolour(255,255,150)
  14. rslider bounds(290, 11, 75, 75), text("Distortion"), channel("dist"), range(0, 1.00, 0), colour(255,100,100), fontcolour(255,255,200), trackercolour(255,255,150)
  15. rslider bounds(360, 11, 75, 75), text("Level"), channel("level"), range(0, 1.00, 1), colour(255,200,100), fontcolour(255,255,200), trackercolour(255,255,150)
  16. }
  17. </Cabbage>
  18. <CsoundSynthesizer>
  19. <CsOptions>
  20. -d -n
  21. </CsOptions>
  22. <CsInstruments>
  23. sr = 44100
  24. ksmps = 64
  25. nchnls = 2
  26. 0dbfs = 1
  27. ;Author: Iain McCurdy (2012)
  28. opcode EnvelopeFollower,a,akkkkkk
  29. ain,ksens,katt,krel,kfreq,kres,kdist xin ;READ IN INPUT ARGUMENTS
  30. setksmps 4
  31. ; ATTCK.REL. - ADJUST THE RESPONSE OF THE ENVELOPE FOLLOWER HERE
  32. aFollow follow2 ain, katt, krel ;AMPLITUDE FOLLOWING AUDIO SIGNAL
  33. kFollow downsamp aFollow ;DOWNSAMPLE TO K-RATE
  34. kFollow expcurve kFollow/0dbfs,0.5 ;ADJUSTMENT OF THE RESPONSE OF DYNAMICS TO FILTER FREQUENCY MODULATION
  35. kFrq = kfreq + (kFollow*ksens*10000) ;CREATE A LEFT CHANNEL MODULATING FREQUENCY BASE ON THE STATIC VALUE CREATED BY kfreq AND THE AMOUNT OF DYNAMIC ENVELOPE FOLLOWING GOVERNED BY ksens
  36. kFrq limit kFrq, 20,sr/2 ;LIMIT FREQUENCY RANGE TO PREVENT OUT OF RANGE FREQUENCIES
  37. aout lpf18 ain, kFrq, kres, kdist ;REDEFINE AUDIO SIGNAL AS FILTERED VERSION OF ITSELF
  38. xout aout ;SEND AUDIO BACK TO CALLER INSTRUMENT
  39. endop
  40. opcode SwitchPort, k, kii
  41. kin,iupport,idnport xin
  42. kold init 0
  43. kporttime = (kin<kold?idnport:iupport)
  44. kout portk kin, kporttime
  45. kold = kout
  46. xout kout
  47. endop
  48. instr 1
  49. ksens chnget "sens"
  50. katt chnget "att"
  51. krel chnget "rel"
  52. kfreq chnget "freq"
  53. kres chnget "res"
  54. kdist chnget "dist"
  55. klevel chnget "level"
  56. a1,a2 ins
  57. ;a1,a2 diskin2 "808loop.wav",1,0,1
  58. ;a1 = a1*0.4
  59. ;a2 = a2*0.4
  60. /*level meter*/
  61. amix sum a1,a2
  62. krms rms amix*0.5
  63. krms pow krms,0.75
  64. krms SwitchPort krms,0.01,0.2
  65. kon = 1
  66. koff = 0
  67. #define INDICATOR(LEV'N)
  68. #
  69. kOnTrig trigger krms,$LEV^1.5,0
  70. kOffTrig trigger krms,$LEV^1.5,1
  71. if kOnTrig==1 then
  72. chnset kon,"lev$N"
  73. elseif kOffTrig==1 then
  74. chnset koff,"lev$N"
  75. endif
  76. #
  77. $INDICATOR(1/6'1)
  78. $INDICATOR(2/6'2)
  79. $INDICATOR(3/6'3)
  80. $INDICATOR(4/6'4)
  81. $INDICATOR(5/6'5)
  82. a1 EnvelopeFollower a1,ksens,katt,krel,kfreq,kres*0.95,kdist*100
  83. a2 EnvelopeFollower a2,ksens,katt,krel,kfreq,kres*0.95,kdist*100
  84. a1 = a1 * klevel * (1 - ((kdist*0.3)^0.02)) ;scale amplitude according to distortion level (to compensate for gain increases it applies)
  85. a2 = a2 * klevel * (1 - ((kdist*0.3)^0.02))
  86. outs a1,a2
  87. endin
  88. </CsInstruments>
  89. <CsScore>
  90. i 1 0 [60*60*24*7]
  91. </CsScore>
  92. </CsoundSynthesizer>