Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Issues with FLAC and ALAC decoders #2198

Answered by pschatzmann
protodoatt asked this question in Q&A
Discussion options

Hi! I'm new to this framework, recently moved from using the esp adf to develop a little pet project of mine to this. I'm trying to get accustomed to everything so im testing out all sorts of sketches, the library is great but im having a bit of trouble with the FLAC and ALAC decoders. None of them seem to be able to read a file from the web. I've had great success with AAC and streaming an internet radio both to csv and to I2S out but whenever I use FLAC I get this
CodecFLAC.h : 122 - FLAC not active

here is my code sketch

#include "AudioTools.h"
#include "AudioTools/AudioCodecs/CodecFLAC.h"
#include "AudioTools/Communication/AudioHttp.h"
const char* ssid = "ssid";
const char* pwd = "password";
URLStream url(ssid, pwd);
FLACDecoder dec;
I2SStream i2s;
void setup() {
 Serial.begin(115200);
 AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info); 
 i2s.begin(i2s.defaultConfig(TX_MODE));
 url.begin("http://upload.wikimedia.org/wikipedia/commons/5/5e/Debussy_-_Pour_les_accords.flac");
 dec.setInput(url);
 dec.setOutput(i2s);
 dec.begin();
}
void loop() {
 dec.copy();
}

and for ALAC, when I replace the Helix AAC Decoder element in a default sketch(the one for internet radio, that WORKS) with it and I change the address to point it to a file on my local server(of course). I get this
[E] CodecALAC.h : 112 - Decode failed with error: -50

Am I being stupid here? The network connection seems to be happening fine even though these errors seem to be pointing to the fact that the file cannot be properly read.
Thanks in advance for the help

You must be logged in to vote

Did you try to use an EnodedAudioOutput (or EnodedAudioStream) class like in all my examples ?
I would expect that at least for ALAC the WiFi access is much too slow. I needed to use some fast SDMMC to make it play back from an SD drive w/o breaking up.

Replies: 1 comment 7 replies

Comment options

Did you try to use an EnodedAudioOutput (or EnodedAudioStream) class like in all my examples ?
I would expect that at least for ALAC the WiFi access is much too slow. I needed to use some fast SDMMC to make it play back from an SD drive w/o breaking up.

You must be logged in to vote
7 replies
Comment options

Comment options

And here is a test:

Comment options

Please note that ALAC (Apple Lossless Audio Codec) data is stored in containers, most commonly the MP4 container with the .m4a file extension.

Comment options

Okay, so I think for ALAC the reason why the test was working but streaming m4a from a http server wasn't was because I wasn't using the ContainerM4A class, I was just feeding URLStream directly into the DecoderALAC class(I now see this is specifically mentioned on your blog, my bad). However, what is weird is that when I tested streaming AAC from an m4a container, in the same circumstances, it streamed it just fine. I will test it again tomorrow using ContainerM4A.
Thanks so much for the helpful and quick reply! This library is awesome!

Comment options

Please note that ALAC (Apple Lossless Audio Codec) data is stored in containers, most commonly the MP4 container with the .m4a file extension.

Yes, I was just writing my reply at the same time :)

Answer selected by pschatzmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /