-
-
Notifications
You must be signed in to change notification settings - Fork 282
Audio Effects
Phil Schatzmann edited this page Feb 6, 2022
·
27 revisions
AudioEffects is the starting class to manage different type of effects. In the constructor of the AudioEffects class we pass the input to which we apply the effects. We can use the GeneratedSoundStream class to convert the AudioEffects as an input stream source. Here is an example how to set up the different objects:
SineWaveGenerator<int16_t> sine;
AudioEffects<SineWaveGenerator<int16_t>> effects(sine);
ADSRGain adsr(0.0001,0.0001, 0.9 , 0.0002);
GeneratedSoundStream<int16_t> in(effects);
I2SStream out;
StreamCopy copier(out, in);
In the setup() we then assign one or multiple Effect implementations.
void setup() {
...
// setup effects
effects.addEffect(adsr);
// Setup output
auto cfg = i2s.defaultConfig(TX_MODE);
cfg.sd_active = false;
i2s.begin(cfg);
// Setup sound generation based on AudioKit settins
sine.begin(cfg, 0);
in.begin(cfg);
...
}