I have a Teensy 3.1 and Audio Shield Rev B which I have configured to be a USB audio device. My problem is that the audio from the computer becomes distorted after 2 minutes.
Here's some recordings of the issue
Music: https://drive.google.com/file/d/0B89PTFSyNDGZTnd4cHpmUWVvV0U/view?usp=sharing
Sine wave: https://drive.google.com/file/d/0B89PTFSyNDGZT0JGdjBtSnlFOUU/view?usp=sharing
You can see the issue visually here from the sine wave distortion. It looks like the teensy is getting underruns and outputting zeros instead of the audio data:
I thought originally that this was a problem with the audio shield, however, I have subsequently connected a piezo buzzer to the DAC pin on the Teensy and I can hear the same distortion. I have also eliminated a fault with my Teensy by testing using a second identical Teensy and audio shield. It exhibits the same issue.
My suspicion is that there's a bug in the following file: https://github.com/PaulStoffregen/cores/blob/master/teensy3/usb_audio.cpp
Obviously I would like to fix this issue and am keen to help with the solution. I am a software programmer with some familiarity with audio systems, however, I don't have much experience with Arduino (yet). Some questions (sorry if this is noob stuff):
- Any tips on the best way to debug an issue like this?
- I've swapped the Teensy cores library for my forked one on github so I can make changes, however, I haven't been able to enable the serial output from the cores library. The serial_print() method, example here, doesn't seem to have any effect. How can I get that output?
- What is the best IDE to use for debugging/development? The Arduino one is so basic (no code completion or 'jump to method declaration' functionality).
Github issue on the cores library: https://github.com/PaulStoffregen/cores/issues/134
Here's some recordings of the issue
Music: https://drive.google.com/file/d/0B89PTFSyNDGZTnd4cHpmUWVvV0U/view?usp=sharing
Sine wave: https://drive.google.com/file/d/0B89PTFSyNDGZT0JGdjBtSnlFOUU/view?usp=sharing
You can see the issue visually here from the sine wave distortion. It looks like the teensy is getting underruns and outputting zeros instead of the audio data:
Code:
#include <Audio.h>
AudioInputUSB usb1; //xy=200,69
AudioOutputI2S i2s1; //xy=365,94
AudioConnection patchCord1(usb1, 0, i2s1, 0);
AudioConnection patchCord2(usb1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=302,184
void setup() {
AudioMemory(12);
sgtl5000_1.enable();
sgtl5000_1.volume(0.6);
}
void loop() {
}
I thought originally that this was a problem with the audio shield, however, I have subsequently connected a piezo buzzer to the DAC pin on the Teensy and I can hear the same distortion. I have also eliminated a fault with my Teensy by testing using a second identical Teensy and audio shield. It exhibits the same issue.
My suspicion is that there's a bug in the following file: https://github.com/PaulStoffregen/cores/blob/master/teensy3/usb_audio.cpp
Obviously I would like to fix this issue and am keen to help with the solution. I am a software programmer with some familiarity with audio systems, however, I don't have much experience with Arduino (yet). Some questions (sorry if this is noob stuff):
- Any tips on the best way to debug an issue like this?
- I've swapped the Teensy cores library for my forked one on github so I can make changes, however, I haven't been able to enable the serial output from the cores library. The serial_print() method, example here, doesn't seem to have any effect. How can I get that output?
- What is the best IDE to use for debugging/development? The Arduino one is so basic (no code completion or 'jump to method declaration' functionality).
Github issue on the cores library: https://github.com/PaulStoffregen/cores/issues/134