-
-
Notifications
You must be signed in to change notification settings - Fork 309
Issues with FLAC and ALAC decoders #2198
-
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
Beta Was this translation helpful? Give feedback.
All reactions
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
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
arduino-audio-tools/examples/examples-player/player-sd_m4a-audiokit/player-sd_m4a-audiokit.ino
Line 31 in 534521a
Beta Was this translation helpful? Give feedback.
All reactions
-
And here is a test:
Beta Was this translation helpful? Give feedback.
All reactions
-
Please note that ALAC (Apple Lossless Audio Codec) data is stored in containers, most commonly the MP4 container with the .m4a file extension.
Beta Was this translation helpful? Give feedback.
All reactions
-
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!
Beta Was this translation helpful? Give feedback.
All reactions
-
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 :)
Beta Was this translation helpful? Give feedback.