using the envelope object with the pwm output

Status
Not open for further replies.

Kyub

New member
I am trying out the Audio Library on a Teensy 3.6 running at 96 MHz. It seems like the envelope object only gates pin 4 and not pin 3. Is that right? I see pwm signals on both pins but only one is modulated.

Here is the code

#include <Audio.h>
#include <Wire.h>

// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=170,281.7778072357178
AudioEffectEnvelope envelope1; //xy=369,276
AudioOutputPWM pwm1; //xy=517,278.00000190734863
AudioConnection patchCord1(sine1, envelope1);
AudioConnection patchCord2(envelope1, pwm1);
// GUItool: end automatically generated code

void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(12);
sine1.frequency(440);
sine1.amplitude(1);
envelope1.attack(50);
envelope1.decay(50);
envelope1.release(250);
}

void loop() {
envelope1.noteOn();
delay(800);
envelope1.noteOff();
delay(600);
}

I note generally that the pwm output doesn't seem to be locked to the dac output (probably okay for audio, alas --I'm building a phase locked loop). Pretty slick library, though.

Thanks.

Keith
 
Status
Not open for further replies.
Back
Top