Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: AudioInputUSB - AudioAnalyzePeak

  1. #1
    Junior Member
    Join Date
    Apr 2018
    Posts
    3

    AudioInputUSB - AudioAnalyzePeak

    Hello Everyone

    Here my very simple Test-Code (Board: Teensy 3.2):

    PHP Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>

    // GUItool: begin automatically generated code
    AudioInputUSB            usb1;           //xy=101,107
    AudioAnalyzePeak         peak1;          //xy=308,101
    AudioConnection          patchCord1(usb10peak10);
    // GUItool: end automatically generated code

    void setup() {
      
    AudioMemory(10);
    }

    void loop() {
      if (
    peak1.available()) {
        
    Serial.println(peak1.read());
      }

    "Peak1.available()" never retuns true, no matter if there is some signal (music) from USB or not.

    If I only use "Serial.println(peak1.read())", I got some values when music is on. If there is no music or signal, it returns 1 (instead of 0).

    Anyone knows the reason?

    Thanks for help
    Stephan

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,498
    You need at least one hardware input or output, even if unused without any signal connected.

    See the docs here: (right side panel)

    https://www.pjrc.com/teensy/gui/?info=AudioInputUSB

    USB input & output does not cause the Teensy Audio Library to update. At least one non-USB input or output object must be present for the entire library to update properly.

  3. #3
    Junior Member
    Join Date
    Apr 2018
    Posts
    3
    Thanks Paul

    Now it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •