您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

40 行
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 <SD.h>
  9. const int myInput = AUDIO_INPUT_LINEIN;
  10. // const int myInput = AUDIO_INPUT_MIC;
  11. AudioInputAnalog audioInput(A0); // A0 is pin 14, feel free to change.
  12. AudioPeak peak_M;
  13. AudioOutputAnalog audioOutput; // DAC pin.
  14. AudioConnection c1(audioInput,peak_M);
  15. AudioConnection c2(audioInput,audioOutput);
  16. void setup() {
  17. AudioMemory(4);
  18. Serial.begin(Serial.baud());
  19. }
  20. elapsedMillis fps;
  21. void loop() {
  22. if(fps>24) { // for best effect make your terminal/monitor a minimum of 31 chars wide and as high as you can.
  23. Serial.println();
  24. fps=0;
  25. uint8_t monoPeak=peak_M.Dpp()/2184.5321;
  26. Serial.print("|");
  27. for(uint8_t cnt=0;cnt<monoPeak;cnt++) Serial.print(">");
  28. peak_M.begin();
  29. }
  30. }