I added support for the VS1053 breakout boards to my Arduino Audio Tools project.
Finally the recording of sound from the microphone or the aux input is working as well both for the VS1003 and VS1053 devices!

Arduino Sketch

It is working the same like any other input:

#include "AudioTools.h"
#include "AudioLibs/VS1053Stream.h"

int channels = 1;
VS1053Stream in; // Access VS1053/VS1003 as stream
CsvStream<int16_t> csvStream(Serial, channels);
StreamCopy copier(csvStream, in); // copy in to csvStream

// Arduino Setup
void setup(void) {
    Serial.begin(115200);
    AudioLogger::instance().begin(Serial, AudioLogger::Warning);

    auto cfg = in.defaultConfig(RX_MODE);
    cfg.sample_rate = 16000;
    cfg.channels = channels;
    cfg.input_device = VS1053_MIC; // or VS1053_AUX
    in.begin(cfg);

    // make sure that we have the correct channels set up
    csvStream.begin();

}

// Arduino loop - copy data
void loop() {
    copier.copy();
}

You just request the default configuration in RX_MODE mode and then you can indicate the input_device in the configuration!

The potentially updated example can be found on Github!


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published.