Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

43 Zeilen
1.1KB

  1. /* Mono peak meter example using Analog objects. Assumes Teensy 3.1
  2. At a minimum DC decouple audio signals to/from Teensy pins with capacitors in the signal paths both in and out, 10uF is often used.
  3. Possibly worthwhile to set up virtual ground at 3v3/2 for both, or if changing DAC REF to 1.2V then 1.2V/2 for output side.
  4. This example code is in the public domain
  5. */
  6. #include <Audio.h>
  7. #include <Wire.h>
  8. #include <SPI.h>
  9. #include <SD.h>
  10. AudioInputAnalog audioInput(A0); // A0 is pin 14, feel free to change.
  11. AudioAnalyzePeak peak;
  12. AudioOutputAnalog audioOutput; // DAC pin.
  13. AudioConnection c1(audioInput,peak);
  14. AudioConnection c2(audioInput,audioOutput);
  15. void setup() {
  16. AudioMemory(4);
  17. Serial.begin(9600);
  18. }
  19. // for best effect make your terminal/monitor a minimum of 31 chars wide and as high as you can.
  20. elapsedMillis fps;
  21. void loop() {
  22. if (fps > 24) {
  23. if (peak.available()) {
  24. fps = 0;
  25. uint8_t monoPeak = peak.read() * 30.0;
  26. Serial.print("|");
  27. for (uint8_t cnt=0;cnt<monoPeak;cnt++) {
  28. Serial.print(">");
  29. }
  30. Serial.println();
  31. }
  32. }
  33. }