ADAT_DrumSamplePlayer.ino 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // ADAT 8 channel Toslink output test, by Ernstjan Freriks
  2. // https://www.youtube.com/watch?v=e5ov3q02zxo
  3. // https://forum.pjrc.com/threads/28639-S-pdif?p=159530&viewfull=1#post159530
  4. #include <Audio.h>
  5. #include <Wire.h>
  6. #include <SPI.h>
  7. #include <SD.h>
  8. #include <SerialFlash.h>
  9. // WAV files converted to code by wav2sketch
  10. #include "AudioSampleSnare.h" // http://www.freesound.org/people/KEVOY/sounds/82583/
  11. #include "AudioSampleTomtom.h" // http://www.freesound.org/people/zgump/sounds/86334/
  12. #include "AudioSampleHihat.h" // http://www.freesound.org/people/mhc/sounds/102790/
  13. #include "AudioSampleKick.h" // http://www.freesound.org/people/DWSD/sounds/171104/
  14. #include "AudioSampleGong.h" // http://www.freesound.org/people/juskiddink/sounds/86773/
  15. #include "AudioSampleCashregister.h" // http://www.freesound.org/people/kiddpark/sounds/201159/
  16. // Create the Audio components. These should be created in the
  17. // order data flows, inputs/sources -> processing -> outputs
  18. //
  19. AudioPlayMemory sound0;
  20. AudioPlayMemory sound1; // five memory players, so we can play
  21. AudioPlayMemory sound2; // all five sounds simultaneously
  22. AudioPlayMemory sound3;
  23. AudioPlayMemory sound4;
  24. AudioPlayMemory sound5;
  25. // GUItool: begin automatically generated code
  26. AudioSynthWaveform sine1;
  27. AudioOutputADAT adat1;
  28. AudioConnection patchCord1(sine1, 0, adat1, 0);
  29. AudioConnection patchCord2(sine1, 0, adat1, 1);
  30. AudioConnection patchCord3(sound0, 0, adat1, 2);
  31. AudioConnection patchCord4(sound1, 0, adat1, 3);
  32. AudioConnection patchCord5(sound2, 0, adat1, 4);
  33. AudioConnection patchCord6(sound4, 0, adat1, 5);
  34. AudioConnection patchCord7(sound5, 0, adat1, 6);
  35. // GUItool: end automatically generated code
  36. void setup() {
  37. AudioMemory(10);
  38. sine1.begin(WAVEFORM_SINE);
  39. sine1.frequency(2000);
  40. }
  41. // the loop() methor runs over and over again,
  42. // as long as the board has power
  43. void loop() {
  44. sine1.amplitude(1.0);
  45. sound0.play(AudioSampleKick);
  46. delay(250);
  47. sound1.play(AudioSampleHihat);
  48. delay(250);
  49. sound1.play(AudioSampleHihat);
  50. sound2.play(AudioSampleSnare);
  51. delay(250);
  52. sound1.play(AudioSampleHihat);
  53. delay(250);
  54. sound0.play(AudioSampleKick);
  55. sound3.play(AudioSampleGong);
  56. delay(1000);
  57. }