Teensy 3.6 PassThroughUSB example

Status
Not open for further replies.

preiter

New member
I have a Teensy 3.6 and the audio shield.

I loaded and ran the PassThroughUSB example (running on Windows 10). It works, but about once a minute the sound degrades and sounds sort of staticky for a couple seconds.

Any idea what could cause this?
 
I have a Teensy 3.6 and the audio shield.

I loaded and ran the PassThroughUSB example (running on Windows 10). It works, but about once a minute the sound degrades and sounds sort of staticky for a couple seconds.

Any idea what could cause this?

Hmm, not happening with YouTube videos. It was happening with an mp3 played in VLC. I'll chalk it up to Windows weirdness for now...
 
I have the same issue with a teensy 3.2 on OSX
I think it is more an issue of the USB, because after you turn off your sound for a couple of seconds and turn it on again it's back to normal. Out of my head i guess it has something todo with the buffer of the USB connection.

I tested it with:
- Itunes (after 3 minutes the sounds starts to get choppy)
- Youtube (after 3 minutes same choppy sound)
- Start with browser sound and add Itunes after it gets choppy ( The sound of Itunes stutters )
- Start browser and Itunes together (after 3 min sound becomes choppy)
The longer you listen to the sound the more choppy and distorted it becomes. The peakdetection in my code is reacting to the bad sound.
After 5 min the sound becomes inaudible.
If you start with both music from a browser and itunes and it becomes bad, and you turn down iTunes, the sound from the browser is audible again, but goes bad after a minute or 2.

I was planning on using it as a preAmp for my audio system with a peak detection feature with the latest octoWS2811 library
But not having a audio cable laying around I thought I might use the USB audio input.

My code actual code doesn't use serial out but a 40 led neopixel circle
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>




AudioInputUSB usb1; //xy=200,69 (must set Tools > USB Type to Audio)
AudioAnalyzePeak peak_L;
AudioAnalyzePeak peak_R;
AudioOutputI2S audioOutput; // audio shield: headphones & line-out


AudioConnection c1(usb1,0,peak_L,0);
AudioConnection c2(usb1,1,peak_R,0);
AudioConnection c3(usb1,0,audioOutput,0);
AudioConnection c4(usb1,1,audioOutput,1);


AudioControlSGTL5000 audioShield;




void setup() {
  AudioMemory(6);
  audioShield.enable();
  audioShield.volume(0.5);
  Serial.begin(9600);
}


// for best effect make your terminal/monitor a minimum of 62 chars wide and as high as you can.


elapsedMillis fps;
elapsedMillis volmsec=0;
uint8_t cnt=0;


void loop() {
  if(fps > 24) {
    if (peak_L.available() && peak_R.available()) {
      fps=0;
      uint8_t leftPeak=peak_L.read() * 30.0;
      uint8_t rightPeak=peak_R.read() * 30.0;

      for(cnt=0;cnt<30-leftPeak;cnt++) {
       Serial.print(" ");
      }
      while(cnt++<30) {
       Serial.print("<");
      }
      Serial.print("||");
      for(cnt=0;cnt<rightPeak;cnt++) {
       Serial.print(">");
      }
      while(cnt++<30) {
       Serial.print(" ");
      }
      Serial.println();
     }
   }
  if (volmsec > 50) {
    float vol = analogRead(15);
    vol = vol / 1023.0;
    audioShield.volume(vol); // <-- uncomment if you have the optional
    volmsec = 0; // volume pot on your audio shield
  }
}
 
Last edited:
Status
Not open for further replies.
Back
Top