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.

90 lines
3.9KB

  1. pvsmooth
  2. FFT feedback is disabled if amplitude smoothing is increased beyond zero. If this is not done the instrument will fail.
  3. <Cabbage>
  4. form caption("pvSmooth") size(505, 90), pluginID("smoo")
  5. image bounds(0, 0, 505, 90), colour("Cream"), outline("silver"), line(5)
  6. label pos(-5, -30), size(815, 150), fontcolour(210,105, 30, 80), text("smooth"), shape("rounded"), outline("white"), line(4)
  7. rslider bounds( 10, 8, 75, 75), text("Amp.Smooth"), channel("acf"), range(0, 1.00, 0, 0.75, 0.001),fontcolour(138, 54, 15),colour("chocolate"), tracker(138, 54, 15)
  8. rslider bounds( 90, 8, 75, 75), text("Frq.Smooth"), channel("fcf"), range(0, 1.00, 0, 0.5, 0.0001),fontcolour(138, 54, 15),colour("chocolate"), tracker(138, 54, 15)
  9. rslider bounds(170, 8, 75, 75), text("Feedback"), channel("FB"), range(0, 0.999, 0, 1,0.001),fontcolour(138, 54, 15),colour("chocolate"), tracker(138, 54, 15)
  10. rslider bounds(250, 8, 75, 75), text("FFT Size"), channel("att_table"), range(1,10, 5, 1,1),fontcolour(138, 54, 15),colour("chocolate"), tracker(138, 54, 15)
  11. rslider bounds(330, 8, 75, 75), text("Mix"), channel("mix"), range(0, 1.00, 1),fontcolour(138, 54, 15),colour("chocolate"), tracker(138, 54, 15)
  12. rslider bounds(410, 8, 75, 75), text("Level"), channel("lev"), range(0, 1.00, 0.5),fontcolour(138, 54, 15),colour("chocolate"), tracker(138, 54, 15)
  13. </Cabbage>
  14. <CsoundSynthesizer>
  15. <CsOptions>
  16. -d -n
  17. </CsOptions>
  18. <CsInstruments>
  19. sr = 44100
  20. ksmps = 32
  21. nchnls = 2
  22. 0dbfs = 1 ;MAXIMUM AMPLITUDE
  23. ;Iain McCurdy
  24. ;http://iainmccurdy.org/csound.html
  25. ;Spectral smoothing effect.
  26. /* FFT attribute tables */
  27. giFFTattributes1 ftgen 0, 0, 4, -2, 64, 32, 64, 1
  28. giFFTattributes2 ftgen 0, 0, 4, -2, 128, 64, 128, 1
  29. giFFTattributes3 ftgen 0, 0, 4, -2, 256, 128, 256, 1
  30. giFFTattributes4 ftgen 0, 0, 4, -2, 512, 128, 512, 1
  31. giFFTattributes5 ftgen 0, 0, 4, -2, 1024, 128, 1024, 1
  32. giFFTattributes6 ftgen 0, 0, 4, -2, 2048, 256, 2048, 1
  33. giFFTattributes7 ftgen 0, 0, 4, -2, 2048,1024, 2048, 1
  34. giFFTattributes8 ftgen 0, 0, 4, -2, 4096,1024, 4096, 1
  35. giFFTattributes9 ftgen 0, 0, 4, -2, 8192,2048, 8192, 1
  36. giFFTattributes10 ftgen 0, 0, 4, -2,16384,4096,16384, 1
  37. opcode pvsmooth_module,a,akkkkkiiii
  38. ain,kacf,kfcf,kfeedback,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype xin
  39. f_FB pvsinit iFFTsize,ioverlap,iwinsize,iwintype, 0 ;INITIALISE FEEDBACK FSIG
  40. f_anal pvsanal ain, iFFTsize, ioverlap, iwinsize, iwintype ;ANALYSE AUDIO INPUT SIGNAL AND OUTPUT AN FSIG
  41. f_mix pvsmix f_anal, f_FB ;MIX AUDIO INPUT WITH FEEDBACK SIGNAL
  42. f_smooth pvsmooth f_mix, kacf, kfcf ;BLUR AMPLITUDE AND FREQUENCY VALUES OF AN F-SIGNAL
  43. f_FB pvsgain f_smooth, kfeedback ;CREATE FEEDBACK F-SIGNAL FOR NEXT PASS
  44. aout pvsynth f_smooth ;RESYNTHESIZE THE f-SIGNAL AS AN AUDIO SIGNAL
  45. amix ntrpol ain, aout, kmix ;CREATE DRY/WET MIX
  46. xout amix*klev
  47. endop
  48. instr 1
  49. ainL,ainR ins
  50. ;ainL,ainR diskin "808loop.wav",1,0,1 ;USE FOR TESTING
  51. ;ainL,ainR diskin "SynthPad.wav",1,0,1 ;USE FOR TESTING
  52. katt_table chnget "att_table" ; FFT atribute table
  53. katt_table init 5
  54. ktrig changed katt_table
  55. if ktrig==1 then
  56. reinit update
  57. endif
  58. update:
  59. iFFTsize table 0, giFFTattributes1 + i(katt_table) - 1
  60. ioverlap table 1, giFFTattributes1 + i(katt_table) - 1
  61. iwinsize table 2, giFFTattributes1 + i(katt_table) - 1
  62. iwintype table 3, giFFTattributes1 + i(katt_table) - 1
  63. kfeedback chnget "FB"
  64. kacf chnget "acf"
  65. kfcf chnget "fcf"
  66. kfeedback = (kacf>0?0:kfeedback) ; feedback + amplitude smoothing can cause failure so we must protect against this
  67. kacf = 1-kacf
  68. kfcf = 1-kfcf
  69. kporttime linseg 0,0.001,0.02
  70. kmix chnget "mix"
  71. klev chnget "lev"
  72. aoutL pvsmooth_module ainL,kacf,kfcf,kfeedback,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype
  73. aoutR pvsmooth_module ainR,kacf,kfcf,kfeedback,kmix,klev,iFFTsize,ioverlap,iwinsize,iwintype
  74. outs aoutR,aoutR
  75. endin
  76. </CsInstruments>
  77. <CsScore>
  78. i 1 0 [60*60*24*7]
  79. </CsScore>
  80. </CsoundSynthesizer>