I recently tried to use gate with my teensy 4.0 and had no such luck...
It does not produce any errors but also has no effect on the sound. I tried chaging the settings to many different values, but no matter what I do the audio is unaffected. Unfortunately I am not aware of all of the changes in audio library code for a year or so (and since teensy 4.0). Can someone help me by taking a look at effect_gate.cpp and effect_gate.h to see if they can help me figure out what the issue is.
https://github.com/macaba/Audio
Here is my code as well.
Thanks!
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <effect_gate.h>
// GUItool: begin automatically generated code
AudioControlSGTL5000 sgtl5000_1;
AudioOutputI2S i2s2;
AudioSynthNoiseWhite noise1; //xy=203,482
AudioSynthSimpleDrum drum1; //xy=203,522
AudioMixer4 mixer1; //xy=433,407
AudioEffectGate gate1; //xy=687,440
AudioConnection patchCord1(noise1, 0, mixer1, 0);
AudioConnection patchCord2(drum1, 0, mixer1, 1);
AudioConnection patchCord3(mixer1, 0, gate1,0);
AudioConnection patchCord4(mixer1, 0, i2s2, 0);
AudioConnection patchCord5(gate1, 0, i2s2, 1);
// GUItool: end automatically generated code
unsigned long last_time = millis();
void setup() {
AudioMemory(10);
noise1.amplitude(0.02);
drum1.frequency(180);
drum1.length(400);
drum1.secondMix(0.3);
drum1.pitchMod(0.7);
mixer1.gain(1,1.6);
gate1.threshold(0.2);
gate1.attack(.001);
gate1.release(10);
gate1.hold(10);
gate1.floor(.01);
AudioProcessorUsageMaxReset();
AudioMemoryUsageMaxReset();
}
void loop() {
if(1) {
if(millis() - last_time >= 1000) {
Serial.print("Proc = ");
Serial.print(AudioProcessorUsage());
Serial.print(" (");
Serial.print(AudioProcessorUsageMax());
Serial.print("), Mem = ");
Serial.print(AudioMemoryUsage());
Serial.print(" (");
Serial.print(AudioMemoryUsageMax());
Serial.println(")");
last_time = millis();
drum1.noteOn();
}
}
}