Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

41 lines
1.2KB

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