Using ArduinoSound library as slave

Hi all,

I'm working on my first project using I2S between an Arduino MKRZero and a VS1053 breakout and MAX98375 amplifier breakout both from Adafruit.

Using the I2S library is fine as i can set the Arduino as slave by not supplying a sample rate in begin().

The VS1053 can only operate as master.

I'd like to use the FFT options of the ArduinoSound library but it doesnt seem to have an option to run the Arduino as slave, only master.

Since the ArduinoSound library appears to be be simply a wrapper for the I2S library i was hoping to find a way to use the ArduinoSound library on the Arduino as slave.

Any ideas?

Thanks

Hi Spleen,

I'm having the same issue as you trying to use the ArduinoSound library to stream audio over I2S to a DSP that is the master in my system. Did you ever find a solution?

I've dug around the ArduinoSound library files and cannot find where the library is initiating the stream as the master, but I am not very experienced with the construction of Arduino Libraries so may well have missed something.

Has anyone else got any ideas?

Thanks.

EddP

Okay, so I made a little progress and I thought I would share for other people's reference.

The I2S library which ArduinoSound calls initialises the I2S stream with the I2SBegin command. If you omit the sampleRate from this command it initialises the stream with the Arduino as the I2S slave device (i.e. expecting BCLK & LRCLK signals from a master).

I found one instance of this in the library so I made a copy and removed the sampleRate. Running the example script with this modified library allowed the .WAV on the SD card to stream to my DSP (ADAU1701 in this case) but there were some seriously bad clocking issues going on causing a highly distorted audio stream.

When you run the I2S library example scripts in this configuration (Arduino as Slave, DSP as Master) there are no issues, but this is just the Arduino generating a square wave on board. I think the issue might be with pulling the .WAV data off the SD card and synchronising this to an external clock, hence why this feature was not added to the ArduinoSound Library by default. Thats where my knowledge ends, so i'll have to do some more research!

If anyone has any insights i'd love to know!

Thanks.