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.

104 lines
4.3KB

  1. <Cabbage>
  2. form caption("pvscale Pitch Shifter") size(510, 90), pluginID("scal")
  3. image bounds( 15, 9, 60, 60), colour(30,30,30), shape("ellipse"), line(0)
  4. image bounds( 85, 9, 60, 60), colour(30,30,30), shape("ellipse"), line(0)
  5. image bounds(155, 9, 60, 60), colour(30,30,30), shape("ellipse"), line(0)
  6. image bounds(295, 9, 60, 60), colour(30,30,30), shape("ellipse"), line(0)
  7. image bounds(365, 9, 60, 60), colour(30,30,30), shape("ellipse"), line(0)
  8. image bounds(435, 9, 60, 60), colour(30,30,30), shape("ellipse"), line(0)
  9. image bounds(6,23, 498, 30), colour("grey"), shape("ellipse")
  10. image bounds(0, 0, 510, 90), colour("SlateGrey"), outline("silver"), line(4)
  11. rslider bounds(10, 10, 70, 70), text("Semitones"), channel("semis"), range(-24, 24, 7, 1, 1),fontcolour("black"),colour("DarkSlateGrey")
  12. rslider bounds(80, 10, 70, 70), text("Cents"), channel("cents"), range(-100, 100, 0, 1, 1),fontcolour("black"),colour("DarkSlateGrey")
  13. rslider bounds(150, 10, 70, 70), text("Feedback"), channel("FB"), range(0.00, 0.99, 0),fontcolour("black"),colour("DarkSlateGrey")
  14. combobox bounds(220, 28, 70,20), channel("FB_mode"), value(0), text("F Sig.", "Audio")
  15. label bounds(220, 54, 70, 12), text("F.back Mode"), FontColour("black")
  16. rslider bounds(290, 10, 70, 70), text("FFT Size"), channel("att_table"), range(1, 8, 5, 1,1), fontcolour("black"),colour("DarkSlateGrey")
  17. rslider bounds(360, 10, 70, 70), text("Mix"), channel("mix"), range(0, 1.00, 0.5),fontcolour("black"),colour("DarkSlateGrey")
  18. rslider bounds(430, 10, 70, 70), text("Level"), channel("lev"), range(0, 1.00, 0.5, 0.5),fontcolour("black"),colour("DarkSlateGrey")
  19. </Cabbage>
  20. <CsoundSynthesizer>
  21. <CsOptions>
  22. -d -n
  23. </CsOptions>
  24. <CsInstruments>
  25. sr = 44100
  26. ksmps = 32
  27. nchnls = 2
  28. 0dbfs = 1 ;MAXIMUM AMPLITUDE
  29. ;Iain McCurdy
  30. ;http://iainmccurdy.org/csound.html
  31. ;Pitch shifting effect using pvs scale opcode.
  32. /* FFT attribute tables */
  33. giFFTattributes1 ftgen 0, 0, 4, -2, 64, 32, 64, 1
  34. giFFTattributes2 ftgen 0, 0, 4, -2, 128, 64, 128, 1
  35. giFFTattributes3 ftgen 0, 0, 4, -2, 256, 128, 256, 1
  36. giFFTattributes4 ftgen 0, 0, 4, -2, 512, 128, 512, 1
  37. giFFTattributes5 ftgen 0, 0, 4, -2, 1024, 256, 1024, 1
  38. giFFTattributes6 ftgen 0, 0, 4, -2, 2048, 512, 2048, 1
  39. giFFTattributes7 ftgen 0, 0, 4, -2, 4096,1024, 4096, 1
  40. giFFTattributes8 ftgen 0, 0, 4, -2, 8192,2048, 8192, 1
  41. opcode pvscale_module,a,akkkkkiiii
  42. ain,kscale,kfeedback,kFB_mode,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype xin
  43. if(kFB_mode==0) then
  44. f_FB pvsinit iFFTsize,ioverlap,iwinsize,iwintype, 0 ;INITIALISE FEEDBACK FSIG
  45. f_anal pvsanal ain, iFFTsize, ioverlap, iwinsize, iwintype ;ANALYSE AUDIO INPUT SIGNAL AND OUTPUT AN FSIG
  46. f_mix pvsmix f_anal, f_FB ;MIX AUDIO INPUT WITH FEEDBACK SIGNAL
  47. f_scale pvscale f_mix, kscale ;RESCALE FREQUENCIES
  48. f_FB pvsgain f_scale, kfeedback ;CREATE FEEDBACK F-SIGNAL FOR NEXT PASS
  49. aout pvsynth f_scale ;RESYNTHESIZE THE f-SIGNAL AS AN AUDIO SIGNAL
  50. else
  51. aFB init 0
  52. f_anal pvsanal ain+aFB, iFFTsize, ioverlap, iwinsize, iwintype ;ANALYSE AUDIO INPUT SIGNAL AND OUTPUT AN FSIG
  53. f_scale pvscale f_anal, kscale ;RESCALE FREQUENCIES
  54. aout pvsynth f_scale ;RESYNTHESIZE THE f-SIGNAL AS AN AUDIO SIGNAL
  55. aFB = aout*kfeedback
  56. endif
  57. amix ntrpol ain, aout, kmix ;CREATE DRY/WET MIX
  58. xout amix*klev
  59. endop
  60. instr 1
  61. ainL,ainR ins
  62. ;ainL,ainR diskin2 "SynthPad.wav",1,0,1
  63. kmix chnget "mix"
  64. kFB chnget "FB"
  65. kFB_mode chnget "FB_mode"
  66. /* SET FFT ATTRIBUTES */
  67. katt_table chnget "att_table" ; FFT atribute table
  68. katt_table init 5
  69. ktrig changed katt_table
  70. if ktrig==1 then
  71. reinit update
  72. endif
  73. update:
  74. iFFTsize table 0, giFFTattributes1 + i(katt_table) - 1
  75. ioverlap table 1, giFFTattributes1 + i(katt_table) - 1
  76. iwinsize table 2, giFFTattributes1 + i(katt_table) - 1
  77. iwintype table 3, giFFTattributes1 + i(katt_table) - 1
  78. /*-------------------*/
  79. kfeedback chnget "FB"
  80. ksemis chnget "semis"
  81. kcents chnget "cents"
  82. kmix chnget "mix"
  83. klev chnget "lev"
  84. kporttime linseg 0,0.001,0.02
  85. kscale = semitone(ksemis)*cent(kcents)
  86. aoutL pvscale_module ainL,kscale,kfeedback,kFB_mode,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype
  87. aoutR pvscale_module ainR,kscale,kfeedback,kFB_mode,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype
  88. outs aoutR,aoutR
  89. endin
  90. </CsInstruments>
  91. <CsScore>
  92. i 1 0 [60*60*24*7]
  93. </CsScore>
  94. </CsoundSynthesizer>