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.

109 lines
4.3KB

  1. Units for the delay are assumed to be demi-semiquavers.
  2. Knob for Rhy.Mult. will be replaced with a combobox once comboboxes work in plugins within hosts.
  3. Width control only applicable when ping-pong delay selected.
  4. If 'external' is selected as clock source tempo is taken from the host's BPM.
  5. <Cabbage>
  6. form caption("Tempo Delay") size(565, 90), pluginID("TDel")
  7. image pos(0, 0), size(565, 90), colour("LightBlue"), shape("rounded"), outline("white"), line(4)
  8. rslider bounds(10, 11, 70, 70), text("Tempo"), fontcolour("black"), channel("tempo"), range(40, 500, 90, 1, 1), colour(100,100,255),trackercolour(100,100,150)
  9. rslider bounds(75, 11, 70, 70), text("Rhy.Mult."), fontcolour("black"), channel("RhyMlt"), range(1, 16, 4, 1, 1), colour(100,100,255),trackercolour(100,100,150)
  10. rslider bounds(140, 11, 70, 70), text("Damping"), fontcolour("black"), channel("damp"), range(20,20000, 20000,0.5), colour(100,100,255),trackercolour(100,100,150)
  11. rslider bounds(205, 11, 70, 70), text("Feedback"), fontcolour("black"), channel("fback"), range(0, 1.00, 0.8), colour(100,100,255),trackercolour(100,100,150)
  12. rslider bounds(270, 11, 70, 70), text("Width"), fontcolour("black"), channel("width"), range(0, 1.00, 1), colour(100,100,255),trackercolour(100,100,150)
  13. button bounds(340, 10, 80, 20), text("Internal","External"), channel("ClockSource"), value(0), fontcolour("lime")
  14. label bounds(345, 30, 80, 12), text("Clock Source"), FontColour("black")
  15. button bounds(340, 50, 80, 20), text("Simple","Ping-pong"), channel("DelType"), value(1), fontcolour("lime")
  16. label bounds(348, 70, 80, 12), text("Delay Type"), FontColour("black")
  17. rslider bounds(420, 11, 70, 70), text("Mix"), fontcolour("black"), channel("mix"), range(0, 1.00, 0.5), colour(100,100,255),trackercolour(100,100,150)
  18. rslider bounds(485, 11, 70, 70), text("Level"), fontcolour("black"), channel("level"), range(0, 1.00, 1), colour(100,100,255),trackercolour(100,100,150)
  19. }
  20. hostbpm channel("bpm")
  21. </Cabbage>
  22. <CsoundSynthesizer>
  23. <CsOptions>
  24. -d -n
  25. </CsOptions>
  26. <CsInstruments>
  27. sr = 44100 ;SAMPLE RATE
  28. ksmps = 32 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE
  29. nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
  30. 0dbfs = 1
  31. ;Author: Iain McCurdy (2012)
  32. instr 1
  33. kfback chnget "fback" ;read in widgets
  34. kdamp chnget "damp" ;
  35. kmix chnget "mix" ;
  36. klevel chnget "level" ;
  37. kbpm chnget "bpm" ;
  38. kRhyMlt chnget "RhyMlt" ;
  39. kClockSource chnget "ClockSource" ;
  40. kDelType chnget "DelType" ;
  41. kwidth chnget "width" ;
  42. if kClockSource==0 then ;if internal clock source has been chosen...
  43. ktempo chnget "tempo" ;tempo taken from GUI knob control
  44. else
  45. ktempo chnget "bpm" ;tempo taken from host BPM
  46. ktempo limit ktempo,40,500 ;limit range of possible tempo values. i.e. a tempo of zero would result in a delay time of infinity.
  47. endif
  48. ktime = (60*kRhyMlt)/(ktempo*8) ;derive delay time. 8 in the denominator indicates that kRhyMult will be in demisemiquaver divisions
  49. atime interp ktime ;interpolate k-rate delay time to create an a-rate version which will give smoother results when tempo is modulated
  50. ainL,ainR ins ;read stereo inputs
  51. if kDelType==0 then ;if 'simple' delay type is chosen...
  52. abuf delayr 5
  53. atapL deltap3 atime
  54. atapL tone atapL,kdamp
  55. delayw ainL+(atapL*kfback)
  56. abuf delayr 5
  57. atapR deltap3 atime
  58. atapR tone atapR,kdamp
  59. delayw ainR+(atapR*kfback)
  60. else ;otherwise 'ping-pong' delay type must have been chosen
  61. ;offset delay (no feedback)
  62. abuf delayr 5
  63. afirst deltap3 atime
  64. afirst tone afirst,kdamp
  65. delayw ainL
  66. ;left channel delay (note that 'atime' is doubled)
  67. abuf delayr 10 ;
  68. atapL deltap3 atime*2
  69. atapL tone atapL,kdamp
  70. delayw afirst+(atapL*kfback)
  71. ;right channel delay (note that 'atime' is doubled)
  72. abuf delayr 10
  73. atapR deltap3 atime*2
  74. atapR tone atapR,kdamp
  75. delayw ainR+(atapR*kfback)
  76. ;create width control. note that if width is zero the result is the same as 'simple' mode
  77. atapL = afirst+atapL+(atapR*(1-kwidth))
  78. atapR = atapR+(atapL*(1-kwidth))
  79. endif
  80. amixL ntrpol ainL, atapL, kmix ;CREATE A DRY/WET MIX BETWEEN THE DRY AND THE EFFECT SIGNAL
  81. amixR ntrpol ainR, atapR, kmix ;CREATE A DRY/WET MIX BETWEEN THE DRY AND THE EFFECT SIGNAL
  82. outs amixL * klevel, amixR * klevel
  83. endin
  84. </CsInstruments>
  85. <CsScore>
  86. i 1 0 [3600*24*7]
  87. </CsScore>
  88. </CsoundSynthesizer>