snapclient icon indicating copy to clipboard operation
snapclient copied to clipboard

Sync with sample stuffing

Open CarlosDerSeher opened this issue 11 months ago • 42 comments

Also upgrade to idf5

CarlosDerSeher avatar Mar 17 '24 20:03 CarlosDerSeher

@alexyao2015 I am trying to merge your recent changes regarding AI thinker board. In this branch there has been an IDF upgrade to v5 but also an ADF upgrade and I am unsure how to proceed now. I resolved most conflicts but have commented out some of your changes. Could you please try this and see what needs to be changed / added to make your changes work with the new ADF base?

CarlosDerSeher avatar Mar 17 '24 20:03 CarlosDerSeher

@unknown0816 @alexyao2015 Could one of you please try this with AI thinker board and confirm it works? I'd really like to go on with the merge.

CarlosDerSeher avatar Apr 03 '24 18:04 CarlosDerSeher

I haven't had a chance to try it yet sorry!

alexyao2015 avatar Apr 03 '24 19:04 alexyao2015

Ok, sorry to push this. I thought nobody saw it as there was no reaction at all ;) glad to read you are still in

CarlosDerSeher avatar Apr 04 '24 05:04 CarlosDerSeher

I will try this today. I will come back to you, soon.

unknown0816 avatar Apr 04 '24 05:04 unknown0816

Sadly I'm unable to get my docker running.. With my old version from idf v.4.3.5 I get the message that I must use v5 of idf. Using the newer versions I get the message, that cmake cannot be found. Can you help me getting the idf running?

unknown0816 avatar Apr 04 '24 06:04 unknown0816

do you mean that CMakeList.txt isn't found? I had that problem too due to providing the wrong path on the host to the -v argument. Maybe check the content of the /project folder in the interactive container shell to verify that this is not the case.

I was just able to start the build of this branch with the commands provided in the readme.

LeoSum8 avatar Apr 04 '24 06:04 LeoSum8

Thanks for the info. My problem actually was an old build directory with a reference to an old cmake version.

I could flash to the AI thinker and I found two issues. First I had white noise all the time. even if no signal came from the snapcast. So there must be something wrong. Second the volume change does work, but it is not really good. At least for me the scaling is no sound from 0 to 50 and from 50 to 100 it is pretty fast too loud to listen.

unknown0816 avatar Apr 04 '24 06:04 unknown0816

Thanks for taking the time.

There is a define in boarddef.h called PA_GAIN or similar. Could you try to play with that?

Also the noise was present for my lyrat too but was gone once playback from server started even if stopped again. I think this is another issue which I haven't found yet, not related to that specific board.

CarlosDerSeher avatar Apr 04 '24 07:04 CarlosDerSeher

@unknown0816 noise problem should be fixed with latest commit

CarlosDerSeher avatar Apr 04 '24 20:04 CarlosDerSeher

@unknown0816 noise problem should be fixed with latest commit

Okay. I will test it. Unfortunately, I won't be able to test it today, but I will try to do it soon.

unknown0816 avatar Apr 05 '24 05:04 unknown0816

@CarlosDerSeher Sadly, I still getting the noise. The main difference is that on my board the noise is all the time.. Not only during booting.

unknown0816 avatar Apr 08 '24 08:04 unknown0816

@unknown0816 even if you start playback or only if there is no playback from the server and / or the client is muted?

CarlosDerSeher avatar Apr 08 '24 08:04 CarlosDerSeher

@CarlosDerSeher Even during playing I get the noise.. So it is always there. During Muting the sound stops, but the noise is still there.

unknown0816 avatar Apr 08 '24 08:04 unknown0816

And with master you don't have this problem right? Only the volume scaling isn't right there?

CarlosDerSeher avatar Apr 08 '24 09:04 CarlosDerSeher

Yes. For the volume setting I changed the calculation like posted in other PRs and it works fine..

I tried to undo some of your changes in the es8388.c, but the noise keeps coming.. Maybe you have an idea what I could try?

unknown0816 avatar Apr 08 '24 09:04 unknown0816

maybe something get misscalculated here? https://github.com/CarlosDerSeher/snapclient/blob/e5dea7d8d71bdc6eb0a217c52f45bdf3386a9989/components/audio_hal/driver/es8388/es8388.c#L442

Is it an amplifier saturating noise or more like white noise?

CarlosDerSeher avatar Apr 08 '24 09:04 CarlosDerSeher

Nope. Still having the noice if I undo the changes in this function.

I would say it is a white noise, but I'm not sure ;)

unknown0816 avatar Apr 08 '24 09:04 unknown0816

You could try to take the driver from master and work your way up from there maybe? Some compile errors will most certainly happen and will need to be resolved but mybe you can find the problem then? or take the driver from ADF v2.6 and try to insert your board there, should be as easy ass adding the #ifdef s . Maybe I something went wrong during merging.

Anothger thing to you could check: https://github.com/CarlosDerSeher/snapclient/blob/e5dea7d8d71bdc6eb0a217c52f45bdf3386a9989/components/audio_hal/driver/es8388/es8388.c#L410 does this align with the settings from https://github.com/CarlosDerSeher/snapclient/blob/e5dea7d8d71bdc6eb0a217c52f45bdf3386a9989/components/lightsnapcast/player.c#L143

CarlosDerSeher avatar Apr 08 '24 09:04 CarlosDerSeher

Yes. I will try to find the source of the noise.. But this will take some time. ;)

unknown0816 avatar Apr 08 '24 09:04 unknown0816

Maybe you need to call audio_hal_codec_iface_config after player_setup_i2s ? I doubt it though as it works as it is for Lyrat...

Take your time. Thanks for the effort!

CarlosDerSeher avatar Apr 08 '24 09:04 CarlosDerSeher

Sadly, I couldn't find the problem yet, but I found out that the noise starts when the first audio is played. So if I startup the board and the audio is not playing I get no noise. The noise starts when I start the audio playing. Maybe this information helps?

unknown0816 avatar Apr 15 '24 05:04 unknown0816

So the noise starts with this line: "ESP_ERROR_CHECK(i2s_channel_init_std_mode(tx_chan, &tx_std_cfg));" in the function player_setup_i2s in player.c However, I'm unable to find the source code of this function.

unknown0816 avatar Apr 15 '24 06:04 unknown0816

However, I'm unable to find the source code of this function.

This code is located externally at your IDF installation.

CarlosDerSeher avatar Apr 15 '24 08:04 CarlosDerSeher

Maybe you need to call audio_hal_codec_iface_config after player_setup_i2s ? I doubt it though as it works as it is for Lyrat...

did you try this? Maybe a sample rate missmatch?

CarlosDerSeher avatar Apr 15 '24 08:04 CarlosDerSeher

Thanks. I found the file and I found that the noise starts, when the function calls: "ESP_GOTO_ON_ERROR(i2s_std_set_gpio(handle, &std_cfg->gpio_cfg), err, TAG, "initialize channel failed while setting gpio pins");" So I guess some gpiopins are wrong.

Could running your suggested command help there? I didn't do it until now.

unknown0816 avatar Apr 15 '24 09:04 unknown0816

Noise-Starting Command one level down: "i2s_gpio_check_and_set(gpio_cfg->dout, i2s_periph_signal[id].data_out_sig, false, false);"

unknown0816 avatar Apr 15 '24 09:04 unknown0816

I guess this just means noise starts when I2S signals are enabled. This doesn't mean gpios are wrong.

Could running your suggested command help there?

I doubt it will help as it works for Lyrat without it, but its still worth a shot. I don't know how this particular DAC is configured exactly but from what I saw it needs sample rate set for playback in some registers?

If this doesn't help you could try to revert to original es8388 DAC driver from ADF 2.6 and work from there. Seems to me the upgrade of ADF or IDF broke something.

CarlosDerSeher avatar Apr 15 '24 10:04 CarlosDerSeher

If this doesn't help you could try to revert to original es8388 DAC driver from ADF 2.6 and work from there. Seems to me the upgrade of ADF or IDF broke something.

I tried this and due to lots of interface changes this failed quickly. But I can try again.

I guess this is more or less an interaction between these updates and an officially unsupported board. Maybe AI Thinker will redo some kind of instructions to get the board running with this newer versions.

unknown0816 avatar Apr 15 '24 10:04 unknown0816

Use this ADF branch. should work without much changes as this is the driver I used

https://github.com/espressif/esp-adf/tree/v2.6

CarlosDerSeher avatar Apr 15 '24 10:04 CarlosDerSeher