Audio library on Teensy LC

Status
Not open for further replies.

Netzapper

Member
Got the LC today, tried running the same audio code on it that I was running yesterday on a 3.2.

Here's the snippet, which compiles and runs (blinks LED at expected rate) from the latest teensyduino:

Code:
#include <Audio.h>

// GUItool: begin automatically generated code
AudioSynthWaveformSine   sine1;          //xy=362,371
//AudioOutputAnalog        dac1;           //xy=744,375
//AudioConnection          patchCord1(sine1, dac1);
// GUItool: end automatically generated code

const int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
  AudioMemory(2);

  sine1.amplitude(1.0f);
  sine1.frequency(440);
}

void loop() {
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(100);
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(500);
}

Uncommenting the AudioOutputAnalog results in...nothing? It doesn't blink and the scope shows DC ground on the DAC output. Copying the DAC output code from the Teensy 3.2 home page works just fine, outputting a nice sine wave (nicer actually than the audio output wave from the 3.2). I see code #ifdef'd for the KL26Z, but it doesn't work.

Is DAC audio output expected to work on the Teensy LC? If not, no sweat... I just don't want to start debugging something that isn't supported, or start writing my own output if there's a simple fix.
 
Audio doesn't work on Teensy LC yet. I started working on it a while ago, so the code at least compiles. But almost all the objects do nothing. None of the input or output objects work yet, and the library requires at least one of those to schedule everything else to run.
 
Is there any central infrastructure that needs to be done before `AudioOutputAnalog` could be expected to work (if implemented)? Things like master audio bus, or timing, or unimplemented super classes, etc? I'm trying to get a feel for the shape of my immediate problem, whether it's just fixing a class, or fixing many layers of code.

You don't do your daily library development in the Arduino IDE, do you?
 
In theory, when AudioOutputAnalog is implemented (or any I/O object which implements the update responsibility), many parts of the library will start working. But Teensy-LC is set to use half the sample rate and buffer size, so a number of objects will need to be modified. Most have coded with #define constants that will automatically update, but some have hard-coded assumptions.

I can't put a lot of time into guiding you. If you want to dive into the code, you certainly can.
 
When can I able to use the audio library for Teensy LC?..

When someone actually works on porting the code. I started this, but it needs quite a lot more work. I am currently busy with the K66 stuff. Eventually I will do this if nobody else does, but it's a fairly low priority. Odds are slim I will get to it within 2016.

Maybe you could contribute to the project?
 
Hey, Paul, I'm eager to work with you just let me know for Audio in Teensy LC exactly which part I have to look into.
 
Hey, Paul, waiting for the contribution.

Just to be clear, I am not planning to support audio on Teensy LC for quite some time (perhaps in 2017). Even when I do, it will be very limited support. Cortex-M0+ just isn't fast enough for much of the audio library.
 
Status
Not open for further replies.
Back
Top