Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

699 lines
31KB

  1. /* Testing new synth module Rectifier
  2. * https://forum.pjrc.com/threads/61384?p=243547&viewfull=1#post243547
  3. *
  4. * Copyright 2020 Bradley Sanders. This is free software under GPL2.
  5. * Based on Revalogics vocoder and incorporating new Rectifier module
  6. * to generate dc control voltages
  7. *
  8. * Teensy 4.0 or higher is required to run this example. It uses
  9. * about 31% of the CPU time on Teensy 4.0 when running at 600 MHz.
  10. */
  11. #include <Audio.h>
  12. const int myInput = AUDIO_INPUT_LINEIN;
  13. // GUItool: begin automatically generated code
  14. AudioInputI2S i2s2; //xy=138.22221755981445,1116.9999799728394
  15. AudioMixer4 mixer1; //xy=303,1125
  16. AudioMixer4 mixer2; //xy=303,1187
  17. AudioFilterStateVariable filter39; //xy=468,1259
  18. AudioFilterStateVariable filter41; //xy=469,1306
  19. AudioFilterStateVariable filter43; //xy=469,1351
  20. AudioFilterStateVariable filter45; //xy=469,1397
  21. AudioFilterStateVariable filter47; //xy=469,1443
  22. AudioFilterStateVariable filter49; //xy=469,1489
  23. AudioFilterStateVariable filter51; //xy=469,1535
  24. AudioFilterStateVariable filter1; //xy=476,727
  25. AudioFilterStateVariable filter3; //xy=476,773
  26. AudioFilterStateVariable filter5; //xy=476,818
  27. AudioFilterStateVariable filter7; //xy=476,864
  28. AudioFilterStateVariable filter9; //xy=476,910
  29. AudioFilterStateVariable filter11; //xy=476,956
  30. AudioFilterStateVariable filter13; //xy=476,1002
  31. AudioFilterStateVariable filter40; //xy=606,1260
  32. AudioFilterStateVariable filter42; //xy=608,1305
  33. AudioFilterStateVariable filter44; //xy=608,1350
  34. AudioFilterStateVariable filter46; //xy=608,1396
  35. AudioFilterStateVariable filter48; //xy=608,1442
  36. AudioFilterStateVariable filter50; //xy=608,1488
  37. AudioFilterStateVariable filter52; //xy=608,1534
  38. AudioFilterStateVariable filter2; //xy=615,726
  39. AudioFilterStateVariable filter4; //xy=615,772
  40. AudioFilterStateVariable filter6; //xy=615,817
  41. AudioFilterStateVariable filter8; //xy=615,863
  42. AudioFilterStateVariable filter10; //xy=615,909
  43. AudioFilterStateVariable filter12; //xy=615,955
  44. AudioFilterStateVariable filter14; //xy=615,1001
  45. AudioAnalyzePeak peak21; //xy=622.8888740539551,1154.777837753296
  46. AudioAnalyzePeak peak20; //xy=625.111083984375,1121.3332829475403
  47. AudioEffectRectifier Rect5; //xy=749,908
  48. AudioEffectRectifier Rect7; //xy=749,995
  49. AudioEffectRectifier Rect4; //xy=750,865
  50. AudioEffectRectifier Rect6; //xy=751,955
  51. AudioEffectRectifier Rect2; //xy=753,774
  52. AudioEffectRectifier Rect3; //xy=754,819
  53. AudioEffectRectifier Rect1; //xy=755,725
  54. AudioEffectMultiply multiply2; //xy=758,1257
  55. AudioEffectMultiply multiply3; //xy=758,1311
  56. AudioEffectMultiply multiply6; //xy=758,1447
  57. AudioEffectMultiply multiply7; //xy=758,1493
  58. AudioEffectMultiply multiply4; //xy=759,1358
  59. AudioEffectMultiply multiply8; //xy=759,1539
  60. AudioEffectMultiply multiply5; //xy=760,1402
  61. AudioMixer4 mixer3; //xy=841,1638
  62. AudioMixer4 mixer4; //xy=842,1700
  63. AudioFilterBiquad biquad4; //xy=888,774
  64. AudioFilterBiquad biquad3; //xy=889,724
  65. AudioFilterBiquad biquad6; //xy=889,863
  66. AudioFilterBiquad biquad9; //xy=889,995
  67. AudioFilterBiquad biquad7; //xy=890,909
  68. AudioFilterBiquad biquad8; //xy=890,955
  69. AudioFilterBiquad biquad5; //xy=891,819
  70. AudioFilterStateVariable filter53; //xy=947,1260
  71. AudioFilterStateVariable filter55; //xy=947,1306
  72. AudioFilterStateVariable filter57; //xy=947,1351
  73. AudioFilterStateVariable filter59; //xy=947,1397
  74. AudioFilterStateVariable filter61; //xy=947,1443
  75. AudioFilterStateVariable filter63; //xy=947,1489
  76. AudioFilterStateVariable filter65; //xy=947,1535
  77. AudioSynthNoiseWhite noise1; //xy=1079.222255706787,1143.2221994400024
  78. AudioFilterStateVariable filter54; //xy=1086,1259
  79. AudioFilterStateVariable filter56; //xy=1086,1305
  80. AudioFilterStateVariable filter58; //xy=1086,1350
  81. AudioFilterStateVariable filter60; //xy=1086,1396
  82. AudioFilterStateVariable filter62; //xy=1086,1442
  83. AudioFilterStateVariable filter64; //xy=1086,1488
  84. AudioFilterStateVariable filter66; //xy=1086,1534
  85. AudioFilterStateVariable filter15; //xy=1103,704
  86. AudioFilterStateVariable filter17; //xy=1103,750
  87. AudioFilterStateVariable filter19; //xy=1103,795
  88. AudioFilterStateVariable filter21; //xy=1103,841
  89. AudioFilterStateVariable filter23; //xy=1103,887
  90. AudioFilterStateVariable filter25; //xy=1103,933
  91. AudioFilterStateVariable filter27; //xy=1103,979
  92. AudioEffectMultiply multiply9; //xy=1226,1257
  93. AudioEffectMultiply multiply10; //xy=1227,1310
  94. AudioEffectMultiply multiply11; //xy=1227,1354
  95. AudioEffectMultiply multiply13; //xy=1228,1446
  96. AudioEffectMultiply multiply14; //xy=1229,1493
  97. AudioEffectMultiply multiply15; //xy=1229,1540
  98. AudioEffectMultiply multiply12; //xy=1231,1407
  99. AudioFilterStateVariable filter16; //xy=1242,703
  100. AudioFilterStateVariable filter18; //xy=1242,749
  101. AudioFilterStateVariable filter20; //xy=1242,794
  102. AudioFilterStateVariable filter22; //xy=1242,840
  103. AudioFilterStateVariable filter24; //xy=1242,886
  104. AudioFilterStateVariable filter26; //xy=1242,932
  105. AudioFilterStateVariable filter28; //xy=1242,978
  106. AudioMixer4 mixer5; //xy=1305,1640
  107. AudioMixer4 mixer6; //xy=1306,1702
  108. AudioEffectRectifier Rect9; //xy=1373,748
  109. AudioEffectRectifier Rect8; //xy=1374,704
  110. AudioEffectRectifier Rect11; //xy=1375,841
  111. AudioEffectRectifier Rect10; //xy=1379,795
  112. AudioEffectRectifier Rect12; //xy=1379,888
  113. AudioEffectRectifier Rect13; //xy=1379,932
  114. AudioEffectRectifier Rect14; //xy=1381,982
  115. AudioFilterBiquad biquad10; //xy=1505,706
  116. AudioFilterBiquad biquad13; //xy=1505,842
  117. AudioFilterBiquad biquad11; //xy=1506,748
  118. AudioFilterBiquad biquad12; //xy=1507,795
  119. AudioFilterBiquad biquad14; //xy=1508,888
  120. AudioFilterBiquad biquad15; //xy=1509,932
  121. AudioFilterBiquad biquad16; //xy=1511,980
  122. AudioFilterStateVariable filter67; //xy=1517,1246
  123. AudioFilterStateVariable filter69; //xy=1517,1292
  124. AudioFilterStateVariable filter71; //xy=1517,1337
  125. AudioFilterStateVariable filter73; //xy=1517,1383
  126. AudioFilterStateVariable filter75; //xy=1517,1429
  127. AudioFilterStateVariable filter77; //xy=1517,1475
  128. AudioMixer4 mixer9; //xy=1628.1111221313477,1624.6666507720947
  129. AudioMixer4 mixer10; //xy=1629,1700
  130. AudioFilterStateVariable filter68; //xy=1656,1245
  131. AudioFilterStateVariable filter70; //xy=1656,1291
  132. AudioFilterStateVariable filter72; //xy=1656,1336
  133. AudioFilterStateVariable filter74; //xy=1656,1382
  134. AudioFilterStateVariable filter76; //xy=1656,1428
  135. AudioFilterStateVariable filter78; //xy=1656,1474
  136. AudioFilterStateVariable filter29; //xy=1749,778
  137. AudioFilterStateVariable filter31; //xy=1749,824
  138. AudioFilterStateVariable filter33; //xy=1749,869
  139. AudioFilterStateVariable filter35; //xy=1749,915
  140. AudioFilterStateVariable filter37; //xy=1749,961
  141. AudioMixer4 mixer11; //xy=1791,1665
  142. AudioEffectMultiply multiply21; //xy=1798,1478
  143. AudioEffectMultiply multiply20; //xy=1799.222267150879,1427.999948501587
  144. AudioEffectMultiply multiply17; //xy=1800,1290
  145. AudioEffectMultiply multiply19; //xy=1800,1384
  146. AudioEffectMultiply multiply16; //xy=1801,1242
  147. AudioEffectMultiply multiply18; //xy=1801,1338
  148. AudioFilterStateVariable filter30; //xy=1888,777
  149. AudioFilterStateVariable filter32; //xy=1888,823
  150. AudioFilterStateVariable filter34; //xy=1888,868
  151. AudioFilterStateVariable filter36; //xy=1888,914
  152. AudioFilterStateVariable filter38; //xy=1888,960
  153. AudioMixer4 mixer7; //xy=1981,1346
  154. AudioMixer4 mixer8; //xy=1980.888957977295,1405.6665725708008
  155. AudioEffectRectifier Rect17; //xy=2018,869
  156. AudioEffectRectifier Rect18; //xy=2018,914
  157. AudioEffectRectifier Rect19; //xy=2020,961
  158. AudioEffectRectifier Rect16; //xy=2021,822
  159. AudioEffectRectifier Rect15; //xy=2022,777
  160. AudioOutputI2S i2s1; //xy=2094.2222061157227,1631.8888421058655
  161. AudioFilterBiquad biquad18; //xy=2154,824
  162. AudioFilterBiquad biquad17; //xy=2158,780
  163. AudioFilterBiquad biquad19; //xy=2158,870
  164. AudioFilterBiquad biquad21; //xy=2158,962
  165. AudioFilterBiquad biquad20; //xy=2159,912
  166. //AudioOutputUSB usb1; //xy=2187.555633544922,661.6666431427002
  167. AudioConnection patchCord1(i2s2, 1, mixer1, 0);
  168. AudioConnection patchCord2(i2s2, 0, mixer2, 0);
  169. AudioConnection patchCord3(mixer1, 0, filter1, 0);
  170. AudioConnection patchCord4(mixer1, 0, filter3, 0);
  171. AudioConnection patchCord5(mixer1, 0, filter5, 0);
  172. AudioConnection patchCord6(mixer1, 0, filter7, 0);
  173. AudioConnection patchCord7(mixer1, 0, filter9, 0);
  174. AudioConnection patchCord8(mixer1, 0, filter11, 0);
  175. AudioConnection patchCord9(mixer1, 0, filter13, 0);
  176. AudioConnection patchCord10(mixer1, 0, filter15, 0);
  177. AudioConnection patchCord11(mixer1, 0, filter17, 0);
  178. AudioConnection patchCord12(mixer1, 0, filter19, 0);
  179. AudioConnection patchCord13(mixer1, 0, filter21, 0);
  180. AudioConnection patchCord14(mixer1, 0, filter23, 0);
  181. AudioConnection patchCord15(mixer1, 0, filter25, 0);
  182. AudioConnection patchCord16(mixer1, 0, filter27, 0);
  183. AudioConnection patchCord17(mixer1, 0, filter29, 0);
  184. AudioConnection patchCord18(mixer1, 0, filter31, 0);
  185. AudioConnection patchCord19(mixer1, 0, filter33, 0);
  186. AudioConnection patchCord20(mixer1, 0, filter35, 0);
  187. AudioConnection patchCord21(mixer1, 0, filter37, 0);
  188. AudioConnection patchCord22(mixer1, peak20);
  189. //AudioConnection patchCord23(mixer1, 0, usb1, 0);
  190. AudioConnection patchCord24(mixer1, 0, i2s1, 0);
  191. AudioConnection patchCord25(mixer2, 0, filter39, 0);
  192. AudioConnection patchCord26(mixer2, 0, filter41, 0);
  193. AudioConnection patchCord27(mixer2, 0, filter43, 0);
  194. AudioConnection patchCord28(mixer2, 0, filter45, 0);
  195. AudioConnection patchCord29(mixer2, 0, filter47, 0);
  196. AudioConnection patchCord30(mixer2, 0, filter49, 0);
  197. AudioConnection patchCord31(mixer2, 0, filter51, 0);
  198. AudioConnection patchCord32(mixer2, 0, filter53, 0);
  199. AudioConnection patchCord33(mixer2, 0, filter55, 0);
  200. AudioConnection patchCord34(mixer2, 0, filter57, 0);
  201. AudioConnection patchCord35(mixer2, 0, filter59, 0);
  202. AudioConnection patchCord36(mixer2, 0, filter61, 0);
  203. AudioConnection patchCord37(mixer2, 0, filter63, 0);
  204. AudioConnection patchCord38(mixer2, 0, filter65, 0);
  205. AudioConnection patchCord39(mixer2, 0, filter67, 0);
  206. AudioConnection patchCord40(mixer2, 0, filter69, 0);
  207. AudioConnection patchCord41(mixer2, 0, filter71, 0);
  208. AudioConnection patchCord42(mixer2, 0, filter73, 0);
  209. AudioConnection patchCord43(mixer2, 0, filter75, 0);
  210. AudioConnection patchCord44(mixer2, 0, mixer11, 2);
  211. AudioConnection patchCord45(mixer2, peak21);
  212. AudioConnection patchCord46(filter39, 0, filter40, 0);
  213. AudioConnection patchCord47(filter41, 1, filter42, 0);
  214. AudioConnection patchCord48(filter43, 1, filter44, 0);
  215. AudioConnection patchCord49(filter45, 1, filter46, 0);
  216. AudioConnection patchCord50(filter47, 1, filter48, 0);
  217. AudioConnection patchCord51(filter49, 1, filter50, 0);
  218. AudioConnection patchCord52(filter51, 1, filter52, 0);
  219. AudioConnection patchCord53(filter1, 0, filter2, 0);
  220. AudioConnection patchCord54(filter3, 1, filter4, 0);
  221. AudioConnection patchCord55(filter5, 1, filter6, 0);
  222. AudioConnection patchCord56(filter7, 1, filter8, 0);
  223. AudioConnection patchCord57(filter9, 1, filter10, 0);
  224. AudioConnection patchCord58(filter11, 1, filter12, 0);
  225. AudioConnection patchCord59(filter13, 1, filter14, 0);
  226. AudioConnection patchCord60(filter40, 0, multiply2, 0);
  227. AudioConnection patchCord61(filter42, 1, multiply3, 0);
  228. AudioConnection patchCord62(filter44, 1, multiply4, 0);
  229. AudioConnection patchCord63(filter46, 1, multiply5, 0);
  230. AudioConnection patchCord64(filter48, 1, multiply6, 0);
  231. AudioConnection patchCord65(filter50, 1, multiply7, 0);
  232. AudioConnection patchCord66(filter52, 1, multiply8, 0);
  233. AudioConnection patchCord67(filter2, 0, Rect1, 0);
  234. AudioConnection patchCord68(filter4, 1, Rect2, 0);
  235. AudioConnection patchCord69(filter6, 1, Rect3, 0);
  236. AudioConnection patchCord70(filter8, 1, Rect4, 0);
  237. AudioConnection patchCord71(filter10, 1, Rect5, 0);
  238. AudioConnection patchCord72(filter12, 1, Rect6, 0);
  239. AudioConnection patchCord73(filter14, 1, Rect7, 0);
  240. AudioConnection patchCord74(Rect5, biquad7);
  241. AudioConnection patchCord75(Rect7, biquad9);
  242. AudioConnection patchCord76(Rect4, biquad6);
  243. AudioConnection patchCord77(Rect6, biquad8);
  244. AudioConnection patchCord78(Rect2, biquad4);
  245. AudioConnection patchCord79(Rect3, biquad5);
  246. AudioConnection patchCord80(Rect1, biquad3);
  247. AudioConnection patchCord81(multiply2, 0, mixer3, 0);
  248. AudioConnection patchCord82(multiply3, 0, mixer3, 1);
  249. AudioConnection patchCord83(multiply6, 0, mixer4, 0);
  250. AudioConnection patchCord84(multiply7, 0, mixer4, 1);
  251. AudioConnection patchCord85(multiply4, 0, mixer3, 2);
  252. AudioConnection patchCord86(multiply8, 0, mixer4, 2);
  253. AudioConnection patchCord87(multiply5, 0, mixer3, 3);
  254. AudioConnection patchCord88(mixer3, 0, mixer9, 0);
  255. AudioConnection patchCord89(mixer4, 0, mixer9, 1);
  256. AudioConnection patchCord90(biquad4, 0, multiply3, 1);
  257. AudioConnection patchCord91(biquad3, 0, multiply2, 1);
  258. AudioConnection patchCord92(biquad6, 0, multiply5, 1);
  259. AudioConnection patchCord93(biquad9, 0, multiply8, 1);
  260. AudioConnection patchCord94(biquad7, 0, multiply6, 1);
  261. AudioConnection patchCord95(biquad8, 0, multiply7, 1);
  262. AudioConnection patchCord96(biquad5, 0, multiply4, 1);
  263. AudioConnection patchCord97(filter53, 1, filter54, 0);
  264. AudioConnection patchCord98(filter55, 1, filter56, 0);
  265. AudioConnection patchCord99(filter57, 1, filter58, 0);
  266. AudioConnection patchCord100(filter59, 1, filter60, 0);
  267. AudioConnection patchCord101(filter61, 1, filter62, 0);
  268. AudioConnection patchCord102(filter63, 1, filter64, 0);
  269. AudioConnection patchCord103(filter65, 1, filter66, 0);
  270. AudioConnection patchCord104(noise1, 0, filter77, 0);
  271. AudioConnection patchCord105(noise1, 0, mixer2, 1);
  272. AudioConnection patchCord106(filter54, 1, multiply9, 0);
  273. AudioConnection patchCord107(filter56, 1, multiply10, 0);
  274. AudioConnection patchCord108(filter58, 1, multiply11, 0);
  275. AudioConnection patchCord109(filter60, 1, multiply12, 0);
  276. AudioConnection patchCord110(filter62, 1, multiply13, 0);
  277. AudioConnection patchCord111(filter64, 1, multiply14, 0);
  278. AudioConnection patchCord112(filter66, 1, multiply15, 0);
  279. AudioConnection patchCord113(filter15, 1, filter16, 0);
  280. AudioConnection patchCord114(filter17, 1, filter18, 0);
  281. AudioConnection patchCord115(filter19, 1, filter20, 0);
  282. AudioConnection patchCord116(filter21, 1, filter22, 0);
  283. AudioConnection patchCord117(filter23, 1, filter24, 0);
  284. AudioConnection patchCord118(filter25, 1, filter26, 0);
  285. AudioConnection patchCord119(filter27, 1, filter28, 0);
  286. AudioConnection patchCord120(multiply9, 0, mixer5, 0);
  287. AudioConnection patchCord121(multiply10, 0, mixer5, 1);
  288. AudioConnection patchCord122(multiply11, 0, mixer5, 2);
  289. AudioConnection patchCord123(multiply13, 0, mixer6, 0);
  290. AudioConnection patchCord124(multiply14, 0, mixer6, 1);
  291. AudioConnection patchCord125(multiply15, 0, mixer6, 2);
  292. AudioConnection patchCord126(multiply12, 0, mixer5, 3);
  293. AudioConnection patchCord127(filter16, 1, Rect8, 0);
  294. AudioConnection patchCord128(filter18, 1, Rect9, 0);
  295. AudioConnection patchCord129(filter20, 1, Rect10, 0);
  296. AudioConnection patchCord130(filter22, 1, Rect11, 0);
  297. AudioConnection patchCord131(filter24, 1, Rect12, 0);
  298. AudioConnection patchCord132(filter26, 1, Rect13, 0);
  299. AudioConnection patchCord133(filter28, 1, Rect14, 0);
  300. AudioConnection patchCord134(mixer5, 0, mixer9, 2);
  301. AudioConnection patchCord135(mixer6, 0, mixer9, 3);
  302. AudioConnection patchCord136(Rect9, biquad11);
  303. AudioConnection patchCord137(Rect8, biquad10);
  304. AudioConnection patchCord138(Rect11, biquad13);
  305. AudioConnection patchCord139(Rect10, biquad12);
  306. AudioConnection patchCord140(Rect12, biquad14);
  307. AudioConnection patchCord141(Rect13, biquad15);
  308. AudioConnection patchCord142(Rect14, biquad16);
  309. AudioConnection patchCord143(biquad10, 0, multiply9, 1);
  310. AudioConnection patchCord144(biquad13, 0, multiply12, 1);
  311. AudioConnection patchCord145(biquad11, 0, multiply10, 1);
  312. AudioConnection patchCord146(biquad12, 0, multiply11, 1);
  313. AudioConnection patchCord147(biquad14, 0, multiply13, 1);
  314. AudioConnection patchCord148(biquad15, 0, multiply14, 1);
  315. AudioConnection patchCord149(biquad16, 0, multiply15, 1);
  316. AudioConnection patchCord150(filter67, 1, filter68, 0);
  317. AudioConnection patchCord151(filter69, 1, filter70, 0);
  318. AudioConnection patchCord152(filter71, 1, filter72, 0);
  319. AudioConnection patchCord153(filter73, 1, filter74, 0);
  320. AudioConnection patchCord154(filter75, 2, filter76, 0);
  321. AudioConnection patchCord155(filter77, 2, filter78, 0);
  322. AudioConnection patchCord156(mixer9, 0, mixer11, 0);
  323. AudioConnection patchCord157(mixer10, 0, mixer11, 1);
  324. AudioConnection patchCord158(filter68, 1, multiply16, 0);
  325. AudioConnection patchCord159(filter70, 1, multiply17, 0);
  326. AudioConnection patchCord160(filter72, 1, multiply18, 0);
  327. AudioConnection patchCord161(filter74, 1, multiply19, 0);
  328. AudioConnection patchCord162(filter76, 1, multiply20, 0);
  329. AudioConnection patchCord163(filter78, 2, multiply21, 0);
  330. AudioConnection patchCord164(filter29, 1, filter30, 0);
  331. AudioConnection patchCord165(filter31, 1, filter32, 0);
  332. AudioConnection patchCord166(filter33, 1, filter34, 0);
  333. AudioConnection patchCord167(filter35, 1, filter36, 0);
  334. AudioConnection patchCord168(filter37, 2, filter38, 0);
  335. AudioConnection patchCord169(mixer11, 0, i2s1, 1);
  336. //AudioConnection patchCord170(mixer11, 0, usb1, 1);
  337. AudioConnection patchCord171(multiply21, 0, mixer8, 1);
  338. AudioConnection patchCord172(multiply20, 0, mixer8, 0);
  339. AudioConnection patchCord173(multiply17, 0, mixer7, 1);
  340. AudioConnection patchCord174(multiply19, 0, mixer7, 3);
  341. AudioConnection patchCord175(multiply16, 0, mixer7, 0);
  342. AudioConnection patchCord176(multiply18, 0, mixer7, 2);
  343. AudioConnection patchCord177(filter30, 1, Rect15, 0);
  344. AudioConnection patchCord178(filter32, 1, Rect16, 0);
  345. AudioConnection patchCord179(filter34, 1, Rect17, 0);
  346. AudioConnection patchCord180(filter36, 1, Rect18, 0);
  347. AudioConnection patchCord181(filter38, 1, Rect19, 0);
  348. AudioConnection patchCord182(mixer7, 0, mixer10, 0);
  349. AudioConnection patchCord183(mixer8, 0, mixer10, 1);
  350. AudioConnection patchCord184(Rect17, biquad19);
  351. AudioConnection patchCord185(Rect18, biquad20);
  352. AudioConnection patchCord186(Rect19, biquad21);
  353. AudioConnection patchCord187(Rect16, biquad18);
  354. AudioConnection patchCord188(Rect15, biquad17);
  355. AudioConnection patchCord189(biquad18, 0, multiply17, 1);
  356. AudioConnection patchCord190(biquad17, 0, multiply16, 1);
  357. AudioConnection patchCord191(biquad19, 0, multiply18, 1);
  358. AudioConnection patchCord192(biquad21, 0, multiply20, 1);
  359. AudioConnection patchCord193(biquad21, 0, multiply21, 1);
  360. AudioConnection patchCord194(biquad20, 0, multiply19, 1);
  361. AudioControlSGTL5000 sgtl5000_1; //xy=2226.777786254883,1222.6666231155396
  362. // GUItool: end automatically generated code
  363. //---------------------------------------------------------------------------------------
  364. void setup() {
  365. sgtl5000_1.enable();
  366. sgtl5000_1.inputSelect(myInput);
  367. sgtl5000_1.volume(0.7);
  368. const float res = 5; // this is used as resonance value of all state variable filters
  369. // modulators
  370. const float freq[37] = { // filter frequency table, tuned to specified musical notes
  371. 110.0000000, // A2 freq[0]
  372. 123.4708253, // B2 freq[1]
  373. 138.5913155, // C#3 freq[2]
  374. 155.5634919, // D#3 freq[3]
  375. 174.6141157, // F3 freq[4]
  376. 195.9977180, // G3 freq[5]
  377. 220.0000000, // A3 freq[6]
  378. 246.9416506, // B3 freq[7]
  379. 277.1826310, // C#4 freq[8]
  380. 311.1269837, // D#4 freq[9]
  381. 349.2282314, // F4 freq[10]
  382. 391.9954360, // G4 freq[11]
  383. 440.0000000, // A4 freq[12]
  384. 493.8833013, // B4 freq[13]
  385. 554.3652620, // C#5 freq[14]
  386. 622.2539674, // D#5 freq[15]
  387. 698.4564629, // F5 freq[16]
  388. 783.9908720, // G5 freq[17]
  389. 880.0000000, // A5 freq[18]
  390. 987.7666025, // B5 freq[19]
  391. 1108.730524, // C#6 freq[20]
  392. 1244.507935, // D#6 freq[21]
  393. 1396.912926, // F6 freq[22]
  394. 1567.981744, // G6 freq[23]
  395. 1760.000000, // A6 freq[24]
  396. 1975.533205, // B6 freq[25]
  397. 2217.461048, // C#7 freq[26]
  398. 2489.015870, // D#7 freq[27]
  399. 2793.825851, // F7 freq[28]
  400. 3135.963488, // G7 freq[29]
  401. 3520.000000, // A7 freq[30]
  402. 3951.066410, // B7 freq[31]
  403. 4434.922096, // C#8 freq[32]
  404. 4978.031740, // D#8 freq[33]
  405. 5587.651703, // F8 freq[34]
  406. 6271.926976, // G8 freq[35]
  407. 7040.000000 // A8 freq[36]
  408. };
  409. AudioMemory(64); // allocate some memory for audio library
  410. Serial.begin(115200); // initialize serial communication
  411. noise1.amplitude(0.7); // controls sibilance (hiss syllables)
  412. mixer1.gain(0, 1); // I2S left input level
  413. mixer2.gain(0, 0.7); // I2S right input level
  414. mixer2.gain(1, 0.7); // noise right input level
  415. mixer11.gain(0, 0.7); // vocoder output 1 level (low-mid freq)
  416. mixer11.gain(1, 0.7); // vocoder output 2 level (high freq)
  417. mixer11.gain(2, 0); // instrument to output mix level
  418. mixer3.gain(0,1);
  419. mixer3.gain(1,1);
  420. mixer3.gain(2,1);
  421. mixer3.gain(3,1);
  422. mixer4.gain(0,1);
  423. mixer4.gain(1,1);
  424. mixer4.gain(2,1);
  425. mixer5.gain(0,1);
  426. mixer5.gain(1,1);
  427. mixer5.gain(2,1);
  428. mixer5.gain(3,1);
  429. mixer6.gain(0,1);
  430. mixer6.gain(1,1);
  431. mixer6.gain(2,1);
  432. mixer7.gain(0,1);
  433. mixer7.gain(1,1);
  434. mixer7.gain(2,1);
  435. mixer7.gain(3,1);
  436. mixer8.gain(0,1);
  437. mixer8.gain(1,1);
  438. mixer9.gain(0,1);
  439. mixer9.gain(1,1);
  440. mixer9.gain(2,1);
  441. mixer9.gain(3,1);
  442. mixer10.gain(0,1);
  443. mixer10.gain(1,1);
  444. filter1.resonance(res); // set the resonance of the filters
  445. filter2.resonance(res);
  446. filter3.resonance(res);
  447. filter4.resonance(res);
  448. filter5.resonance(res);
  449. filter6.resonance(res);
  450. filter7.resonance(res);
  451. filter8.resonance(res);
  452. filter9.resonance(res);
  453. filter10.resonance(res);
  454. filter11.resonance(res);
  455. filter12.resonance(res);
  456. filter13.resonance(res);
  457. filter14.resonance(res);
  458. filter15.resonance(res);
  459. filter16.resonance(res);
  460. filter17.resonance(res);
  461. filter18.resonance(res);
  462. filter19.resonance(res);
  463. filter20.resonance(res);
  464. filter21.resonance(res);
  465. filter22.resonance(res);
  466. filter23.resonance(res);
  467. filter24.resonance(res);
  468. filter25.resonance(res);
  469. filter26.resonance(res);
  470. filter27.resonance(res);
  471. filter28.resonance(res);
  472. filter29.resonance(res);
  473. filter30.resonance(res);
  474. filter31.resonance(res);
  475. filter32.resonance(res);
  476. filter33.resonance(res);
  477. filter34.resonance(res);
  478. filter35.resonance(res);
  479. filter36.resonance(res);
  480. filter37.resonance(res);
  481. filter38.resonance(res);
  482. filter39.resonance(res);
  483. filter40.resonance(res);
  484. filter41.resonance(res);
  485. filter42.resonance(res);
  486. filter43.resonance(res);
  487. filter44.resonance(res);
  488. filter45.resonance(res);
  489. filter46.resonance(res);
  490. filter47.resonance(res);
  491. filter48.resonance(res);
  492. filter49.resonance(res);
  493. filter50.resonance(res);
  494. filter51.resonance(res);
  495. filter52.resonance(res);
  496. filter53.resonance(res);
  497. filter54.resonance(res);
  498. filter55.resonance(res);
  499. filter56.resonance(res);
  500. filter57.resonance(res);
  501. filter58.resonance(res);
  502. filter59.resonance(res);
  503. filter60.resonance(res);
  504. filter61.resonance(res);
  505. filter62.resonance(res);
  506. filter63.resonance(res);
  507. filter64.resonance(res);
  508. filter65.resonance(res);
  509. filter66.resonance(res);
  510. filter67.resonance(res);
  511. filter68.resonance(res);
  512. filter69.resonance(res);
  513. filter70.resonance(res);
  514. filter71.resonance(res);
  515. filter72.resonance(res);
  516. filter73.resonance(res);
  517. filter74.resonance(res);
  518. filter75.resonance(res);
  519. filter76.resonance(res);
  520. filter77.resonance(res);
  521. filter78.resonance(res);
  522. filter1.frequency(freq[0]); // set the frequencies of the filters
  523. filter2.frequency(freq[0]); // frequencies are assigned to a pair of filters because they are cascaded
  524. filter3.frequency(freq[2]); // two sets of filters are used: for voice signal analysis and instrument/synth filter
  525. filter4.frequency(freq[2]);
  526. filter5.frequency(freq[4]);
  527. filter6.frequency(freq[4]);
  528. filter7.frequency(freq[6]);
  529. filter8.frequency(freq[6]);
  530. filter9.frequency(freq[8]);
  531. filter10.frequency(freq[8]);
  532. filter11.frequency(freq[10]);
  533. filter12.frequency(freq[10]);
  534. filter13.frequency(freq[12]);
  535. filter14.frequency(freq[12]);
  536. filter15.frequency(freq[14]);
  537. filter16.frequency(freq[14]);
  538. filter17.frequency(freq[16]);
  539. filter18.frequency(freq[16]);
  540. filter19.frequency(freq[18]);
  541. filter20.frequency(freq[18]);
  542. filter21.frequency(freq[20]);
  543. filter22.frequency(freq[20]);
  544. filter23.frequency(freq[22]);
  545. filter24.frequency(freq[22]);
  546. filter25.frequency(freq[24]);
  547. filter26.frequency(freq[24]);
  548. filter27.frequency(freq[26]);
  549. filter28.frequency(freq[26]);
  550. filter29.frequency(freq[28]);
  551. filter30.frequency(freq[28]);
  552. filter31.frequency(freq[30]);
  553. filter32.frequency(freq[30]);
  554. filter33.frequency(freq[32]);
  555. filter34.frequency(freq[32]);
  556. filter35.frequency(freq[34]);
  557. filter36.frequency(freq[34]);
  558. filter37.frequency(freq[36]);
  559. filter38.frequency(freq[36]);
  560. filter39.frequency(freq[0]);
  561. filter40.frequency(freq[0]);
  562. filter41.frequency(freq[2]);
  563. filter42.frequency(freq[2]);
  564. filter43.frequency(freq[4]);
  565. filter44.frequency(freq[4]);
  566. filter45.frequency(freq[6]);
  567. filter46.frequency(freq[6]);
  568. filter47.frequency(freq[8]);
  569. filter48.frequency(freq[8]);
  570. filter49.frequency(freq[10]);
  571. filter50.frequency(freq[10]);
  572. filter51.frequency(freq[12]);
  573. filter52.frequency(freq[12]);
  574. filter53.frequency(freq[14]);
  575. filter54.frequency(freq[14]);
  576. filter55.frequency(freq[16]);
  577. filter56.frequency(freq[16]);
  578. filter57.frequency(freq[18]);
  579. filter58.frequency(freq[18]);
  580. filter59.frequency(freq[20]);
  581. filter60.frequency(freq[20]);
  582. filter61.frequency(freq[22]);
  583. filter62.frequency(freq[22]);
  584. filter63.frequency(freq[24]);
  585. filter64.frequency(freq[24]);
  586. filter65.frequency(freq[26]);
  587. filter66.frequency(freq[26]);
  588. filter67.frequency(freq[28]);
  589. filter68.frequency(freq[28]);
  590. filter69.frequency(freq[30]);
  591. filter70.frequency(freq[30]);
  592. filter71.frequency(freq[32]);
  593. filter72.frequency(freq[32]);
  594. filter73.frequency(freq[34]);
  595. filter74.frequency(freq[34]);
  596. filter75.frequency(freq[36]);
  597. filter76.frequency(freq[36]);
  598. filter77.frequency(freq[36]); // last pair of filters are used for sibilance
  599. filter78.frequency(freq[36]); // input is a white noise, instead of instrument/synth
  600. biquad3.setLowpass(0, 90, 0.53);
  601. biquad3.setLowpass(1, 90, 0.707);
  602. biquad3.setLowpass(2, 60, 0.53);
  603. biquad3.setLowpass(3, 80, 0.707);
  604. biquad4.setLowpass(0, 200, 0.53);
  605. biquad4.setLowpass(1, 200, 0.707);
  606. biquad4.setLowpass(2, 60, 0.53);
  607. biquad4.setLowpass(3, 160, 0.707);
  608. biquad5.setLowpass(0, 200, 0.53);
  609. biquad5.setLowpass(1, 200, 0.707);
  610. biquad5.setLowpass(2, 60, 0.53);
  611. biquad5.setLowpass(3, 160, 0.707);
  612. biquad6.setLowpass(0, 200, 0.53);
  613. biquad6.setLowpass(1, 200, 0.707);
  614. biquad6.setLowpass(2, 60, 0.53);
  615. biquad6.setLowpass(3, 160, 0.707);
  616. biquad7.setLowpass(0, 200, 0.53);
  617. biquad7.setLowpass(1, 200, 0.707);
  618. biquad7.setLowpass(2, 60, 0.53);
  619. biquad7.setLowpass(3, 160, 0.707);
  620. biquad8.setLowpass(0, 200, 0.53);
  621. biquad8.setLowpass(1, 200, 0.707);
  622. biquad8.setLowpass(2, 60, 0.53);
  623. biquad8.setLowpass(3, 160, 0.707);
  624. biquad9.setLowpass(0, 200, 0.53);
  625. biquad9.setLowpass(1, 200, 0.707);
  626. biquad9.setLowpass(2, 60, 0.53);
  627. biquad9.setLowpass(3, 160, 0.707);
  628. biquad10.setLowpass(0, 200, 0.53);
  629. biquad10.setLowpass(1, 200, 0.707);
  630. biquad10.setLowpass(2, 60, 0.53);
  631. biquad10.setLowpass(3, 160, 0.707);
  632. biquad11.setLowpass(0, 200, 0.53);
  633. biquad11.setLowpass(1, 200, 0.707);
  634. biquad11.setLowpass(2, 60, 0.53);
  635. biquad11.setLowpass(3, 160, 0.707);
  636. biquad12.setLowpass(0, 200, 0.53);
  637. biquad12.setLowpass(1, 200, 0.707);
  638. biquad12.setLowpass(2, 60, 0.53);
  639. biquad12.setLowpass(3, 160, 0.707);
  640. biquad13.setLowpass(0, 200, 0.53);
  641. biquad13.setLowpass(1, 200, 0.707);
  642. biquad13.setLowpass(2, 60, 0.53);
  643. biquad13.setLowpass(3, 160, 0.707);
  644. biquad14.setLowpass(0, 200, 0.53);
  645. biquad14.setLowpass(1, 200, 0.707);
  646. biquad14.setLowpass(2, 60, 0.53);
  647. biquad14.setLowpass(3, 160, 0.707);
  648. biquad15.setLowpass(0, 200, 0.53);
  649. biquad15.setLowpass(1, 200, 0.707);
  650. biquad15.setLowpass(2, 60, 0.53);
  651. biquad15.setLowpass(3, 160, 0.707);
  652. biquad16.setLowpass(0, 200, 0.53);
  653. biquad16.setLowpass(1, 200, 0.707);
  654. biquad16.setLowpass(2, 60, 0.53);
  655. biquad16.setLowpass(3, 160, 0.707);
  656. biquad17.setLowpass(0, 200, 0.53);
  657. biquad17.setLowpass(1, 200, 0.707);
  658. biquad17.setLowpass(2, 60, 0.53);
  659. biquad17.setLowpass(3, 160, 0.707);
  660. biquad18.setLowpass(0, 200, 0.53);
  661. biquad18.setLowpass(1, 200, 0.707);
  662. biquad18.setLowpass(2, 60, 0.53);
  663. biquad18.setLowpass(3, 160, 0.707);
  664. biquad19.setLowpass(0, 200, 0.53);
  665. biquad19.setLowpass(1, 200, 0.707);
  666. biquad19.setLowpass(2, 60, 0.53);
  667. biquad19.setLowpass(3, 160, 0.707);
  668. biquad20.setLowpass(0, 200, 0.53);
  669. biquad20.setLowpass(1, 200, 0.707);
  670. biquad20.setLowpass(2, 60, 0.53);
  671. biquad20.setLowpass(3, 160, 0.707);
  672. biquad21.setLowpass(0, 200, 0.53);
  673. biquad21.setLowpass(1, 200, 0.707);
  674. biquad21.setLowpass(2, 60, 0.53);
  675. biquad21.setLowpass(3, 160, 0.707);
  676. }
  677. void loop() {
  678. Serial.print(AudioProcessorUsage());
  679. Serial.print("/");
  680. Serial.print(AudioProcessorUsageMax());
  681. Serial.println("");
  682. AudioProcessorUsageMaxReset();
  683. delay(100);
  684. }