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.

488 lines
21KB

  1. GuitarChords
  2. ------------
  3. Mute buttons dictate the behaviour of a string when it is open and un-fretted, they have no effect on fretted notes.
  4. <Cabbage>
  5. form size(620, 260), caption("Guitar Chords"), pluginID("guit")
  6. label bounds( 56, 0, 80, 9), text("Mute"), FontColour("white")
  7. combobox bounds( 3, 10, 50, 15), channel("TuneHighE"), value(64), text("G9","F#9","F9","E9","D#9","D9","C#9","C9","B8","A#8","A8","G#8","G8","F#8","F8","E8","D#8","D8","C#8","C8","B7","A#7","A7","G#7","G7","F#7","F7","E7","D#7","D7","C#7","C7","B6","A#6","A6","G#6","G6","F#6","F6","E6","D#6","D6","C#6","C6","B5","A#5","A5","G#5","G5","F#5","F5","E5","D#5","D5","C#5","C5","B4","A#4","A4","G#4","G4","F#4","F4","E4","D#4","D4","C#4","C4","B3","A#3","A3","G#3","G3","F#3","F3","E3","D#3","D3","C#3","C3","B2","A#2","A2","G#2","G2","F#2","F2","E2","D#2","D2","C#2","C2","B1","A#1","A1","G#1","G1","F#1","F1","E1","D#1","D1","C#1","C1","B0","A#0","A0","G#0","G0","F#0","F0","E0","D#0","D0","C#0","C0","B-1","A#-1","A-1","G#-1","G-1","F#-1","F-1","E-1","D#-1","D-1","C#-1","C-1")
  8. checkbox bounds( 59, 10, 15, 15), channel("HighE0"), colour("255, 20, 20")
  9. checkbox bounds(101, 10, 15, 15), channel("HighE1"), colour("250,250, 0")
  10. checkbox bounds(153, 10, 15, 15), channel("HighE2"), colour("250,250, 0")
  11. checkbox bounds(202, 10, 15, 15), channel("HighE3"), colour("250,250, 0")
  12. checkbox bounds(249, 10, 15, 15), channel("HighE4"), colour("250,250, 0")
  13. checkbox bounds(295, 10, 15, 15), channel("HighE5"), colour("250,250, 0")
  14. checkbox bounds(339, 10, 15, 15), channel("HighE6"), colour("250,250, 0")
  15. checkbox bounds(381, 10, 15, 15), channel("HighE7"), colour("250,250, 0")
  16. checkbox bounds(420, 10, 15, 15), channel("HighE8"), colour("250,250, 0")
  17. checkbox bounds(460, 10, 15, 15), channel("HighE9"), colour("250,250, 0")
  18. checkbox bounds(495, 10, 15, 15), channel("HighE10"), colour("250,250, 0")
  19. checkbox bounds(529, 10, 15, 15), channel("HighE11"), colour("250,250, 0")
  20. checkbox bounds(561, 10, 15, 15), channel("HighE12"), colour("250,250, 0")
  21. checkbox bounds(591, 10, 15, 15), channel("HighE13"), colour("250,250, 0")
  22. combobox bounds( 3, 30, 50, 15), channel("TuneB"), value(69), text("G9","F#9","F9","E9","D#9","D9","C#9","C9","B8","A#8","A8","G#8","G8","F#8","F8","E8","D#8","D8","C#8","C8","B7","A#7","A7","G#7","G7","F#7","F7","E7","D#7","D7","C#7","C7","B6","A#6","A6","G#6","G6","F#6","F6","E6","D#6","D6","C#6","C6","B5","A#5","A5","G#5","G5","F#5","F5","E5","D#5","D5","C#5","C5","B4","A#4","A4","G#4","G4","F#4","F4","E4","D#4","D4","C#4","C4","B3","A#3","A3","G#3","G3","F#3","F3","E3","D#3","D3","C#3","C3","B2","A#2","A2","G#2","G2","F#2","F2","E2","D#2","D2","C#2","C2","B1","A#1","A1","G#1","G1","F#1","F1","E1","D#1","D1","C#1","C1","B0","A#0","A0","G#0","G0","F#0","F0","E0","D#0","D0","C#0","C0","B-1","A#-1","A-1","G#-1","G-1","F#-1","F-1","E-1","D#-1","D-1","C#-1","C-1")
  23. checkbox bounds( 59, 30, 15, 15), channel("B0"), colour("255, 20, 20")
  24. checkbox bounds(101, 30, 15, 15), channel("B1"), colour("250,250, 0"), value(1)
  25. checkbox bounds(153, 30, 15, 15), channel("B2"), colour("250,250, 0")
  26. checkbox bounds(202, 30, 15, 15), channel("B3"), colour("250,250, 0")
  27. checkbox bounds(249, 30, 15, 15), channel("B4"), colour("250,250, 0")
  28. checkbox bounds(295, 30, 15, 15), channel("B5"), colour("250,250, 0")
  29. checkbox bounds(339, 30, 15, 15), channel("B6"), colour("250,250, 0")
  30. checkbox bounds(381, 30, 15, 15), channel("B7"), colour("250,250, 0")
  31. checkbox bounds(420, 30, 15, 15), channel("B8"), colour("250,250, 0")
  32. checkbox bounds(460, 30, 15, 15), channel("B9"), colour("250,250, 0")
  33. checkbox bounds(495, 30, 15, 15), channel("B10"), colour("250,250, 0")
  34. checkbox bounds(529, 30, 15, 15), channel("B11"), colour("250,250, 0")
  35. checkbox bounds(561, 30, 15, 15), channel("B12"), colour("250,250, 0")
  36. checkbox bounds(591, 30, 15, 15), channel("B13"), colour("250,250, 0")
  37. combobox bounds( 3, 50, 50, 15), channel("TuneG"), value(73), text("G9","F#9","F9","E9","D#9","D9","C#9","C9","B8","A#8","A8","G#8","G8","F#8","F8","E8","D#8","D8","C#8","C8","B7","A#7","A7","G#7","G7","F#7","F7","E7","D#7","D7","C#7","C7","B6","A#6","A6","G#6","G6","F#6","F6","E6","D#6","D6","C#6","C6","B5","A#5","A5","G#5","G5","F#5","F5","E5","D#5","D5","C#5","C5","B4","A#4","A4","G#4","G4","F#4","F4","E4","D#4","D4","C#4","C4","B3","A#3","A3","G#3","G3","F#3","F3","E3","D#3","D3","C#3","C3","B2","A#2","A2","G#2","G2","F#2","F2","E2","D#2","D2","C#2","C2","B1","A#1","A1","G#1","G1","F#1","F1","E1","D#1","D1","C#1","C1","B0","A#0","A0","G#0","G0","F#0","F0","E0","D#0","D0","C#0","C0","B-1","A#-1","A-1","G#-1","G-1","F#-1","F-1","E-1","D#-1","D-1","C#-1","C-1")
  38. checkbox bounds( 59, 50, 15, 15), channel("G0"), colour("255, 20, 20")
  39. checkbox bounds(101, 50, 15, 15), channel("G1"), colour("250,250, 0")
  40. checkbox bounds(153, 50, 15, 15), channel("G2"), colour("250,250, 0")
  41. checkbox bounds(202, 50, 15, 15), channel("G3"), colour("250,250, 0")
  42. checkbox bounds(249, 50, 15, 15), channel("G4"), colour("250,250, 0")
  43. checkbox bounds(295, 50, 15, 15), channel("G5"), colour("250,250, 0")
  44. checkbox bounds(339, 50, 15, 15), channel("G6"), colour("250,250, 0")
  45. checkbox bounds(381, 50, 15, 15), channel("G7"), colour("250,250, 0")
  46. checkbox bounds(420, 50, 15, 15), channel("G8"), colour("250,250, 0")
  47. checkbox bounds(460, 50, 15, 15), channel("G9"), colour("250,250, 0")
  48. checkbox bounds(495, 50, 15, 15), channel("G10"), colour("250,250, 0")
  49. checkbox bounds(529, 50, 15, 15), channel("G11"), colour("250,250, 0")
  50. checkbox bounds(561, 50, 15, 15), channel("G12"), colour("250,250, 0")
  51. checkbox bounds(591, 50, 15, 15), channel("G13"), colour("250,250, 0")
  52. combobox bounds( 3, 70, 50, 15), channel("TuneD"), value(78), text("G9","F#9","F9","E9","D#9","D9","C#9","C9","B8","A#8","A8","G#8","G8","F#8","F8","E8","D#8","D8","C#8","C8","B7","A#7","A7","G#7","G7","F#7","F7","E7","D#7","D7","C#7","C7","B6","A#6","A6","G#6","G6","F#6","F6","E6","D#6","D6","C#6","C6","B5","A#5","A5","G#5","G5","F#5","F5","E5","D#5","D5","C#5","C5","B4","A#4","A4","G#4","G4","F#4","F4","E4","D#4","D4","C#4","C4","B3","A#3","A3","G#3","G3","F#3","F3","E3","D#3","D3","C#3","C3","B2","A#2","A2","G#2","G2","F#2","F2","E2","D#2","D2","C#2","C2","B1","A#1","A1","G#1","G1","F#1","F1","E1","D#1","D1","C#1","C1","B0","A#0","A0","G#0","G0","F#0","F0","E0","D#0","D0","C#0","C0","B-1","A#-1","A-1","G#-1","G-1","F#-1","F-1","E-1","D#-1","D-1","C#-1","C-1")
  53. checkbox bounds( 59, 70, 15, 15), channel("D0"), colour("255, 20, 20")
  54. checkbox bounds(101, 70, 15, 15), channel("D1"), colour("250,250, 0")
  55. checkbox bounds(153, 70, 15, 15), channel("D2"), colour("250,250, 0"), value(1)
  56. checkbox bounds(202, 70, 15, 15), channel("D3"), colour("250,250, 0")
  57. checkbox bounds(249, 70, 15, 15), channel("D4"), colour("250,250, 0")
  58. checkbox bounds(295, 70, 15, 15), channel("D5"), colour("250,250, 0")
  59. checkbox bounds(339, 70, 15, 15), channel("D6"), colour("250,250, 0")
  60. checkbox bounds(381, 70, 15, 15), channel("D7"), colour("250,250, 0")
  61. checkbox bounds(420, 70, 15, 15), channel("D8"), colour("250,250, 0")
  62. checkbox bounds(460, 70, 15, 15), channel("D9"), colour("250,250, 0")
  63. checkbox bounds(495, 70, 15, 15), channel("D10"), colour("250,250, 0")
  64. checkbox bounds(529, 70, 15, 15), channel("D11"), colour("250,250, 0")
  65. checkbox bounds(561, 70, 15, 15), channel("D12"), colour("250,250, 0")
  66. checkbox bounds(591, 70, 15, 15), channel("D13"), colour("250,250, 0")
  67. combobox bounds( 3, 90, 50, 15), channel("TuneA"), value(83), text("G9","F#9","F9","E9","D#9","D9","C#9","C9","B8","A#8","A8","G#8","G8","F#8","F8","E8","D#8","D8","C#8","C8","B7","A#7","A7","G#7","G7","F#7","F7","E7","D#7","D7","C#7","C7","B6","A#6","A6","G#6","G6","F#6","F6","E6","D#6","D6","C#6","C6","B5","A#5","A5","G#5","G5","F#5","F5","E5","D#5","D5","C#5","C5","B4","A#4","A4","G#4","G4","F#4","F4","E4","D#4","D4","C#4","C4","B3","A#3","A3","G#3","G3","F#3","F3","E3","D#3","D3","C#3","C3","B2","A#2","A2","G#2","G2","F#2","F2","E2","D#2","D2","C#2","C2","B1","A#1","A1","G#1","G1","F#1","F1","E1","D#1","D1","C#1","C1","B0","A#0","A0","G#0","G0","F#0","F0","E0","D#0","D0","C#0","C0","B-1","A#-1","A-1","G#-1","G-1","F#-1","F-1","E-1","D#-1","D-1","C#-1","C-1")
  68. checkbox bounds( 59, 90, 15, 15), channel("A0"), colour("255, 20, 20")
  69. checkbox bounds(101, 90, 15, 15), channel("A1"), colour("250,250, 0")
  70. checkbox bounds(153, 90, 15, 15), channel("A2"), colour("250,250, 0")
  71. checkbox bounds(202, 90, 15, 15), channel("A3"), colour("250,250, 0"), value(1)
  72. checkbox bounds(249, 90, 15, 15), channel("A4"), colour("250,250, 0")
  73. checkbox bounds(295, 90, 15, 15), channel("A5"), colour("250,250, 0")
  74. checkbox bounds(339, 90, 15, 15), channel("A6"), colour("250,250, 0")
  75. checkbox bounds(381, 90, 15, 15), channel("A7"), colour("250,250, 0")
  76. checkbox bounds(420, 90, 15, 15), channel("A8"), colour("250,250, 0")
  77. checkbox bounds(460, 90, 15, 15), channel("A9"), colour("250,250, 0")
  78. checkbox bounds(495, 90, 15, 15), channel("A10"), colour("250,250, 0")
  79. checkbox bounds(529, 90, 15, 15), channel("A11"), colour("250,250, 0")
  80. checkbox bounds(561, 90, 15, 15), channel("A12"), colour("250,250, 0")
  81. checkbox bounds(591, 90, 15, 15), channel("A13"), colour("250,250, 0")
  82. combobox bounds( 3,110, 50, 15), channel("TuneLowE"), value(88), text("G9","F#9","F9","E9","D#9","D9","C#9","C9","B8","A#8","A8","G#8","G8","F#8","F8","E8","D#8","D8","C#8","C8","B7","A#7","A7","G#7","G7","F#7","F7","E7","D#7","D7","C#7","C7","B6","A#6","A6","G#6","G6","F#6","F6","E6","D#6","D6","C#6","C6","B5","A#5","A5","G#5","G5","F#5","F5","E5","D#5","D5","C#5","C5","B4","A#4","A4","G#4","G4","F#4","F4","E4","D#4","D4","C#4","C4","B3","A#3","A3","G#3","G3","F#3","F3","E3","D#3","D3","C#3","C3","B2","A#2","A2","G#2","G2","F#2","F2","E2","D#2","D2","C#2","C2","B1","A#1","A1","G#1","G1","F#1","F1","E1","D#1","D1","C#1","C1","B0","A#0","A0","G#0","G0","F#0","F0","E0","D#0","D0","C#0","C0","B-1","A#-1","A-1","G#-1","G-1","F#-1","F-1","E-1","D#-1","D-1","C#-1","C-1")
  83. checkbox bounds( 59,110, 15, 15), channel("LowE0"), colour("255, 20, 20"), value(1)
  84. checkbox bounds(101,110, 15, 15), channel("LowE1"), colour("250,250, 0");52
  85. checkbox bounds(153,110, 15, 15), channel("LowE2"), colour("250,250, 0");49
  86. checkbox bounds(202,110, 15, 15), channel("LowE3"), colour("250,250, 0");47
  87. checkbox bounds(249,110, 15, 15), channel("LowE4"), colour("250,250, 0");46
  88. checkbox bounds(295,110, 15, 15), channel("LowE5"), colour("250,250, 0");44
  89. checkbox bounds(339,110, 15, 15), channel("LowE6"), colour("250,250, 0");42
  90. checkbox bounds(381,110, 15, 15), channel("LowE7"), colour("250,250, 0");39
  91. checkbox bounds(420,110, 15, 15), channel("LowE8"), colour("250,250, 0");40
  92. checkbox bounds(460,110, 15, 15), channel("LowE9"), colour("250,250, 0");35
  93. checkbox bounds(495,110, 15, 15), channel("LowE10"), colour("250,250, 0");34
  94. checkbox bounds(529,110, 15, 15), channel("LowE11"), colour("250,250, 0");32
  95. checkbox bounds(561,110, 15, 15), channel("LowE12"), colour("250,250, 0");30
  96. checkbox bounds(591,110, 15, 15), channel("LowE13"), colour("250,250, 0");
  97. ; frets
  98. line bounds(134, 5, 2, 130), colour(50,50,50) ; ;
  99. line bounds(185, 5, 2, 130), colour(50,50,50) ;3 ;
  100. line bounds(232, 5, 2, 130), colour(50,50,50) ; ;
  101. line bounds(279, 5, 2, 130), colour(50,50,50) ;5 ;
  102. line bounds(324, 5, 2, 130), colour(50,50,50) ; ;
  103. line bounds(367, 5, 2, 130), colour(50,50,50) ;7 ;
  104. line bounds(408, 5, 2, 130), colour(50,50,50) ; ;
  105. line bounds(447, 5, 2, 130), colour(50,50,50) ;9 ;
  106. line bounds(484, 5, 2, 130), colour(50,50,50) ; ;
  107. line bounds(519, 5, 2, 130), colour(50,50,50) ; ;
  108. line bounds(552, 5, 2, 130), colour(50,50,50) ;12 ;
  109. line bounds(583, 5, 2, 130), colour(50,50,50) ; ;
  110. line bounds(612, 5, 2, 130), colour(50,50,50) ;
  111. image bounds(185, 5, 47,130), colour("tan"), line(0) ; 3rd fret
  112. image bounds(279, 5, 45,130), colour("tan"), line(0) ; 5th fret
  113. image bounds(367, 5, 42,130), colour("tan"), line(0) ; 7th fret
  114. image bounds(447, 5, 37,130), colour("tan"), line(0) ; 9th fret
  115. image bounds(552, 5, 31,130), colour("tan"), line(0) ; 12th fret
  116. image bounds( 80, 0,624,140), colour("white"), line(0) ; neck
  117. button bounds( 80,150,100, 30), text("strum"), channel("strum"), value(0), FontColour("yellow")
  118. combobox bounds( 80,185, 95, 17), channel("GuitarType"), value(0), text("6 String","12 String")
  119. checkbox bounds(185,150,100, 20), channel("ReverseStrum"), text("Reverse") colour("lime")
  120. hslider bounds(280,143,270, 40), text("Gap"), colour("tan"), FontColour(195,126, 0), channel("gap"), range(0,0.5,0.05,0.5,0.0001)
  121. hslider bounds(280,168,270, 40), text("Damp"), colour("tan"), FontColour(195,126, 0), channel("damp"), range(0.01,0.99,0.17)
  122. hslider bounds(280,193,270, 40), text("Pos."), colour("tan"), FontColour(195,126, 0), channel("pos"), range(0.0001, 0.5, 0.02, 0.5, 0.001)
  123. image bounds(5, 235, 470, 20), colour(75, 85, 90, 50), plant("credit"){
  124. label bounds(0.03, 0.1, .6, .7), text("Author: Iain McCurdy |2013|"), colour("white"), FontColour(195,126, 0)
  125. }
  126. </Cabbage>
  127. <CsoundSynthesizer>
  128. <CsOptions>
  129. -n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
  130. </CsOptions>
  131. <CsInstruments>
  132. sr = 44100
  133. ksmps = 64
  134. nchnls = 2
  135. 0dbfs=1
  136. iDetuneRange = 0.025
  137. gidetune ftgen 0, 0, 8, -21, 6, iDetuneRange ; table of detuning values for each string in a 12 string guitar configuration
  138. instr 1
  139. ; radio buttons mechanism
  140. koff = 0 ; checkbox value when off (needs to be k-rate)
  141. kSumHighE = 0 ; sum of high E string buttons
  142. kSumB = 0 ; sum of B string buttons
  143. kSumG = 0 ; sum of G string buttons
  144. kSumD = 0 ; sum of D string buttons
  145. kSumA = 0 ; sum of A string buttons
  146. kSumLowE = 0 ; sum of low E string buttons
  147. kTrigSumHighE = 0 ; sum of high E string on triggers
  148. kTrigSumB = 0 ; sum of B string change triggers
  149. kTrigSumG = 0 ; sum of G string change triggers
  150. kTrigSumD = 0 ; sum of D string change triggers
  151. kTrigSumA = 0 ; sum of A string change triggers
  152. kTrigSumLowE = 0 ; sum of low E string change triggers
  153. kChangeTrigHighE = 0 ; sum of high E string change triggers
  154. kChangeTrigB = 0 ; sum of B string change triggers
  155. kChangeTrigG = 0 ; sum of G string change triggers
  156. kChangeTrigD = 0 ; sum of D string change triggers
  157. kChangeTrigA = 0 ; sum of A string change triggers
  158. kChangeTrigLowE = 0 ; sum of low E string change triggers
  159. ; macro for string set-up
  160. #define STRING_SETUP(LABEL)
  161. #
  162. k$LABEL0 chnget "$LABEL0"
  163. kTune$LABEL chnget "Tune$LABEL"
  164. #
  165. $STRING_SETUP(HighE)
  166. $STRING_SETUP(B)
  167. $STRING_SETUP(G)
  168. $STRING_SETUP(D)
  169. $STRING_SETUP(A)
  170. $STRING_SETUP(LowE)
  171. ; macro for check box input
  172. #define INPUT(N'LABEL)
  173. #
  174. k$LABEL$N chnget "$LABEL$N" ; read in checkbox value
  175. kSum$LABEL = kSum$LABEL + k$LABEL$N ; accumulate to value for all checkboxes for this string
  176. ktrig$N trigger k$LABEL$N,0.5,0 ; generate a trigger if this checkbox is switched *on*
  177. kTrigSum$LABEL = kTrigSum$LABEL + ktrig$N ; accumulation of all 'on' triggers for this string
  178. kChangeTrig changed k$LABEL$N ; generate a different trigger if this checkbox is switched either on or off
  179. kChangeTrig$LABEL = kChangeTrig$LABEL+kChangeTrig ; accumlation of all 'change' triggers for this string
  180. #
  181. ; macro for radio button switching mechanism
  182. #define SWITCH(N'LABEL)
  183. #
  184. if ktrig$N==1 then
  185. k$LABELVal = $N
  186. kgoto SKIP$LABEL$N
  187. endif
  188. chnset koff,"$LABEL$N"
  189. SKIP$LABEL$N:
  190. #
  191. $INPUT(1'HighE)
  192. $INPUT(2'HighE)
  193. $INPUT(3'HighE)
  194. $INPUT(4'HighE)
  195. $INPUT(5'HighE)
  196. $INPUT(6'HighE)
  197. $INPUT(7'HighE)
  198. $INPUT(8'HighE)
  199. $INPUT(9'HighE)
  200. $INPUT(10'HighE)
  201. $INPUT(11'HighE)
  202. $INPUT(12'HighE)
  203. $INPUT(13'HighE)
  204. if(kTrigSum$LABEL>0) then
  205. $SWITCH(1'HighE)
  206. $SWITCH(2'HighE)
  207. $SWITCH(3'HighE)
  208. $SWITCH(4'HighE)
  209. $SWITCH(5'HighE)
  210. $SWITCH(6'HighE)
  211. $SWITCH(7'HighE)
  212. $SWITCH(8'HighE)
  213. $SWITCH(9'HighE)
  214. $SWITCH(10'HighE)
  215. $SWITCH(11'HighE)
  216. $SWITCH(12'HighE)
  217. $SWITCH(13'HighE)
  218. endif
  219. $INPUT(1'B)
  220. $INPUT(2'B)
  221. $INPUT(3'B)
  222. $INPUT(4'B)
  223. $INPUT(5'B)
  224. $INPUT(6'B)
  225. $INPUT(7'B)
  226. $INPUT(8'B)
  227. $INPUT(9'B)
  228. $INPUT(10'B)
  229. $INPUT(11'B)
  230. $INPUT(12'B)
  231. $INPUT(13'B)
  232. if(kTrigSum$LABEL>0) then
  233. $SWITCH(1'B)
  234. $SWITCH(2'B)
  235. $SWITCH(3'B)
  236. $SWITCH(4'B)
  237. $SWITCH(5'B)
  238. $SWITCH(6'B)
  239. $SWITCH(7'B)
  240. $SWITCH(8'B)
  241. $SWITCH(9'B)
  242. $SWITCH(10'B)
  243. $SWITCH(11'B)
  244. $SWITCH(12'B)
  245. $SWITCH(13'B)
  246. endif
  247. $INPUT(1'G)
  248. $INPUT(2'G)
  249. $INPUT(3'G)
  250. $INPUT(4'G)
  251. $INPUT(5'G)
  252. $INPUT(6'G)
  253. $INPUT(7'G)
  254. $INPUT(8'G)
  255. $INPUT(9'G)
  256. $INPUT(10'G)
  257. $INPUT(11'G)
  258. $INPUT(12'G)
  259. $INPUT(13'G)
  260. if(kTrigSum$LABEL>0) then
  261. $SWITCH(1'G)
  262. $SWITCH(2'G)
  263. $SWITCH(3'G)
  264. $SWITCH(4'G)
  265. $SWITCH(5'G)
  266. $SWITCH(6'G)
  267. $SWITCH(7'G)
  268. $SWITCH(8'G)
  269. $SWITCH(9'G)
  270. $SWITCH(10'G)
  271. $SWITCH(11'G)
  272. $SWITCH(12'G)
  273. $SWITCH(13'G)
  274. endif
  275. $INPUT(1'D)
  276. $INPUT(2'D)
  277. $INPUT(3'D)
  278. $INPUT(4'D)
  279. $INPUT(5'D)
  280. $INPUT(6'D)
  281. $INPUT(7'D)
  282. $INPUT(8'D)
  283. $INPUT(9'D)
  284. $INPUT(10'D)
  285. $INPUT(11'D)
  286. $INPUT(12'D)
  287. $INPUT(13'D)
  288. if(kTrigSum$LABEL>0) then
  289. $SWITCH(1'D)
  290. $SWITCH(2'D)
  291. $SWITCH(3'D)
  292. $SWITCH(4'D)
  293. $SWITCH(5'D)
  294. $SWITCH(6'D)
  295. $SWITCH(7'D)
  296. $SWITCH(8'D)
  297. $SWITCH(9'D)
  298. $SWITCH(10'D)
  299. $SWITCH(11'D)
  300. $SWITCH(12'D)
  301. $SWITCH(13'D)
  302. endif
  303. $INPUT(1'A)
  304. $INPUT(2'A)
  305. $INPUT(3'A)
  306. $INPUT(4'A)
  307. $INPUT(5'A)
  308. $INPUT(6'A)
  309. $INPUT(7'A)
  310. $INPUT(8'A)
  311. $INPUT(9'A)
  312. $INPUT(10'A)
  313. $INPUT(11'A)
  314. $INPUT(12'A)
  315. $INPUT(13'A)
  316. if(kTrigSum$LABEL>0) then
  317. $SWITCH(1'A)
  318. $SWITCH(2'A)
  319. $SWITCH(3'A)
  320. $SWITCH(4'A)
  321. $SWITCH(5'A)
  322. $SWITCH(6'A)
  323. $SWITCH(7'A)
  324. $SWITCH(8'A)
  325. $SWITCH(9'A)
  326. $SWITCH(10'A)
  327. $SWITCH(11'A)
  328. $SWITCH(12'A)
  329. $SWITCH(13'A)
  330. endif
  331. $INPUT(1'LowE)
  332. $INPUT(2'LowE)
  333. $INPUT(3'LowE)
  334. $INPUT(4'LowE)
  335. $INPUT(5'LowE)
  336. $INPUT(6'LowE)
  337. $INPUT(7'LowE)
  338. $INPUT(8'LowE)
  339. $INPUT(9'LowE)
  340. $INPUT(10'LowE)
  341. $INPUT(11'LowE)
  342. $INPUT(12'LowE)
  343. $INPUT(13'LowE)
  344. if(kTrigSum$LABEL>0) then
  345. $SWITCH(1'LowE)
  346. $SWITCH(2'LowE)
  347. $SWITCH(3'LowE)
  348. $SWITCH(4'LowE)
  349. $SWITCH(5'LowE)
  350. $SWITCH(6'LowE)
  351. $SWITCH(7'LowE)
  352. $SWITCH(8'LowE)
  353. $SWITCH(9'LowE)
  354. $SWITCH(10'LowE)
  355. $SWITCH(11'LowE)
  356. $SWITCH(12'LowE)
  357. $SWITCH(13'LowE)
  358. endif
  359. ; macro that checks for open strings
  360. #define OPEN_STRING(LABEL)
  361. #
  362. if(kSum$LABEL==0) then
  363. k$LABELVal = 0
  364. endif
  365. #
  366. $OPEN_STRING(HighE)
  367. $OPEN_STRING(B)
  368. $OPEN_STRING(G)
  369. $OPEN_STRING(D)
  370. $OPEN_STRING(A)
  371. $OPEN_STRING(LowE)
  372. ; macro for operations when a string is plucked
  373. #define PLAY_STRING(LABEL'StringNum)
  374. #
  375. k$LABELNum = k$LABELVal + (128 - kTune$LABEL) ; derive MIDI note number (note that combobox value has to be inverted
  376. k$LABELCps = cpsmidinn(k$LABELNum) ; convert to cps
  377. kTimeElapsed timeinsts ; elapsed time form the start of this note (this will be used to prevent premature triggering of the string)
  378. if(kChangeTrig$LABEL==1&&kTimeElapsed>0.1) then ; if a change note trigger for this string has been received and time buffer has elapsed...
  379. turnoff2 2.$StringNum,4,1 ; turnoff this string
  380. if(kSum$LABEL==0&&k$LABEL0==1) kgoto SKIP$LABEL ; if this is an open and muted string jump string playing code
  381. schedkwhen kChangeTrig$LABEL,0,0,2.$StringNum,0,20,k$LABELCps,$StringNum ; play string (instr 2)
  382. endif
  383. if(kSum$LABEL==0&&k$LABEL0==1) kgoto SKIP$LABEL ; if this is an open and muted string jump string playing code
  384. kRndStrt random 0,kgap*0.15
  385. schedkwhen ktrig,0,0,2.$StringNum,kstart+kRndStrt,20,k$LABELCps,$StringNum ; play string (instr 2)
  386. kstart = kstart + kgap ; increment start time
  387. SKIP$LABEL: ; label
  388. #
  389. kstrum chnget "strum" ; 'strum' button
  390. ktrig changed kstrum ; if 'strum' button has been clicked...
  391. if ktrig==1 then ; ...
  392. turnoff2 2,0,1 ; turn off all playing strings (in preparation for the new chord)
  393. endif
  394. kgap chnget "gap"
  395. kreverse chnget "ReverseStrum"
  396. if kreverse==0 then
  397. kstart = 0 ; start time (for first string plucked
  398. else
  399. kstart = kgap*5
  400. kgap = -kgap
  401. endif
  402. $PLAY_STRING(LowE'1)
  403. $PLAY_STRING(A'2)
  404. $PLAY_STRING(D'3)
  405. $PLAY_STRING(G'4)
  406. $PLAY_STRING(B'5)
  407. $PLAY_STRING(HighE'6)
  408. endin
  409. instr 2 ; string pluck
  410. kdamp chnget "damp" ; damping
  411. iplk chnget "pos" ; pluck position
  412. iamp random 0.1,0.2
  413. iGuitarType chnget "GuitarType"
  414. if(iGuitarType==2) then ; if 12 string guitar...
  415. kmvt1 jspline 0.15,0.2,0.4 ; a bit of random pick-up movement animates the tone of the guitar
  416. kmvt2 jspline 0.15,0.2,0.4
  417. idtn table p5,gidetune ; detuning value. used in 12 string guitar only.
  418. if p5<5 then ; strings 1 - 4 are in octaves in a 12-string guitar
  419. a1 wgpluck2 iplk, iamp/2, p4, 0.2+kmvt1, kdamp
  420. a2 wgpluck2 iplk, iamp/2, p4*(2+idtn), 0.2+kmvt2, kdamp
  421. else ; strings 5 & 6 are in unison in a 12-string guitar
  422. a1 wgpluck2 iplk, iamp/2, p4, 0.2 +kmvt1, kdamp
  423. a2 wgpluck2 iplk, iamp/2, p4*(1+idtn), 0.2+rnd(0.5)+kmvt2, kdamp
  424. endif
  425. a2 delay a2,0.01+rnd(0.01) ; slight delay to second string
  426. asig = a1+a2
  427. else ; otherwise 6 string
  428. kmvt jspline 0.15,0.2,0.4
  429. asig wgpluck2 iplk, iamp, p4, 0.2+kmvt, kdamp
  430. endif
  431. aenv linsegr 0, 0.0008, 1, p3-0.1008, 0, 0.05, 0 ; amplitude envelope. Attack removes excessive 'click'. Decays to nothing across note duration (p3). Short release stage prevents click if a note is interrupted.
  432. /* FILTERING TO IMPROVE THE SOUND */
  433. af1 resonz asig,200,200
  434. af2 resonz asig,550,550
  435. af3 resonz asig,2100,2100
  436. asig sum af1,af2*5,af3
  437. asig = asig/200
  438. /* ------------------------------ */
  439. asig = asig*aenv
  440. outs asig, asig
  441. endin
  442. </CsInstruments>
  443. <CsScore>
  444. i 1 0 3600
  445. </CsScore>
  446. </CsoundSynthesizer>