Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

230 linhas
9.5KB

  1. // Advanced Microcontroller-based Audio Workshop
  2. //
  3. // https://github.com/PaulStoffregen/AudioWorkshop2015/raw/master/workshop.pdf
  4. // https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
  5. //
  6. // This reference file has all the design tool output. If you are
  7. // learning, please follow the PDF manual and draw these in the design
  8. // tool. This reference material is mainly interested for software
  9. // testing and ongoing maintenance as Arduino and the audio library
  10. // are updated with new features.
  11. #include <Audio.h>
  12. #include <Wire.h>
  13. #include <SPI.h>
  14. #include <SD.h>
  15. #include <SerialFlash.h>
  16. /*
  17. // Part 2-1: First Design Tool Use
  18. // GUItool: begin automatically generated code
  19. AudioPlaySdWav playSdWav1; //xy=88,55
  20. AudioOutputI2S i2s1; //xy=280,79
  21. AudioConnection patchCord1(playSdWav1, 0, i2s1, 0);
  22. AudioConnection patchCord2(playSdWav1, 1, i2s1, 1);
  23. AudioControlSGTL5000 sgtl5000_1; //xy=209,140
  24. // GUItool: end automatically generated code
  25. */
  26. /*
  27. // Part 2-2: Mixers & Playing Multiple Sounds
  28. // GUItool: begin automatically generated code
  29. AudioPlaySdWav playSdWav1; //xy=88,55
  30. AudioPlaySdWav playSdWav2; //xy=109,123
  31. AudioMixer4 mixer1; //xy=284,44
  32. AudioMixer4 mixer2; //xy=286,123
  33. AudioOutputI2S i2s1; //xy=456,104
  34. AudioConnection patchCord1(playSdWav1, 0, mixer1, 0);
  35. AudioConnection patchCord2(playSdWav1, 1, mixer2, 0);
  36. AudioConnection patchCord3(playSdWav2, 0, mixer1, 1);
  37. AudioConnection patchCord4(playSdWav2, 1, mixer2, 1);
  38. AudioConnection patchCord5(mixer1, 0, i2s1, 0);
  39. AudioConnection patchCord6(mixer2, 0, i2s1, 1);
  40. AudioControlSGTL5000 sgtl5000_1; //xy=382,209
  41. // GUItool: end automatically generated code
  42. */
  43. /*
  44. // Part 2-3: Playing Samples (Short Sound Clips)
  45. // GUItool: begin automatically generated code
  46. AudioPlayMemory playMem1; //xy=92,48
  47. AudioPlayMemory playMem2; //xy=96,104
  48. AudioPlayMemory playMem3; //xy=99,160
  49. AudioPlayMemory playMem4; //xy=100,222
  50. AudioMixer4 mixer1; //xy=287,125
  51. AudioOutputI2S i2s1; //xy=454,99
  52. AudioConnection patchCord1(playMem1, 0, mixer1, 0);
  53. AudioConnection patchCord2(playMem2, 0, mixer1, 1);
  54. AudioConnection patchCord3(playMem3, 0, mixer1, 2);
  55. AudioConnection patchCord4(playMem4, 0, mixer1, 3);
  56. AudioConnection patchCord5(mixer1, 0, i2s1, 0);
  57. AudioConnection patchCord6(mixer1, 0, i2s1, 1);
  58. AudioControlSGTL5000 sgtl5000_1; //xy=397,205
  59. // GUItool: end automatically generated code
  60. */
  61. /*
  62. // Part 2-4: Using the Microphone
  63. // GUItool: begin automatically generated code
  64. AudioInputI2S i2s2; //xy=95,64
  65. AudioOutputI2S i2s1; //xy=286,88
  66. AudioConnection patchCord1(i2s2, 0, i2s1, 0);
  67. AudioConnection patchCord2(i2s2, 0, i2s1, 1);
  68. AudioControlSGTL5000 sgtl5000_1; //xy=226,155
  69. // GUItool: end automatically generated code
  70. */
  71. /*
  72. // Part 2-5: Simple Delay
  73. // GUItool: begin automatically generated code
  74. AudioInputI2S i2s2; //xy=95,64
  75. AudioEffectDelay delay1; //xy=230,145
  76. AudioMixer4 mixer1; //xy=367,97
  77. AudioMixer4 mixer2; //xy=402,188
  78. AudioMixer4 mixer3; //xy=526,59
  79. AudioOutputI2S i2s1; //xy=654,112
  80. AudioConnection patchCord1(i2s2, 0, delay1, 0);
  81. AudioConnection patchCord2(i2s2, 0, mixer3, 0);
  82. AudioConnection patchCord3(delay1, 0, mixer1, 0);
  83. AudioConnection patchCord4(delay1, 1, mixer1, 1);
  84. AudioConnection patchCord5(delay1, 2, mixer1, 2);
  85. AudioConnection patchCord6(delay1, 3, mixer1, 3);
  86. AudioConnection patchCord7(delay1, 4, mixer2, 0);
  87. AudioConnection patchCord8(delay1, 5, mixer2, 1);
  88. AudioConnection patchCord9(delay1, 6, mixer2, 2);
  89. AudioConnection patchCord10(delay1, 7, mixer2, 3);
  90. AudioConnection patchCord11(mixer1, 0, mixer3, 1);
  91. AudioConnection patchCord12(mixer2, 0, mixer3, 2);
  92. AudioConnection patchCord13(mixer3, 0, i2s1, 0);
  93. AudioConnection patchCord14(mixer3, 0, i2s1, 1);
  94. AudioControlSGTL5000 sgtl5000_1; //xy=583,208
  95. // GUItool: end automatically generated code
  96. */
  97. /*
  98. // Part 2-6: Feedback (Echo) Delay
  99. // GUItool: begin automatically generated code
  100. AudioInputI2S i2s2; //xy=95,73
  101. AudioMixer4 mixer1; //xy=278,62
  102. AudioEffectDelay delay1; //xy=361,227
  103. AudioOutputI2S i2s1; //xy=536,221
  104. AudioConnection patchCord1(i2s2, 0, mixer1, 0);
  105. AudioConnection patchCord2(mixer1, delay1);
  106. AudioConnection patchCord3(delay1, 0, mixer1, 3);
  107. AudioConnection patchCord4(delay1, 0, i2s1, 0);
  108. AudioConnection patchCord5(delay1, 0, i2s1, 1);
  109. AudioControlSGTL5000 sgtl5000_1; //xy=161,241
  110. // GUItool: end automatically generated code
  111. */
  112. /*
  113. // Part 2-7: Filters
  114. // GUItool: begin automatically generated code
  115. AudioPlaySdWav playSdWav1; //xy=84,67
  116. AudioFilterStateVariable filter1; //xy=259,83
  117. AudioFilterStateVariable filter2; //xy=270,168
  118. AudioMixer4 mixer1; //xy=424,80
  119. AudioMixer4 mixer2; //xy=433,168
  120. AudioOutputI2S i2s1; //xy=580,117
  121. AudioConnection patchCord1(playSdWav1, 0, filter1, 0);
  122. AudioConnection patchCord2(playSdWav1, 1, filter2, 0);
  123. AudioConnection patchCord3(filter1, 0, mixer1, 0);
  124. AudioConnection patchCord4(filter1, 1, mixer1, 1);
  125. AudioConnection patchCord5(filter1, 2, mixer1, 2);
  126. AudioConnection patchCord6(filter2, 0, mixer2, 0);
  127. AudioConnection patchCord7(filter2, 1, mixer2, 1);
  128. AudioConnection patchCord8(filter2, 2, mixer2, 2);
  129. AudioConnection patchCord9(mixer1, 0, i2s1, 0);
  130. AudioConnection patchCord10(mixer2, 0, i2s1, 1);
  131. AudioControlSGTL5000 sgtl5000_1; //xy=594,179
  132. // GUItool: end automatically generated code
  133. */
  134. /*
  135. // Part 2-8: Oscillators and Envelope
  136. // GUItool: begin automatically generated code
  137. AudioSynthWaveform waveform1; //xy=77,30
  138. AudioSynthWaveformSine sine1; //xy=87,159
  139. AudioSynthNoisePink pink1; //xy=110,221
  140. AudioSynthWaveformSineModulated sine_fm1; //xy=145,102
  141. AudioMixer4 mixer1; //xy=313,111
  142. AudioEffectEnvelope envelope1; //xy=454,165
  143. AudioMixer4 mixer2; //xy=589,87
  144. AudioOutputI2S i2s1; //xy=725,149
  145. AudioConnection patchCord1(waveform1, sine_fm1);
  146. AudioConnection patchCord2(waveform1, 0, mixer1, 0);
  147. AudioConnection patchCord3(sine1, 0, mixer1, 2);
  148. AudioConnection patchCord4(pink1, 0, mixer1, 3);
  149. AudioConnection patchCord5(sine_fm1, 0, mixer1, 1);
  150. AudioConnection patchCord6(mixer1, envelope1);
  151. AudioConnection patchCord7(mixer1, 0, mixer2, 0);
  152. AudioConnection patchCord8(envelope1, 0, mixer2, 1);
  153. AudioConnection patchCord9(mixer2, 0, i2s1, 0);
  154. AudioConnection patchCord10(mixer2, 0, i2s1, 1);
  155. AudioControlSGTL5000 sgtl5000_1; //xy=317,208
  156. // GUItool: end automatically generated code
  157. */
  158. /*
  159. // Part 3-1: Peak Detection
  160. // GUItool: begin automatically generated code
  161. AudioPlaySdWav playSdWav1; //xy=136,65
  162. AudioAnalyzePeak peak2; //xy=348,219
  163. AudioAnalyzePeak peak1; //xy=358,171
  164. AudioOutputI2S i2s1; //xy=380,92
  165. AudioConnection patchCord1(playSdWav1, 0, i2s1, 0);
  166. AudioConnection patchCord2(playSdWav1, 0, peak1, 0);
  167. AudioConnection patchCord3(playSdWav1, 1, i2s1, 1);
  168. AudioConnection patchCord4(playSdWav1, 1, peak2, 0);
  169. AudioControlSGTL5000 sgtl5000_1; //xy=155,192
  170. // GUItool: end automatically generated code
  171. */
  172. /*
  173. // Part 3-2: Fourier Transform
  174. // GUItool: begin automatically generated code
  175. AudioPlaySdWav playSdWav1; //xy=90,44
  176. AudioPlayMemory playMem1; //xy=94,113
  177. AudioSynthWaveform waveform1; //xy=104,170
  178. AudioMixer4 mixer1; //xy=290,91
  179. AudioAnalyzeFFT1024 fft1024_1; //xy=461,132
  180. AudioOutputI2S i2s1; //xy=465,58
  181. AudioConnection patchCord1(playSdWav1, 0, mixer1, 0);
  182. AudioConnection patchCord2(playSdWav1, 1, mixer1, 1);
  183. AudioConnection patchCord3(playMem1, 0, mixer1, 2);
  184. AudioConnection patchCord4(waveform1, 0, mixer1, 3);
  185. AudioConnection patchCord5(mixer1, 0, i2s1, 0);
  186. AudioConnection patchCord6(mixer1, 0, i2s1, 1);
  187. AudioConnection patchCord7(mixer1, fft1024_1);
  188. AudioControlSGTL5000 sgtl5000_1; //xy=352,195
  189. // GUItool: end automatically generated code
  190. */
  191. /*
  192. // Part 3-3: Add a TFT Display
  193. // GUItool: begin automatically generated code
  194. AudioPlaySdWav playSdWav1; //xy=136,65
  195. AudioAnalyzePeak peak2; //xy=348,219
  196. AudioAnalyzePeak peak1; //xy=358,171
  197. AudioOutputI2S i2s1; //xy=380,92
  198. AudioConnection patchCord1(playSdWav1, 0, i2s1, 0);
  199. AudioConnection patchCord2(playSdWav1, 0, peak1, 0);
  200. AudioConnection patchCord3(playSdWav1, 1, i2s1, 1);
  201. AudioConnection patchCord4(playSdWav1, 1, peak2, 0);
  202. AudioControlSGTL5000 sgtl5000_1; //xy=155,192
  203. // GUItool: end automatically generated code
  204. */
  205. void loop() {
  206. }
  207. void setup() {
  208. }