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.

160 lines
4.4KB

  1. <Cabbage>
  2. form caption("Additive synthesizer") size(562, 340), colour("black"),pluginID("add1")
  3. rslider bounds(15, 10, 100, 100) channel("speed"), range(1,10,2), caption("Speed"), colour("lime ")
  4. rslider bounds(120, 10, 100, 100) channel("semi"), range(-12,12,0), caption("Coarse"), colour("lime ")
  5. rslider bounds(225, 10, 100, 100) channel("partials"), range(3,8,4), caption("Partials"), colour("lime ")
  6. rslider bounds(330, 10, 100, 100) caption("Vib Amp"), colour("lime "), channel("lfoamp"), range(0,20, 0)
  7. rslider bounds(435, 10, 100, 100) caption("Vib Rate"), colour("lime "), channel("lforate"), range(0,20, 0)
  8. groupbox bounds(15, 120, 240, 100), text("ADSR amplitude"), plant("ADSR"){
  9. rslider bounds(0, .3, .6, .6), text("A"), colour("lime"), channel("att"), range(0.01,3, .5)
  10. rslider bounds(.25, .3, .6, .6), text("D"), colour("lime "), channel("dec"), range(0,1, .5)
  11. rslider bounds(.5, .3, .6, .6), text("S"), colour("lime "), channel("sus"), range(0,1,.8)
  12. rslider bounds(.75, .3, .6, .6), text("R"), colour("lime "), channel("rel"), range(0.01,3, .2)
  13. }
  14. groupbox bounds(285, 120, 250, 100), text("Filter/Reverb"), plant("filtrev"){
  15. rslider bounds(0, .3, .6, .6), text("cutoff"), colour("lime "), channel("cutoff"), range(200,8000,1000)
  16. rslider bounds(.25, .3, .6, .6),text("level"), colour("lime "), channel("level"), range(0,1,.7)
  17. rslider bounds(.5, .3, .6, .6), text("size"), colour("lime "), channel("size"), range(.1,.99,.8)
  18. checkbox bounds(.75, .40, .60, .30),channel("onoff"), text("ON"), value(0)
  19. }
  20. keyboard pos(10, 240), size(540, 60)
  21. </Cabbage>
  22. <CsoundSynthesizer>
  23. <CsOptions>
  24. -d -n -+rtmidi=null -M0 -b1024 -m0d
  25. </CsOptions>
  26. <CsInstruments>
  27. sr = 44100
  28. ksmps = 32
  29. nchnls = 2
  30. 0dbfs = 1
  31. ;Author: Giorgio Zucco (2012)
  32. garev init 0
  33. instr 1
  34. ;channel
  35. kspeed chnget "speed"
  36. ksemi1 chnget "semi"
  37. ktable chnget "partials"
  38. iatt chnget "att"
  39. idec chnget "dec"
  40. isus chnget "sus"
  41. irel chnget "rel"
  42. klfoamp chnget "lfoamp"
  43. klforate chnget "lforate"
  44. kcutoff chnget "cutoff"
  45. ;midi
  46. imidinn notnum
  47. iamp ampmidi 1
  48. kbend pchbend 0,2 ;pitch bend
  49. kbasefreq = cpsmidinn(imidinn+kbend+int(ksemi1)) ;controllo midi
  50. ;vibrato
  51. klfo vibr klfoamp,klforate,1
  52. ;additive
  53. kpartial init 3
  54. iamptab = 2 ;tabella ampiezze
  55. kpartial = int(ktable) ;tabella parziali
  56. ktrig changed kpartial
  57. if ktrig = 1 then
  58. reinit play
  59. endif
  60. play:
  61. k1 randomh 1,7,kspeed ;indice della tabella letto in modo casuale
  62. k2 randomh 1,7,kspeed-.9 ;simile ad un arpeggio di armonici con rate indipendente
  63. k3 randomh 1,7,kspeed-.8
  64. k4 randomh 1,7,kspeed-.7
  65. k5 randomh 1,7,kspeed-.6
  66. k6 randomh 1,7,kspeed-.5
  67. k7 randomh 1,7,kspeed-.4
  68. ;tabella delle parziali
  69. kfreqtable1 table k1,i(kpartial)
  70. kfreqtable2 table k2,i(kpartial)
  71. kfreqtable3 table k3,i(kpartial)
  72. kfreqtable4 table k4,i(kpartial)
  73. kfreqtable5 table k5,i(kpartial)
  74. kfreqtable6 table k6,i(kpartial)
  75. kfreqtable7 table k7,i(kpartial)
  76. ;tabella ampiezze
  77. iamptable1 table 1,iamptab
  78. iamptable2 table 2,iamptab
  79. iamptable3 table 3,iamptab
  80. iamptable4 table 4,iamptab
  81. iamptable5 table 5,iamptab
  82. iamptable6 table 6,iamptab
  83. iamptable7 table 7,iamptab
  84. ;otto oscillatori
  85. a1 poscil iamp*2,(kbasefreq+klfo),1 ;frequenza fondamentale
  86. a2 poscil iamp*iamptable1,((kbasefreq+klfo)+klfo)*kfreqtable1,1
  87. a3 poscil iamp*iamptable2,(kbasefreq+klfo)*kfreqtable2,1
  88. a4 poscil iamp*iamptable3,(kbasefreq+klfo)*kfreqtable3,1
  89. a5 poscil iamp*iamptable4,(kbasefreq+klfo)*kfreqtable4,1
  90. a6 poscil iamp*iamptable5,(kbasefreq+klfo)*kfreqtable5,1
  91. a7 poscil iamp*iamptable6,(kbasefreq+klfo)*kfreqtable6,1
  92. a8 poscil iamp*iamptable7,(kbasefreq+klfo)*kfreqtable7,1
  93. asum sum a1,a2,a3,a4,a5,a6,a7,a8 ;somma degli oscillatori
  94. afilt clfilt asum/8,kcutoff,0,4
  95. aout clip afilt,0,0dbfs
  96. kenv mxadsr iatt,idec,isus,irel
  97. outs aout*kenv,aout*kenv ;uscita con inviluppo
  98. vincr garev,aout*kenv
  99. endin
  100. instr 3 ;reverb
  101. ktrig chnget "onoff"
  102. klevel chnget "level"
  103. ksize chnget "size"
  104. if ktrig = 1 then
  105. al,ar reverbsc garev,garev,ksize,16000,sr,0
  106. adc1 dcblock2 al
  107. adc2 dcblock2 ar
  108. kpan1 randomi 0,1,4
  109. kpan2 randomi 0,1,8
  110. aout1,aout2 pan2 adc1,kpan1
  111. aout3,aout4 pan2 adc2,1-kpan2
  112. asum1 = (aout1+aout2)*klevel
  113. asum2 = (aout3+aout4)*klevel
  114. else
  115. asum1 = 0
  116. asum2 = 0
  117. endif
  118. outs asum1,asum2
  119. clear garev
  120. endin
  121. </CsInstruments>
  122. <CsScore>
  123. f1 0 16384 10 1
  124. f2 0 -7 -2 .9 .8 .7 .6 .5 .4 .3 .2 ;ampiezze parziali
  125. f3 0 -7 -2 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 ;parziali
  126. f4 0 -7 -2 1 2 3 4 5 6 7 8
  127. f5 0 -7 -2 1 1.2 1.4 1.6 1.8 2 2.4 2.6
  128. f6 0 -7 -2 1 2 4 5 7 8 10 11
  129. f7 0 -7 -2 1 1.3 1.5 1.7 1.9 2.11 3.13 4.15
  130. f8 0 -7 -2 1 1 3 5 7 9 11 13
  131. i1 0 36000
  132. i3 0 36000
  133. </CsScore>
  134. </CsoundSynthesizer>