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.

94 lines
4.4KB

  1. <Cabbage>
  2. form caption("pvshift Frequency Shifter") size(510, 90), pluginID("shft")
  3. image bounds( 15, 9, 60, 60), colour(30,30,30,100), shape("ellipse"), line(0)
  4. image bounds( 85, 9, 60, 60), colour(30,30,30,100), shape("ellipse"), line(0)
  5. image bounds(155, 9, 60, 60), colour(30,30,30,100), shape("ellipse"), line(0)
  6. image bounds(225, 9, 60, 60), colour(30,30,30,100), shape("ellipse"), line(0)
  7. image bounds(295, 9, 60, 60), colour(30,30,30,100), shape("ellipse"), line(0)
  8. image bounds(365, 9, 60, 60), colour(30,30,30,100), shape("ellipse"), line(0)
  9. image bounds(435, 9, 60, 60), colour(30,30,30,100), shape("ellipse"), line(0)
  10. image bounds(-60,-10,630,110), colour(150,255,100,200), outline("silver"), line(6), shape("ellipse")
  11. rslider bounds( 10, 10, 70, 70), text("Coarse"), channel("coarse"), range(-4000, 4000, 0, 1), fontcolour("black"), colour("orange"), trackercolour("yellow")
  12. rslider bounds( 80, 10, 70, 70), text("Multiplier"), channel("fine"), range(-1, 1, 1, 1, 0.0001), fontcolour("black"), colour("orange"), trackercolour("yellow")
  13. rslider bounds(150, 10, 70, 70), text("Lowest"), channel("lowest"), range( 20, 20000, 20, 0.5), fontcolour("black"), colour("orange"), trackercolour("yellow")
  14. rslider bounds(220, 10, 70, 70), text("Feedback"), channel("FB"), range(0, 1.00, 0), fontcolour("black"), colour("orange"), trackercolour("yellow")
  15. rslider bounds(290, 10, 70, 70), text("FFT Size"), channel("att_table"), range(1, 8, 5, 1,1), fontcolour("black"), colour("orange"), trackercolour("yellow")
  16. rslider bounds(360, 10, 70, 70), text("Mix"), channel("mix"), range(0, 1.00, 1), fontcolour("black"), colour("orange"), trackercolour("yellow")
  17. rslider bounds(430, 10, 70, 70), text("Level"), channel("lev"), range(0, 1.00, 0.5, 0.5), fontcolour("black"), colour("orange"), trackercolour("yellow")
  18. </Cabbage>
  19. <CsoundSynthesizer>
  20. <CsOptions>
  21. -d -n
  22. </CsOptions>
  23. <CsInstruments>
  24. sr = 44100
  25. ksmps = 32
  26. nchnls = 2
  27. 0dbfs = 1 ;MAXIMUM AMPLITUDE
  28. ;Iain McCurdy
  29. ;http://iainmccurdy.org/csound.html
  30. ;Frequency shifting effect using pvshift opcode.
  31. /* FFT attribute tables */
  32. giFFTattributes1 ftgen 0, 0, 4, -2, 64, 32, 64, 1
  33. giFFTattributes2 ftgen 0, 0, 4, -2, 128, 64, 128, 1
  34. giFFTattributes3 ftgen 0, 0, 4, -2, 256, 128, 256, 1
  35. giFFTattributes4 ftgen 0, 0, 4, -2, 512, 128, 512, 1
  36. giFFTattributes5 ftgen 0, 0, 4, -2, 1024, 256, 1024, 1
  37. giFFTattributes6 ftgen 0, 0, 4, -2, 2048, 512, 2048, 1
  38. giFFTattributes7 ftgen 0, 0, 4, -2, 4096,1024, 4096, 1
  39. giFFTattributes8 ftgen 0, 0, 4, -2, 8192,2048, 8192, 1
  40. opcode pvshift_module,a,akkkkkiiii
  41. ain,kshift,klowest,kfeedback,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype xin
  42. f_FB pvsinit iFFTsize,ioverlap,iwinsize,iwintype, 0 ;INITIALISE FEEDBACK FSIG
  43. f_anal pvsanal ain, iFFTsize, ioverlap, iwinsize, iwintype ;ANALYSE AUDIO INPUT SIGNAL AND OUTPUT AN FSIG
  44. f_mix pvsmix f_anal, f_FB ;MIX AUDIO INPUT WITH FEEDBACK SIGNAL
  45. f_shift pvshift f_mix, kshift, klowest ;SHIFT FREQUENCIES
  46. f_FB pvsgain f_shift, kfeedback ;CREATE FEEDBACK F-SIGNAL FOR NEXT PASS
  47. aout pvsynth f_shift ;RESYNTHESIZE THE f-SIGNAL AS AN AUDIO SIGNAL
  48. amix ntrpol ain, aout, kmix ;CREATE DRY/WET MIX
  49. xout amix*klev
  50. endop
  51. instr 1
  52. ainL,ainR ins
  53. ;ainL,ainR diskin2 "SynthPad.wav",1,0,1
  54. kcoarse chnget "coarse" ; coarse freq. shift
  55. kfine chnget "fine" ; fine freq. control (multipler)
  56. kporttime linseg 0,0.001,0.2
  57. kshift lineto kcoarse*kfine, kporttime ; ultimate freq. shift is sum of coarse and fine controls
  58. klowest chnget "lowest" ; lowest shifted frequency
  59. kFB chnget "FB" ; feedback amount
  60. kmix chnget "mix"
  61. klev chnget "lev"
  62. /* SET FFT ATTRIBUTES */
  63. katt_table chnget "att_table" ; FFT atribute table
  64. katt_table init 5
  65. ktrig changed katt_table
  66. if ktrig==1 then
  67. reinit update
  68. endif
  69. update:
  70. iFFTsize table 0, giFFTattributes1 + i(katt_table) - 1
  71. ioverlap table 1, giFFTattributes1 + i(katt_table) - 1
  72. iwinsize table 2, giFFTattributes1 + i(katt_table) - 1
  73. iwintype table 3, giFFTattributes1 + i(katt_table) - 1
  74. /*-------------------*/
  75. aoutL pvshift_module ainL,kshift,klowest,kFB,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype ; call UDO for each channel
  76. aoutR pvshift_module ainR,kshift,klowest,kFB,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype
  77. outs aoutR,aoutR
  78. endin
  79. </CsInstruments>
  80. <CsScore>
  81. i 1 0 [60*60*24*7]
  82. </CsScore>
  83. </CsoundSynthesizer>