PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.1KB

  1. // demonstrate pulse with slow changes in pulse width
  2. #include <Audio.h>
  3. #include <Wire.h>
  4. #include <SPI.h>
  5. #include <SD.h>
  6. #include <SerialFlash.h>
  7. // GUItool: begin automatically generated code
  8. AudioSynthWaveform waveform1; //xy=188,240
  9. AudioEffectEnvelope envelope1; //xy=371,237
  10. AudioOutputI2S i2s1; //xy=565,241
  11. AudioConnection patchCord1(waveform1, envelope1);
  12. AudioConnection patchCord2(envelope1, 0, i2s1, 0);
  13. AudioConnection patchCord3(envelope1, 0, i2s1, 1);
  14. AudioControlSGTL5000 audioShield; //xy=586,175
  15. // GUItool: end automatically generated code
  16. void setup(void)
  17. {
  18. // Set up
  19. AudioMemory(8);
  20. audioShield.enable();
  21. audioShield.volume(0.45);
  22. waveform1.pulseWidth(0.5);
  23. waveform1.begin(0.4, 220, WAVEFORM_PULSE);
  24. envelope1.attack(50);
  25. envelope1.decay(50);
  26. envelope1.release(250);
  27. }
  28. void loop() {
  29. float w;
  30. for (uint32_t i =1; i<20; i++) {
  31. w = i / 20.0;
  32. waveform1.pulseWidth(w);
  33. envelope1.noteOn();
  34. delay(800);
  35. envelope1.noteOff();
  36. delay(600);
  37. }
  38. }