Giter Club home page Giter Club logo

Comments (111)

pschatzmann avatar pschatzmann commented on May 19, 2024 1

have you tried the following in your sketch:

player.stop();
source.setPos(idx);
player.play(); 

I did not want to provide the direct navigation on the player level because not all AudioSource objects can support this...

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024 1

The easiest is to add an additional size() method to AudioSourceURL and just return this->max

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I pushed the related correction to main. I also extended the example to demo how to debounce the input...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

in you example you need to change debouncer.debounce to nextBuffonDebouncer.debounce()

I did some tests with player.next and I can not change between other channels than 0 en 1.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Is this issue with my example ?
This would happen if the arraySize has not been defined correctly in the constructor of AudioSourceURL.
Anyhow I will retest this tomorrow...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I diden't set it right in the AudioSourceURL. I changed it from 5 to 2. I do the test now... and it works.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I changed the constructor so that the array size is not needed any more to prevent this problem for others.
Are we ready to close this issue as well ?

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Good, no I want to select a station over a2dp if this is possible. I am looking now for making this possible...

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Not sure if I understand your correctly but note the following:
#9

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I have updated the library and now the player doesn't compile anymore...

AudioOutput.h: 575:73: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
} else if (p_info_in->channels = 1 && p_info_out->channels>1){

AudioOutput.h: 579:48: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]
} else if (p_info_out->channels = 1){

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Sorry about that, but I did't not get this when I tested in Arduino...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Did you enabled the warnings for compiling?

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

It's set to Default

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

mine too...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

It is compiling now. Thx

I tried to set the config file back to the settings that worked in the previous topic I have made. But now the music stops. Soo I tried different settings but it keeps chunking.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Maybe it was the antenna again. I's running good now with the default settings

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Did you use the resolved links in your examples?

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I am using now a local http link out of your xml and it's running much better now.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Could you please add a procedure "select radio station by index number" of the array url?
I have 25 radiostations added and it would be handy if I just could type a number to selected one radio station I want to lissen too.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I have made a station select. I will look to upload when I am back.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I know, I did it the same way... It diden't cost me a lot of work to do, but I will take over the latest version.

I also add this...

  Serial.print(RadioPos);
  Serial.print("/");
  Serial.println(sizeof(urls) / sizeof(urls[0]));

it says url 1 of 5 is playing... You could add this to your log if you like.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

If I want to make a portable radio I was thinking to impliment a small display... For that it will be usefull to have the name of the radio station in that array. You could also add the index to it.

For now I will integrate it in to a existing build in spreaker system without display. But maybe I will make something like a portable in the futer. This is what I had in mind.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I just wanted to highlight, that this is the advantage of my design: It is object oriented!
So all you need to do is to create your own subclass from the AudioSourceURL and adding all your additional (e.g. display related) functionality.

Then you can just provide your own implementation as parameter to the AudioPlayer....

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

have you tried the following in your sketch:

player.stop();
source.setPos(idx);
player.play(); 

I did not want to provide the direct navigation on the player level because not all AudioSource objects can support this...

I don't know why this continuesly doesn't work with me and after revise it it does, but it doesn't change the station on index with me. The log says it is changing but nothing ever happend...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

This doesn't shows up

[W] HttpHeader.h : 226 - Waiting for data...
[W] HttpRequest.h : 141 - no CONTENT_LENGTH found in reply

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I looked into the audioplayer.h file and now I see.. Set stream and begin stream is not called.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Here is my shetch. I let out the bouncing thing out... For me it is easier too understand.

#define USE_HELIX 

#include "AudioTools.h"
#include "AudioCodecs/CodecMP3Helix.h"

using namespace audio_tools;

const char* urls[] = {
"http://19983.live.streamtheworld.com/QMUSIC.mp3",
"http://mp3.streampower.be/sporza-high",
"http://20723.live.streamtheworld.com/QFOUTERADIO.mp3",
"http://22183.live.streamtheworld.com/JOE.mp3",
"http://21303.live.streamtheworld.com/STUDIO_BRUSSEL_128.mp3",
"http://icecast-servers.vrtcdn.be/stubru_tgs-high.mp3",
"http://icecast-servers.vrtcdn.be/stubru_tijdloze-high.mp3",
"http://icecast-servers.vrtcdn.be/ketnetradio-high.mp3",
"http://22353.live.streamtheworld.com/MNM_128.mp3",
"http://icecast-servers.vrtcdn.be/mnm_90s00s-high.mp3",
"http://icecast-servers.vrtcdn.be/mnm_hits-high.mp3",
"http://icecast-servers.vrtcdn.be/mnm_urb-high.mp3",
"http://fred.torontocast.com:1050/stream",
"http://icecast-servers.vrtcdn.be/radio1_classics_high.mp3",
"http://icecast-servers.vrtcdn.be/radio2_benebene-high.mp3",
"http://icecast-servers.vrtcdn.be/radio2_unwind-high.mp3",
"http://icecast-servers.vrtcdn.be/stubru_bruut-high.mp3",
"http://icecast-servers.vrtcdn.be/stubru_untz-high.mp3"
"http://23553.live.streamtheworld.com:80/RADIO_2_VLAAMSBR_128.mp3",
"http://randstad.wirelessbelgie.be:8330/stream.mp3",
"https://22323.live.streamtheworld.com/TOPRETRO.mp3",
"http://21253.live.streamtheworld.com/RADIO1_128.mp3",
};
const char* StationName[] = {
"QMusic",
"Sporza",
"Q Foute Radio",
"JOE",
"Studio Brussel",
"Stubru Tgs",
"Stubru Tijdloze",
"Ketnet Radio",
"MNM",
"MNM 90s 00s",
"MNM Hits",
"MNM urban",
"Fred",
"Radio1 Classics",
"Radio2 Benebene",
"Radio2 Unwind",
"Stubru Bruut",
"Stubru Untz",
"Radio 2",
"Randstad",//versneld
"TOPRETRO",
"Radio 1"
};

const char* wifi = "SSID";
const char* password = "Pass";

URLStream urlStream(wifi, password);
AudioSourceURL source(urlStream, urls, "audio/mp3");
I2SStream i2s;
VolumeOutput volume(i2s);
MP3DecoderHelix decoder;
AudioPlayer player(source, volume, decoder);

unsigned long currentMillis;
unsigned const long StationDelay = 15000;
unsigned long StationMillis = 0;

int RadioPos = 2;

void setup() {
	Serial.begin(115200);
	//AudioLogger::instance().begin(Serial, AudioLogger::Info);

	// setup output
	auto cfg = i2s.defaultConfig(TX_MODE);
	i2s.begin(cfg);

	// setup player
	//player.setCallbackMetadata(printMetaData);
	player.begin();
	volume.setVolume(0.1);
}
void loop() {
	player.copy();
	AutoNextStation();
	//AutoSelectStation();
	//delay(5);
}
void AutoNextStation() {
	currentMillis = millis();
	if (currentMillis - StationMillis > StationDelay) {
		Serial.println("Next Stream");
		StationMillis = currentMillis;
		NextStation();
		RadioPos += +1;
		if (RadioPos > sizeof(urls) / sizeof(urls[0]))RadioPos = 1;
	}
}
void NextStation() {
		player.next();

		Serial.print(RadioPos);
		Serial.print("/");
		Serial.println(sizeof(urls) / sizeof(urls[0]));
		Serial.println(urls[RadioPos-1]);
		Serial.println(StationName[RadioPos - 1]);
}

void AutoSelectStation() {
	currentMillis = millis();
	if (currentMillis - StationMillis > StationDelay) {
		Serial.println("Next Stream");
		StationMillis = currentMillis;
		SelectStation(RadioPos);
		RadioPos += +1;
		if (RadioPos > sizeof(urls) / sizeof(urls[0]))RadioPos = 1;
	}
}
void SelectStation(uint8_t IntRadioPos) {
	player.stop();
	delay(200);
	player.Select(IntRadioPos);
	player.play();

	//player.stop();
	//source.setPos(RadioPos);
	//player.play();

	Serial.print(IntRadioPos);
	Serial.print("/");
	Serial.println(sizeof(urls) / sizeof(urls[0]));
	Serial.println(urls[IntRadioPos - 1]);
	Serial.println(StationName[RadioPos - 1]);
}

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

The only thing that is bothering me is that after a switch the station remains producing sound of the previous radio station for a second and than it addapt. It would be bether if the sound stops and after we do play, the next staton can be heard.

I tried to empty the buffer but than it's producing a scratching sound. Maybe mute the sound for a second could be a solution. There could be others too...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Another solution would be

void SelectStation(uint8_t IntRadioPos) {
	player.stop();
	volume.setVolume(0.0);
	delay(200);
	player.Select(IntRadioPos);
	player.play();
	unsigned long starttime = millis();
	unsigned long endtime = starttime;
	while((endtime - starttime) <= 1000)
	{
		endtime = millis();
		player.copy();
	}
	volume.setVolume(0.1);

	//player.stop();
	//source.setPos(RadioPos);
	//player.play();

	Serial.print(IntRadioPos);
	Serial.print("/");
	Serial.println(sizeof(urls) / sizeof(urls[0]));
	Serial.println(urls[IntRadioPos - 1]);
	Serial.println(StationName[RadioPos - 1]);
}

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Test report:

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I would take the active stream, than it can be called in the middle of a program.

/// (Re)Starts the playing of the music (from the beginning)
        virtual bool begin(bool isActive = true) {
            LOGD(LOG_METHOD);
            bool result = false;

            // start dependent objects
            p_out_decoding->begin();
            p_source->begin();
            meta_out.begin();

            // get first streem
            p_input_stream = p_source->nextStream(1);
            if (p_input_stream!=nullptr) {
                if (meta_active){
                    copier.setCallbackOnWrite(decodeMetaData, this);
                }
                copier.begin(*p_out_decoding, *p_input_stream);
                timeout = millis() + p_source->timeoutMs();
                active = isActive;
                result = true;
            } else {
                LOGW("-> begin: no data found");
            }
            return result;
        }

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024
  • After many switches sometimes it get stuck and than it switch to an other station, but the doesn't output the audio anymore.

Diden't occur anymore after the push and 1440 station switches.

If not connected and switch to an other station, than it gives this message too. Tested with longer switching times, but problem was not solved. I am sure it will connect tomorow again without changing anything and happens again.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I want to add previous stream and want to determe the size of the array. I get 4 and I have more than 21 urls.

sizeof(urlArray)

Any idea's?

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

ps. previous is next(-1)

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

yes,that's the size. I think the urlarray is not loaded completly... It get stuck

pos
-1
pos
21
[I] AudioPlayer.h : 294 - previousStream: 21 -> ?
[I] URLStream.h : 57 - URLStream.begin ?
[I] Url.h : 73 - Url::parse
.....

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

ps. previous is next(-1)

I'm not sure

  	if (pos < 0 || pos >= max) {
  		pos = max;
  	}

vs

        if (pos<0 || pos>=max){
            pos=0;
        }

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024
  if (pos < 0 || pos >= max) {
  	pos = max;
  }

My mistake, it has to be.

		if (pos < 0 || pos >= max) {
			pos = max-1;
		}

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I would recommend
if (pos < 0) {
pos = 0
} else if (pos >= max) {
pos = max-1;
}

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Could you please check again the lastest version. I don't have sound anymore and it get stuck.

Opening port
Port open
�[D] I2SStream.h : 87 - void audio_tools::I2SStream::begin(audio_tools::I2SConfig)
[D] I2SESP32.h : 37 - void audio_tools::I2SBase::begin(audio_tools::I2SConfig)
[I] I2SESP32.h : 244 - rx/tx mode: TX
[I] I2SESP32.h : 245 - sample rate: 44100
[I] I2SESP32.h : 246 - bits per sample: 16
[I] I2SESP32.h : 247 - number of channels: 2
[I] I2SESP32.h : 248 - is_master: Master
[I] I2SESP32.h : 249 - mode: 0
[I] I2SESP32.h : 253 - pin bck_io_num: 26
[I] I2SESP32.h : 254 - pin ws_io_num: 25
[I] I2SESP32.h : 255 - pin data_num: 22
[D] I2SESP32.h : 91 - begin - started
[D] AudioPlayer.h : 609 - virtual void audio_tools::AudioPlayer::setCallbackMetadata(void ()(audio_tools::MetaDataType, const char, int))
[D] AudioPlayer.h : 472 - virtual bool audio_tools::AudioPlayer::begin(int, bool)
[D] AudioOutput.h : 295 - void audio_tools::EncodedAudioStream::begin()
[D] CodecMP3Helix.h : 76 - virtual void audio_tools::MP3DecoderHelix::begin()
[D] AudioPlayer.h : 279 - virtual void audio_tools::AudioSourceURL::begin()
[I] AudioPlayer.h : 303 - url array out of limits: 0 -> 1
[I] AudioPlayer.h : 309 - selectStream: 1/20 -> http://19983.live.streamtheworld.com/QMUSIC.mp3
[I] AudioOutput.h : 427 - setVolume: 0.100000
end setup
[D] AudioPlayer.h : 589 - virtual void audio_tools::AudioPlayer::copy()
[D] AudioPlayer.h : 589 - virtual void audio_tools::AudioPlayer::copy()
...
[D] AudioPlayer.h : 589 - virtual void audio_tools::AudioPlayer::copy()
Next Stream
[I] AudioOutput.h : 427 - setVolume: 0.000000
[D] AudioPlayer.h : 530 - virtual bool audio_tools::AudioPlayer::next(int)
[I] AudioPlayer.h : 288 - nextStream: 2/20 -> http://20723.live.streamtheworld.com/QFOUTERADIO.mp3
[D] URLStreamESP32.h : 170 - void audio_tools::URLStream::begin(const char*, const char*, MethodID, const char*, const char*)
[I] URLStream.h : 57 - URLStream.begin http://20723.live.streamtheworld.com/QFOUTERADIO.mp3
[D] Url.h : 59 - setUrl http://20723.live.streamtheworld.com/QFOUTERADIO.mp3
[D] StrExt.h : 109 - StrExt::grow(52)
[I] Url.h : 73 - Url::parse
[D] StrExt.h : 109 - StrExt::grow(4)
[D] StrExt.h : 109 - StrExt::grow(29)
[D] StrExt.h : 109 - StrExt::grow(16)
[D] StrExt.h : 109 - StrExt::grow(36)
[I] Url.h : 109 - url->http://20723.live.streamtheworld.com/QFOUTERADIO.mp3
[I] Url.h : 110 - host->20723.live.streamtheworld.com
[I] Url.h : 111 - protocol->http
[I] Url.h : 112 - path->/QFOUTERADIO.mp3
[I] Url.h : 113 - port->80
[D] URLStream.h : 197 - connectWiFi
.....
[I] URLStream.h : 179 - WiFiClient
[I] HttpRequest.h : 178 - process connecting to host 20723.live.streamtheworld.com port 80
[I] HttpRequest.h : 166 - connect 20723.live.streamtheworld.com
[I] HttpRequest.h : 189 - Free heap: 219140
[I] HttpHeader.h : 348 - HttpRequestHeader::setValues - path: /QFOUTERADIO.mp3
[D] HttpHeader.h : 305 - HttpHeader::headerLine - new line created for Host
[D] StrExt.h : 109 - StrExt::grow(4)
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Host' : '20723.live.streamtheworld.com'
[D] StrExt.h : 109 - StrExt::grow(29)
[D] HttpHeader.h : 305 - HttpHeader::headerLine - new line created for Connection
[D] StrExt.h : 109 - StrExt::grow(10)
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Connection' : 'close'
[D] StrExt.h : 109 - StrExt::grow(5)
[D] HttpHeader.h : 106 - HttpHeader::put - value ignored because it is null for User-Agent
[D] HttpHeader.h : 106 - HttpHeader::put - value ignored because it is null for Accept-Encoding
[D] HttpHeader.h : 305 - HttpHeader::headerLine - new line created for Accept
[D] StrExt.h : 109 - StrExt::grow(6)
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Accept' : 'audio/mp3'
[D] StrExt.h : 109 - StrExt::grow(9)
[D] HttpHeader.h : 106 - HttpHeader::put - value ignored because it is null for Content-Type
[I] HttpHeader.h : 249 - HttpHeader::write
[I] HttpHeader.h : 357 - HttpRequestHeader::write1stLine
[I] HttpHeader.h : 372 - -> GET /QFOUTERADIO.mp3 HTTP/1.1
[D] HttpHeader.h : 164 - HttpHeader::writeHeaderLine: Host
[I] HttpHeader.h : 185 - -> Host: 20723.live.streamtheworld.com
[D] HttpHeader.h : 164 - HttpHeader::writeHeaderLine: Connection
[I] HttpHeader.h : 185 - -> Connection: close
[D] HttpHeader.h : 164 - HttpHeader::writeHeaderLine: Accept
[I] HttpHeader.h : 185 - -> Accept: audio/mp3
[I] HttpHeader.h : 288 - ->
[I] HttpRequest.h : 213 - Request written ... waiting for reply
[I] HttpHeader.h : 219 - HttpHeader::read
[W] HttpHeader.h : 226 - Waiting for data...
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> HTTP/1.0 403 Forbidden
[I] HttpHeader.h : 443 - HttpReplyHeader::parse1stLine: HTTP/1.0 403 Forbidden
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Expires: Thu, 01 Dec 2003 16:00:00 GMT
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Cache-Control: no-cache, must-revalidate
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Pragma: no-cache
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Access-Control-Allow-Headers: *
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Access-Control-Expose-Headers: *
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Access-Control-Allow-Methods: GET, HEAD
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Access-Control-Allow-Origin: *
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Connection: close
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Content-Length: 103
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Content-Type: text/html
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> X-STW-Error: 430 Invalid Mount
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine ->
[D] HttpLineReader.h : 20 - HttpLineReader readlnInternal
[I] HttpHeader.h : 155 - HttpHeader::readLine -> <title>403 Forbidden</title>

403 Forbidden

Invalid Mount
[W] HttpRequest.h : 141 - no CONTENT_LENGTH found in reply
[I] URLStream.h : 72 - size: 0
[I] URLStream.h : 211 - Request written ... waiting for reply

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

No change from my side which would cause this. If you open the url in the browser you can see the same error. So the issue is with the url.

ps. After the last commit, I have all AudioPlayer scenarios working properly now - even the Streaming to Bluetooth is working nicely.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

No change from my side which would cause this.

I have tested with you example streams-url_mp3-i2s and that one works great. You dident't make big changes... That right! I But you did a few smaller ones in here 35741bc

If you open the url in the browser you can see the same error. So the issue is with the url.

That was the issue on my first push I have made. I had a weekend radio station as first link and another issue was that it diden't change to the next. But that is all solved now.

Now I have no sound on the player at that same url I used in streams-url_mp3-i2s.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

How can I reproduce this ?

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

wait! I just tested with the original urls and they work. I looking what is going on...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Found the issue why it get stuck. I see it happens offen that radiostation give errors like

403 forbidden
503 Service Temporarily Unavailable

That information is in the [I] HttpHeader.h : 155

Could you skip if this happens and go on to the next please? I think you have to be carefull with that because if we are going up it will go to next. But if we go down (previous) and we use next than it get stuck on that.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Hmm, the following is implemented: We wait for data - if we do not get any data after a timeout we skip to the next entry.
I would have expected that this is covered by this logic.

Maybe you just need to decrease the timeout if you want to limit the waiting time. Currently the default is a little bit high with 60000ms.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I tried to add some additional logic and decreased the max timeoutto 10 secs...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Still getting [I] URLStream.h : 211 - Request written ... waiting for reply

here is the link
http://20723.live.streamtheworld.com/QFOUTERADIO.mp3

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

this helps...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

And this one does not spond if it is not broadcasting.

http://mp3.streampower.be/sporza-high

Then I get a backtrace

> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioTools/AudioPlayer.h(45): error 0x400d5014:audio_tools
> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioHttp/URLStreamESP32.h:202:::(inlined by) audio_tools:
> 0x400014fd: ?? ??:0
> 0x4000150d: ?? ??:0
> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioTools/AudioPlayer.h(45): error 0x400d6d5f:audio_tools
> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioTools/AudioPlayer.h(45): error 0x400d1e49:audio_tools
> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioTools/AudioPlayer.h(45): error 0x400d1de2:audio_tools
> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioTools/AudioPlayer.h(45): error 0x400d60e7:NextStation()
> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioTools/AudioPlayer.h(45): error 0x400d613d:AutoNextStation()
> E:\Documents\Visual Studio 2019\Projects\Arduino\libraries\arduino-audio-tools\src/AudioTools/AudioPlayer.h(45): error 0x400d6161:loop()
> C:\Users\Dave2Moon\AppData\Local\arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32/main.cpp(23): error 0x400ddd90:loopTask(void*)
> /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1):::0x400899c2:vPortTaskWrapper
> 0x40078000: ?? ??:0
> 0x40080400: ?? ??:0
> 0x400806a8: ?? ??:0

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I am afraid that for this one I wont have a solution - the browser behaves the same and never returns...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I know that it's a difficult one. What I know from that channel is that it changes from name in the weekends. Soo what we get is because of technical reasons.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I think you better set the timout back to 60sec because after a while it keeps changing from station to station without outputing audio anymore

W] AudioPlayer.h : 589 - -> timeout - moving to next stream

does this work with you?
player.setCallbackMetadata(printMetaData);
I don't get any data from it

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Just committed the correction to handle the case when we can a http failure return code.
I think we can leave the timeout low after the latest change...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I tried to add some additional logic and decreased the max timeoutto 10 secs...

The time is much faster than 10sec... and sometimes it is 10sec.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Feel free to increase the value in the sketch by calling the setTimeout() on the AudioSourceURL object...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

here is the compete list. Normaly the all broadcasting. after 8 done it keeps returning timeout.

"http://19983.live.streamtheworld.com/QMUSIC.mp3",
"http://22183.live.streamtheworld.com/JOE.mp3",
"http://21303.live.streamtheworld.com/STUDIO_BRUSSEL_128.mp3",
"http://icecast-servers.vrtcdn.be/stubru_tgs-high.mp3",
"http://icecast-servers.vrtcdn.be/stubru_tijdloze-high.mp3",
"http://icecast-servers.vrtcdn.be/ketnetradio-high.mp3",
"http://22353.live.streamtheworld.com/MNM_128.mp3",
"http://icecast-servers.vrtcdn.be/mnm_90s00s-high.mp3",
"http://icecast-servers.vrtcdn.be/mnm_hits-high.mp3",
"http://icecast-servers.vrtcdn.be/mnm_urb-high.mp3",
"http://fred.torontocast.com:1050/stream",
"http://icecast-servers.vrtcdn.be/radio1_classics_high.mp3",
"http://icecast-servers.vrtcdn.be/radio2_benebene-high.mp3",
"http://icecast-servers.vrtcdn.be/radio2_unwind-high.mp3",
"http://icecast-servers.vrtcdn.be/stubru_bruut-high.mp3",
"http://icecast-servers.vrtcdn.be/stubru_untz-high.mp3"
"http://23553.live.streamtheworld.com:80/RADIO_2_VLAAMSBR_128.mp3",
"http://randstad.wirelessbelgie.be:8330/stream.mp3",
"https://22323.live.streamtheworld.com/TOPRETRO.mp3",
"http://21253.live.streamtheworld.com/RADIO1_128.mp3",

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

is this after my latest correction ?

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

how about 15 or 20 seconds as default value ?
I think 1 minute is too much...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I try now source.setTimeoutMs(15000);

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I am on 20000ms and I am on url 19 and then it start again

E] HttpRequest.h : 181 - Connect failed
Next Stream
[W] HttpHeader.h : 225 - Waiting for data...
[W] HttpRequest.h : 141 - no CONTENT_LENGTH found in reply
[W] AudioPlayer.h : 589 - -> timeout - moving to next stream
[W] HttpHeader.h : 225 - Waiting for data...
[W] HttpRequest.h : 141 - no CONTENT_LENGTH found in reply
[W] AudioPlayer.h : 589 - -> timeout - moving to next stream

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

These are all links where I had issues on before... only on the esp32. I just tested them all in the webbrowser on my pc and they all work.

//"http://23553.live.streamtheworld.com:80/RADIO_2_VLAAMSBR_128.mp3",
//"http://randstad.wirelessbelgie.be:8330/stream.mp3",
//"https://22323.live.streamtheworld.com/TOPRETRO.mp3", // THIS IS THE LINK WHERE IT STOPS WORKING NOW.
//"http://streams.movemedia.eu:8000/zoefmmp3"
//"http://21253.live.streamtheworld.com/RADIO1_128.mp3",
//"https://22193.live.streamtheworld.com/OWR_DAB.mp3",
//"http://eu2.radioboss.fm:8124/stream",

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

if I place this link below as first station and change evry 30sec form station and set the timeout on 20000ms than it plays sound but it is pitching sometimes. Like it can not follow the data and want to catchup. Or the data is comming in too slow.

https://22323.live.streamtheworld.com/TOPRETRO.mp3",

I also get this

libhelix - -> invalid frame size: -169 / max: 1600

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I am not kidding, putting this link as first or placing it as almost last makes a difference.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Hmm. I changed the default to 20000ms and moved the reset of the timeout after the next() so that the time of switching does not count...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

That's the point. If you swich faster the problem doesn't occour anymore. But than you are following an other rout.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

What do you prupose.... Update and test again?

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Maybe. If this does not help I think I will give up...
Anyhow if you want to be on the save side you still have the possibility to use source.setTimeoutMs(60000); in your sketch...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

We will see. It is sometimes beter to speed up. ;-)

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Yes, it's working now with the latest version. I just test with all bad links and it doesn't keeps hanging in a loop and it doesn't jump over the next one.

And this one does not spond if it is not broadcasting.

http://mp3.streampower.be/sporza-high

Then I get a backtrace

Great! He is moving to the next one... Did you change anyting?

PS: All setting I used are still the same of the last time.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Cool, I think I also found a solution for the last issue with the non returning URL. I added a timeout to the URLStream. If you think it is too long, you can adjust it with setUrlTimeout() in AudioSourceURL.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Are you recieving data from this?

player.setCallbackMetadata(printMetaData);

Is this the meta data of the url?

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

No this is for ID3 Metadata which is part of the MP3 stream. If you want to access the parameters available in the http replay you can get them in the AudioSourceURL with actual_stream->httpRequest().reply().get("parameter-name")...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I will leave like that and set in the shetch. ERR_CONNECTION_TIMED_OUT is also 20sec on my browser.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Cool

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

If you want to access the parameters available in the http replay you can get them in the AudioSourceURL with actual_stream->httpRequest().reply().get("parameter-name")...

Is it setting the tx power?

I found a topic about it on esp-idf
https://esp32.com/viewtopic.php?t=5359

it is within the esp_wifi.h...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I get you now It is only for transmitting but I am recieving.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I tried

Serial.println(actual_stream->httpRequest().reply().get("NAME"));
Serial.println(actual_stream->httpRequest().reply().get("PATH"));
Serial.println(actual_stream->httpRequest().reply().get("TITLE"));
Serial.println(actual_stream->httpRequest().reply().get("GET"));

But I can't get any information out of it. I don't know where to look for the parameter names

I set the audiologger to info and get this...

[I] HttpHeader.h : 218 - HttpHeader::read
[W] HttpHeader.h : 225 - Waiting for data...
[I] HttpHeader.h : 155 - HttpHeader::readLine -> HTTP/1.0 200 OK
[I] HttpHeader.h : 443 - HttpReplyHeader::parse1stLine: HTTP/1.0 200 OK
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Expires: Thu, 01 Dec 2003 16:00:00 GMT
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Expires' : 'Thu, 01 Dec 2003 16:00:00 GMT'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Cache-Control: no-cache, must-revalidate
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Cache-Control' : 'no-cache, must-revalidate'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Pragma: no-cache
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Pragma' : 'no-cache'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Access-Control-Allow-Origin: *
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Access-Control-Allow-Origin' : '*'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Access-Control-Allow-Credentials: true
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Access-Control-Allow-Credentials' : 'true'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Set-Cookie: uuid=a9bac5a9-cca0-461d-9b26-ce9e3743ad95; expires=Sun, 05 Dec 2021 20:54:36 GMT; path=/; domain=.live.streamtheworld.com
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Set-Cookie' : 'uuid=a9bac5a9-cca0-461d-9b26-ce9e3743ad95; expires=Sun, 05 Dec 2021 20:54:36 GMT; path=/; domain=.live.streamtheworld.com'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Set-Cookie: uuid-s=a9bac5a9-cca0-461d-9b26-ce9e3743ad95; expires=Sun, 05 Dec 2021 20:54:36 GMT; path=/; domain=.live.streamtheworld.com
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Set-Cookie' : 'uuid-s=a9bac5a9-cca0-461d-9b26-ce9e3743ad95; expires=Sun, 05 Dec 2021 20:54:36 GMT; path=/; domain=.live.streamtheworld.com;
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Content-Type: audio/mpeg
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Content-Type' : 'audio/mpeg'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Connection: close
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Connection' : 'close'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> icy-name:
[I] HttpHeader.h : 155 - HttpHeader::readLine -> icy-description:
[I] HttpHeader.h : 155 - HttpHeader::readLine -> icy-url: https://joe.be/
[I] HttpHeader.h : 96 - HttpHeader::put -> 'icy-url' : 'https://joe.be/'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> icy-genre: Adult Contemporary
[I] HttpHeader.h : 96 - HttpHeader::put -> 'icy-genre' : 'Adult Contemporary'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> icy-br: 128
[I] HttpHeader.h : 96 - HttpHeader::put -> 'icy-br' : '128'
[I] HttpHeader.h : 155 - HttpHeader::readLine -> Server: MediaGateway 5.6.2-0391.el6
[I] HttpHeader.h : 96 - HttpHeader::put -> 'Server' : 'MediaGateway 5.6.2-0391.el6'
[I] HttpHeader.h : 155 - HttpHeader::readLine ->

Not much information in the header that is usefull in my links. But this line pulls my intrest.

[I] Url.h : 112 - path->/JOE.mp3

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

You can retrieve the header varables that are added with put:

  • icy-name
  • icy-description
  • icy-url
  • icy-gengre
    but by bad luck your url does not fill the name and description...

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Can we close this issue related to navigation ?
For any other topic please open a separate issue or I am starting to get lost...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Yeah, don't see any issue on the functionality of this example.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

It would be nice if we could parse all resolved links of the https://de1.api.radio-browser.info/xml/stations/bycountrycodeexact/be in an url[]

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

That's easy just use https://de1.api.radio-browser.info/csv/stations/bycountrycodeexact/be
or https://de1.api.radio-browser.info/json/stations/bycountrycodeexact/be
or json...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Yeah, json... the story of my life. It would be easy if I could save https://de1.api.radio-browser.info/csv/stations/bycountrycodeexact/be as an csv to my sd-card

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Just use a URLStream and copy the content to a File...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I'm avoiding the steams to write and pars the csv's to make a playlist of the sd card.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I have tested the url player with these external links.

"http://mp3.streampower.be/sporza-high",//nok
"https://22323.live.streamtheworld.com/TOPRETRO.mp3",//ok//nok on the second time it runs
"http://23553.live.streamtheworld.com:80/RADIO_2_VLAAMSBR_128.mp3",//ok
"http://20723.live.streamtheworld.com/QFOUTERADIO.mp3",//ok
"http://19983.live.streamtheworld.com/QMUSIC.mp3",//ok
"http://22183.live.streamtheworld.com/JOE.mp3",//ok
"http://21303.live.streamtheworld.com/STUDIO_BRUSSEL_128.mp3",//ok
"http://icecast-servers.vrtcdn.be/stubru_tgs-high.mp3",//ok
"http://icecast-servers.vrtcdn.be/stubru_tijdloze-high.mp3",//ok
"http://icecast-servers.vrtcdn.be/ketnetradio-high.mp3",//ok
"http://22353.live.streamtheworld.com/MNM_128.mp3",//ok
"http://icecast-servers.vrtcdn.be/mnm_90s00s-high.mp3",//ok
"http://icecast-servers.vrtcdn.be/mnm_hits-high.mp3",//ok
"http://icecast-servers.vrtcdn.be/mnm_urb-high.mp3",//ok
"http://fred.torontocast.com:1050/stream",//ok
"http://icecast-servers.vrtcdn.be/radio1_classics_high.mp3",//ok
"http://icecast-servers.vrtcdn.be/radio2_benebene-high.mp3",//ok
"http://icecast-servers.vrtcdn.be/radio2_unwind-high.mp3",//ok
"http://icecast-servers.vrtcdn.be/stubru_bruut-high.mp3",//ok
"http://icecast-servers.vrtcdn.be/stubru_untz-high.mp3",//ok
"http://23553.live.streamtheworld.com:80/RADIO_2_VLAAMSBR_128.mp3",//ok
"http://randstad.wirelessbelgie.be:8330/stream.mp3",//ok
"http://21253.live.streamtheworld.com/RADIO1_128.mp3",//ok

The all work but when I run over the second time it crashes on this link below, strange because it worked well on the first time.

"https://22323.live.streamtheworld.com/TOPRETRO.mp3",//ok//nok on the second time it runs

here is my stack description

Exception:Error:
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/list.c:214:::0x4008c2f5:uxListRemove
0x400014fd: ?? ??:0
0x4000150d: ?? ??:0
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507:::0x4008adf2:vTaskDelete
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d1dc7:audio_tools
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d1e03:audio_tools
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d1d6b:audio_tools
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d20e9:audio_tools
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d2082:audio_tools
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d6203:NextStation()
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d625b:AutoNextStation()
E:\Documents\Visual Studio 2019\Projects\Arduino\player-url-i2s\player-url-i2s/player-url-i2s.ino(298): error 0x400d6269:loop()
C:\Users\Dave2Moon\AppData\Local\arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32/main.cpp(23): error 0x400de1ac:loopTask(void*)
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1):::0x400899c2:vPortTaskWrapper
0x40078000: ?? ??:0
0x40080400: ?? ??:0
0x400806a8: ?? ??:0

What do you think it could be... I have to say I reased the stack to 68000, because I have tested it for my esp32 with sd card in my shetch and that works.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

many links are working but is it possible to support one of those

http://stream.zenfm.be/zenfm.mp3.m3u
http://wma07.fluidstream.net:8080/fluid713.aac
http://players.fluidstream.net/charleroi.pls
http://www.opsinjoor.be/stream.php
http://www.komilfoo.be/live/komilfoo.asx

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Most of these links are not working even if you open them in the browser.
For the aac one you just need to use the Helix aac decoder instead of the mp3...

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

could they be merged in to one player?

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

My decoder API is standardized. So all we would need is a combined decoder which determines the data format dynamically and forwards it to the correct implementation.

Are you interested to pick up the challenge ?

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I am ready... You begin!

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I will not be able to work on this for the next couple of weeks. But I can give an outline what needs to be done with a couple of hints.

  • Create new Decoder class e.g. public DecoderHelix as subclass of AudioDecoder.

  • add new field content_type with enum { Undefined, MP3, AAC,}

  • In the write() method try to determine the content with the first write (if it has not been determined yet).

  • in begin() method reset the determined content type (content_type=Undefined)

  • determining the content type. I think the following logic might work:

              if (start[0]==0xFF && start[1]==0xF1){
                  content_type = AAC;
              } else if (strncmp(start,"ID3",3) || start[0]==0xFF || start[0]==0xFE ){
                  content_type = MP3;
              } else if (strncmp(start,"RIFF",4)){
    
  • In all methods just forward the calls to AACDecoderHelix or MP3DecoderHelix

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

Most of these links are not working even if you open them in the browser.

Those links won't work with a brower, but with other software...

2021-12-13_132051

For example pls is a windows media player stream

MP3, AAC or OGG

are html5 supported

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

Since this is Windows, it's not in my scope.
Though it should not be too difficult to create AudioSource implementation which parses a pls file. It's just a text property file.

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I m not interested too. My attention is now to the aac, m3u and mp3.

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I quickly double checked on github and did not find a single m3u parser in c or c++.
The one in python had 2000 - 3000 lines of code. So that would be a couple of days of work....

update: we could build on vlc
https://github.com/videolan/vlc/blob/master/modules/demux/playlist/m3u.c

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I don't have much for now because I cann't get the data to work with. Normally for the AudioDecoder I have to give an AudioType in libhelix, but I cann't do that. So I looking for a way to read the bytes from the stream without losing them.

URLStream urlStream(wifi, password);
AudioSourceIcyUrl source(urlStream, urls, "audio/mp3");
I2SStream i2s;
VolumeOutput volume(i2s);
LogarithmicVolumeControl lvc(0.1);
MP3DecoderHelix decoder;
//DecoderHelix test(urlStream, urls, "audio/mp3");
DecoderHelix test(urlStream);
#if defined(USE_HELIX) || defined(USE_DECODERS)

#include "Stream.h"
#include "AudioTools/AudioTypes.h"
#include "AudioCodecs/CodecMP3Helix.h"
#include "AudioCodecs/CodecAACHelix.h"

enum AudioType {
	Undefined,
	MP3,
	AAC,
} content_type;

namespace audio_tools {

class DecoderHelix : public AudioDecoder {
	public:
		DecoderHelix() {
			LOGD(LOG_METHOD);
		}
		DecoderHelix(URLStream source) {
			LOGD(LOG_METHOD);
			source.readBytes(start, 3);//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
		}
		~DecoderHelix() {
                         content_type = Undefined;
		}
		virtual void setOutputStream(Print& outStream) {
		}
		void begin() {
			LOGD(LOG_METHOD);
			content_type = Undefined;
		}
		void end() {
			LOGD(LOG_METHOD);
		}
		MP3FrameInfo audioInfoEx() {
		}
		AudioBaseInfo audioInfo() {
		}
		size_t write(const void* mp3Data, size_t len) {
			LOGD("%s: %zu", LOG_METHOD, len);
			//if (start[0] == 0xFF && start[1] == 0xF1) {
			//	content_type = AAC;
			//	Serial.println("ACC");
			//}
			//else if (strncmp(start, "ID3", 3) || start[0] == 0xFF || start[0] == 0xFE) {
			//	content_type = MP3;
			//	Serial.println("MP3");
			//}
			//else if (strncmp(start, "RIFF", 4)) {
			// content_type = WAVE;
			//}
			//return content_type;
		}
		operator boolean() {
			return content_type != Undefined;
		}
		void setNotifyAudioChange(AudioBaseInfoDependent& bi) {
			LOGD(LOG_METHOD);
		}
	protected:
		uint8_t* start;
};
}
#endif

from arduino-audio-tools.

pschatzmann avatar pschatzmann commented on May 19, 2024

I just committed a draft implementation.
I did not have any time to test it though....

https://github.com/pschatzmann/arduino-audio-tools/blob/main/src/AudioCodecs/CodecHelix.h

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

I diden't test the aac decoder yet... This need to be resolved first before we can continue to a general decoder. I went ahead testing the aac decoder and this is where it stops.

assertion "res == pdTRUE" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/dport_access.c", line 187, function: esp_dport_access_int_init
abort() was called at PC 0x400fed0b on core 0

from arduino-audio-tools.

podaen avatar podaen commented on May 19, 2024

it's a difficuld issue, do you have engough information or just no have the time to sort this out?

from arduino-audio-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.