Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

61 lines
1.8KB

  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. // GUItool: begin automatically generated code
  16. AudioSynthWaveformSine sine1; //xy=158,74
  17. AudioEffectEnvelope envelope1; //xy=232,156
  18. AudioEffectDelay delay1; //xy=393,238
  19. AudioMixer4 mixer1; //xy=532,205
  20. AudioOutputI2S i2s1; //xy=611,61
  21. AudioConnection patchCord1(sine1, envelope1);
  22. AudioConnection patchCord2(envelope1, delay1);
  23. AudioConnection patchCord3(envelope1, 0, i2s1, 0);
  24. AudioConnection patchCord4(delay1, 0, mixer1, 0);
  25. AudioConnection patchCord5(delay1, 1, mixer1, 1);
  26. AudioConnection patchCord6(delay1, 2, mixer1, 2);
  27. AudioConnection patchCord7(delay1, 3, mixer1, 3);
  28. AudioConnection patchCord8(mixer1, 0, i2s1, 1);
  29. AudioControlSGTL5000 sgtl5000_1; //xy=195,272
  30. // GUItool: end automatically generated code
  31. void setup() {
  32. // allocate enough memory for the delay
  33. AudioMemory(120);
  34. // enable the audio shield
  35. sgtl5000_1.enable();
  36. sgtl5000_1.volume(0.5);
  37. // configure a sine wave for the chirp
  38. // the original is turned on/off by an envelope effect
  39. // and output directly on the left channel
  40. sine1.frequency(1000);
  41. sine1.amplitude(0.5);
  42. // create 3 delay taps, which connect through a
  43. // mixer to the right channel output
  44. delay1.delay(0, 110);
  45. delay1.delay(1, 220);
  46. delay1.delay(2, 330);
  47. }
  48. void loop() {
  49. envelope1.noteOn();
  50. delay(36);
  51. envelope1.noteOff();
  52. delay(4000);
  53. }