|
- /* Mono peak meter example using Analog objects. Assumes Teensy 3.1
-
- 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.
- 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.
-
- This example code is in the public domain
- */
-
- #include <Audio.h>
- #include <Wire.h>
- #include <SPI.h>
- #include <SD.h>
-
- AudioInputAnalog audioInput(A0); // A0 is pin 14, feel free to change.
- AudioAnalyzePeak peak;
- AudioOutputAnalog audioOutput; // DAC pin.
-
- AudioConnection c1(audioInput,peak);
- AudioConnection c2(audioInput,audioOutput);
-
- void setup() {
- AudioMemory(4);
- Serial.begin(9600);
- }
-
- // for best effect make your terminal/monitor a minimum of 31 chars wide and as high as you can.
-
- elapsedMillis fps;
-
- void loop() {
- if (fps > 24) {
- if (peak.available()) {
- fps = 0;
- uint8_t monoPeak = peak.read() * 30.0;
- Serial.print("|");
- for (uint8_t cnt=0;cnt<monoPeak;cnt++) {
- Serial.print(">");
- }
- Serial.println();
- }
- }
- }
|