-
Notifications
You must be signed in to change notification settings - Fork 11
AudioTools: I2SCodecStream
Phil Schatzmann edited this page Feb 6, 2024
·
8 revisions
You can use the I2SCodecStream like the I2SStream but it provides some additional functionality, like setting the volume via the codec. In the constructor you need to provide an audio board object.
#include "AudioTools.h"
#include "AudioLibs/I2SCodecStream.h"
I2SCodecStream i2s(LyratV43);
void setup() {
// setup i2s and codec
auto cfg = i2s.defaultConfig();
cfg.sample_rate = 44100;
cfg.bits_per_sample = 16;
cfg.channels = 1;
i2s.begin();
// set volume
i2s.setVolume(0.5);
}