Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with sample stuffing #69

Merged
merged 25 commits into from
May 31, 2024
Merged

Sync with sample stuffing #69

merged 25 commits into from
May 31, 2024

Conversation

CarlosDerSeher
Copy link
Owner

Also upgrade to idf5

CarlosDerSeher and others added 15 commits January 8, 2024 22:49
custom board driver ma120x0 is broken
esp dsp is now IDF managed component
mdns is now IDF managed component

Signed-off-by: Karl Osterseher <[email protected]>
Signed-off-by: Karl Osterseher <[email protected]>
Signed-off-by: Karl Osterseher <[email protected]>
Signed-off-by: Karl Osterseher <[email protected]>
* Updated Docker Command for IDF5 + macOS instructions
use sample stuffing / removal to keep up sync

Signed-off-by: Karl Osterseher <[email protected]>
- add default values in menuconfig for ADAU1961
- remove bug in main resulting in failed i2s aquisition

Signed-off-by: Karl Osterseher <[email protected]>
Signed-off-by: Karl Osterseher <[email protected]>
Signed-off-by: Karl Osterseher <[email protected]>
Signed-off-by: Karl Osterseher <[email protected]>
…log messages

- improve on usable flash size
- add support for lyratd msc V2.1 board
- add support for lyratd msc V2.2 board
- add support for korvo du1906
- do a little code clean up

Signed-off-by: Karl Osterseher <[email protected]>
Signed-off-by: Karl Osterseher <[email protected]>
- code clean up

Signed-off-by: Karl Osterseher <[email protected]>
Add DAC TAS5805M as custom board

* New menu for inverting I2S signals
* Updated Docker command for IDF5 + macOS instructions
@CarlosDerSeher
Copy link
Owner Author

@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
Copy link
Owner Author

@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.

@alexyao2015
Copy link

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

@CarlosDerSeher
Copy link
Owner Author

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

@unknown0816
Copy link

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

@unknown0816
Copy link

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?

@LeoSum8
Copy link

LeoSum8 commented Apr 4, 2024

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.

@unknown0816
Copy link

unknown0816 commented Apr 4, 2024

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.

@CarlosDerSeher
Copy link
Owner Author

CarlosDerSeher commented Apr 4, 2024

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
Copy link
Owner Author

@anabolyc s3 should work with sample insertion but not apll tuning as it doesn't have apll as far as I know

@CarlosDerSeher
Copy link
Owner Author

@DerPicknicker

W (36926) PLAYER: RESYNCING HARD 1: age 375401us, latency 2134319521536us, free 4311631, largest block 4128768, rssi: -66 W (37106) PLAYER: send: pcmChunkQueue full, messages waiting 40 W (37110) PLAYER: send: pcmChunkQueue full, messages waiting 40 W (37113) PLAYER: send: pcmChunkQueue full, messages waiting 40

Whats going on here? Can you add the element count of the queue to the "resync 1" log message?

Also I don't see any improvement of RSSI, is this with external antenna and if so did you disconnect the internal one orare they now both connected? Because most of the time this will be a bad idea for sensitivity.

Edit: I think before merging we should do some error handling (if sample size differs => see log for the crashing)

What exactly do you mean with that? I can't see any reason for the reset in the logs.

The buffer shown in the logs is still 1000ms?! Could you try setting it to 2000ms?

@DerPicknicker
Copy link

DerPicknicker commented May 5, 2024

@CarlosDerSeher .. you checked the wrong log see here

There is something like this:

assert failed: block_locate_free tlsf.c:566 (block_size(block) >= size)

I will check it again with master. If I remember correctly... I didn't saw that behaviour.

@CarlosDerSeher
Copy link
Owner Author

CarlosDerSeher commented May 5, 2024

Ok, sorry. Didn't download the new file (same name). Rssi is good then...
5s need around 1MB of space for your setting so I guess you'll have enough to spare. The assert is strange. Maybe we write somewhere out of bounds? Memory leak?

Can you add the queue fill status to rssync 1 message?

I (63798) PLAYER: initial sync age: 12us, chunk duration: 24000us
I (82080) SC: fLaC sampleformat: 48000:16:2
I (82092) SC: fLaC sampleformat: 48000:16:2

This is strange too. Why are you getting this message twice?

Could you try running original snapserver?

@DerPicknicker
Copy link

Hello @CarlosDerSeher ,

I will try it in the next days. Sorry for the delay. Today morning I tried it briefly and the hard-resyncs are happening only once. I tested it at a different location. So might be an WiFi issue. I mentioned it - WiFi mesh and esp32 is a mess.

I used the original snapserver the music comes from MusicAssistant (do you have the time to install it? Via docker it takes only a couple of minutes)

Changing the tracks is working. But I tested it only 2-3 times. So give me some
Time and I will dig deeper.

Could you please link the variable I should print?

@CarlosDerSeher
Copy link
Owner Author

CarlosDerSeher commented May 6, 2024

Please add this uxQueueMessagesWaiting(pcmChkQHdl) here

@CarlosDerSeher
Copy link
Owner Author

CarlosDerSeher commented May 6, 2024

Maybe it has something to do with this part of the code. Please also print insertedSamplesCounter

There is also an issue (#76) which could be related to your problem.

@DerPicknicker
Copy link

I will do that. Might take some days.. ;-)

add PT8211 audio board definition
add I2S MSB format option
@DerPicknicker
Copy link

DerPicknicker commented May 10, 2024

@CarlosDerSeher .. I tested now again with the default webserver. It's a lot better but not perfect (I can't say if it's a WiFi issue or bad power supply) ...

Currently my Buffer is 5000ms. I think we can merge it. If you want I can to a test with current master. If you want a more detailed test.

Edit:

Some times I still get this message twice:
I (82080) SC: fLaC sampleformat: 48000:16:2
I (82092) SC: fLaC sampleformat: 48000:16:2

I think it might be related to my setup. Could you verify on your side that it doesn't happen?

@CarlosDerSeher
Copy link
Owner Author

CarlosDerSeher commented May 10, 2024

I (82080) SC: fLaC sampleformat: 48000:16:2
I (82092) SC: fLaC sampleformat: 48000:16:2

I'll try this weekend but i am 99% sure I've never seen this

@CarlosDerSeher
Copy link
Owner Author

Maybe we should define some test environment (docker?!) so we can be sure everybody got the same conditions while testing before a merge, especially if it is such a big one

@DerPicknicker
Copy link

DerPicknicker commented May 10, 2024

Yes definitely.. I like my setup because it is really easy to setup (one docker image) which includes snapserver and a centralised music library.

Tell me your thoughts. If you need more information about it let me know.

Maybe 2 different setups?

@CarlosDerSeher
Copy link
Owner Author

Let's continue this discussion at #81

@CarlosDerSeher
Copy link
Owner Author

If you want a more detailed test.

What about uxQueueMessagesWaiting(pcmChkQHdl)

and insertedSamplesCounter did you log those variables?

@DerPicknicker
Copy link

Not yet. I hadn't the time. I did an intense A/B testing for the server side.

So my results are:

  • Buffer set to 5000ms fixes the issues
  • At every track change the stream will be restarted if you're not crossfading (so serverside related)
  • Hard-Resyncs are mostly gone with external antenna and 5000ms buffer and your updated threshold.

I will do some more testing if it's WiFi , power supply or just magic why the resyncs are so sporadic.

@CarlosDerSeher
Copy link
Owner Author

CarlosDerSeher commented May 10, 2024

Alright sounds to me it is actually server / setup related then. As it works for me and @LeoSum8 I'll assume all is alright with the code and do the merge when I find the time

@DerPicknicker
Copy link

Take your time - I will do some more testings if the resyncs can be provoked by a specific situation

@DerPicknicker
Copy link

  • At every track change the stream will be restarted if you're not crossfading (so serverside related)

This is a confirmed behaviour on the server side. The music assistant server restarts at every track the stream. FYI.

@CarlosDerSeher
Copy link
Owner Author

Ok so all is good on your side.

There is still another issue #82 related to ethernet. Hopefully this will resolve itself soon, as all is good for my setup.

@DerPicknicker
Copy link

Great. Let's see. Maybe you add also the WiFi improve feature? So @anabolyc has to update his webinstaller only once?

@CarlosDerSeher
Copy link
Owner Author

Yes this is the plan. Maybe I'll do it first and merge all together I don't know yet

* port official example of ethernet for IDF v5.x
* Fix cmake if guard for ethernet

Signed-off-by: Karl Osterseher <[email protected]>
Co-authored-by: whc2001 <[email protected]>
@CarlosDerSeher CarlosDerSeher merged commit fae2711 into master May 31, 2024
@CarlosDerSeher
Copy link
Owner Author

@DerPicknicker I've merged just now. Hopefully it will build without issues now, it should though. I don't have time now to test it. improv is in the pipe too but there were some conflicts which I want to examine before merging

@DerPicknicker
Copy link

@CarlosDerSeher ... Cool. I will test it as soon as I can find time. I have to install my dev Environment again. Let's see if I can test it until next week.

@CarlosDerSeher
Copy link
Owner Author

In the meantime I compiled for lyrat v4.3 and it seems to run fine

anabolyc pushed a commit to sonocotta/esparagus-snapclient that referenced this pull request Jun 14, 2024
* upgrade to IDF v5.1.1
* add new synchronization implementation, use sample stuffing / removal to keep up sync
* use big DMA buffer for I2S and improve sync
* Add DAC TAS5805M as custom board
* add wifi credential reset
  o press reset button (nRESET pin) 3 times
    but wait about 1s between button presses
    the button press counter is reset 5s after boot
* Add support for PT8211 DAC (CarlosDerSeher#78)
* upgrade ethernet interface to IDF v5 (CarlosDerSeher#84)
* port official example of ethernet for IDF v5.x
* Fix cmake if guard for ethernet

Signed-off-by: Karl Osterseher <[email protected]>
Co-authored-by: DerPicknicker <[email protected]>
Co-authored-by: whc2001 <[email protected]>
@CarlosDerSeher CarlosDerSeher deleted the sync_with_sample_stuffing branch February 21, 2025 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants