mp3 file --> I2S #26
-
For testing purposes, I'm looking for a simple solution to output an mp3 stream to i2s. I used the example |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
You just call i2s.write(data, len); However I recommend you use the AudioTools, where you can just copy the data from the source to the target. |
Beta Was this translation helpful? Give feedback.
-
This is exactly what I was looking for. Only an assert is thrown.
The error: |
Beta Was this translation helpful? Give feedback.
-
The mp3 decoder expects that is can write all the data to the output. I guess some buffer is defined too small. MemoryStream data(BabyElephantWalk60_mp3, BabyElephantWalk60_mp3_len); // MP3 data source
MP3DecoderHelix mp3;
I2SStream i2s; // final output of decoded stream
EncodedAudioStream dec(&i2s, &mp3); // Decoding stream
StreamCopy copier(dec, data); // copy dec to out |
Beta Was this translation helpful? Give feedback.
You just call i2s.write(data, len);
Please note that the len must be specified is in bytes! and i2s must be declared and started properly before.
However I recommend you use the AudioTools, where you can just copy the data from the source to the target.