Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

62 lines
1.9KB

  1. // Delay demonstration example, Teensy Audio Library
  2. // http://www.pjrc.com/teensy/td_libs_Audio.html
  3. //
  4. // Creates a chirp on the left channel, then
  5. // three delayed copies on the right channel.
  6. //
  7. // Requires the audio shield:
  8. // http://www.pjrc.com/store/teensy3_audio.html
  9. //
  10. // This example code is in the public domain.
  11. #include <Audio.h>
  12. #include <Wire.h>
  13. #include <SPI.h>
  14. #include <SD.h>
  15. #include <SerialFlash.h>
  16. // GUItool: begin automatically generated code
  17. AudioSynthWaveformSine sine1; //xy=158,74
  18. AudioEffectEnvelope envelope1; //xy=232,156
  19. AudioEffectDelay delay1; //xy=393,238
  20. AudioMixer4 mixer1; //xy=532,205
  21. AudioOutputI2S i2s1; //xy=611,61
  22. AudioConnection patchCord1(sine1, envelope1);
  23. AudioConnection patchCord2(envelope1, delay1);
  24. AudioConnection patchCord3(envelope1, 0, i2s1, 0);
  25. AudioConnection patchCord4(delay1, 0, mixer1, 0);
  26. AudioConnection patchCord5(delay1, 1, mixer1, 1);
  27. AudioConnection patchCord6(delay1, 2, mixer1, 2);
  28. AudioConnection patchCord7(delay1, 3, mixer1, 3);
  29. AudioConnection patchCord8(mixer1, 0, i2s1, 1);
  30. AudioControlSGTL5000 sgtl5000_1; //xy=195,272
  31. // GUItool: end automatically generated code
  32. void setup() {
  33. // allocate enough memory for the delay
  34. AudioMemory(120);
  35. // enable the audio shield
  36. sgtl5000_1.enable();
  37. sgtl5000_1.volume(0.5);
  38. // configure a sine wave for the chirp
  39. // the original is turned on/off by an envelope effect
  40. // and output directly on the left channel
  41. sine1.frequency(1000);
  42. sine1.amplitude(0.5);
  43. // create 3 delay taps, which connect through a
  44. // mixer to the right channel output
  45. delay1.delay(0, 110);
  46. delay1.delay(1, 220);
  47. delay1.delay(2, 330);
  48. }
  49. void loop() {
  50. envelope1.noteOn();
  51. delay(36);
  52. envelope1.noteOff();
  53. delay(4000);
  54. }