-
-
Notifications
You must be signed in to change notification settings - Fork 73
True gapless playback #316
Comments
Having looked at other options, I don't think I'll be able to change the overall player implementation. Can you name me some albums where you're noticing gaps? I can do some adjustments on my side to see if I can make the transition between tracks more accurate. |
Sure, I could provide some tracks to you if that helps. |
By the way, does the current implementation make a difference if the source is MP3 or FLAC? |
The source does not matter as long as it's playable by the browser/server. |
I did some testing with the albums you provided me, and is indeed noticeable gaps on certain songs in the albums. I'm not able to get it perfect with the current player... but I'll see if I can explore some other solutions for this. |
Thanks for looking into it, hope you find something ;) |
sonixd-1.0.0-alpha-player-demo.mp4Adding a new player may be possible. I've been building out a custom player for the 1.0.0 version using the following:
So far I've only implemented regular/gapless playback, but I'll eventually experiment with crossfade as well if I can get it stable enough. I've attached a demo with one of the albums you provided. There are a few issues such as not being able to dynamically seek and change the volume without restarting the stream (causes a slight pause when changing the volume), but overall the implementation seems to work. It will be controlled using HTTP websockets from a flask webserver which is running the player. If someone more experienced with Python/C or any other languages can help build out a simple player that I can integrate I'd be welcome to that as well. |
Cool, sounds nice.
I am happy to test out once something to test is available.
Have a nice Monday 👍🏻👋🏻
Von meinem iPhone gesendet
… Am 06.06.2022 um 04:21 schrieb Jeff ***@***.***>:
https://user-images.githubusercontent.com/42182408/172083457-af0c7bf3-7ff6-47a8-b2d8-94d4e51427eb.mp4
Adding a new player may be possible. I've been building out a custom player for the 1.0.0 version using the following:
PyAudio
FFmpeg
So far I've only implemented regular/gapless playback, but I'll eventually experiment with crossfade as well if I can get it stable enough.
There are a few issues such as not being able to dynamically seek and change the volume without restarting the stream (causes a slight pause when changing the volume), but overall the implementation seems to work. It will be controlled using HTTP websockets from a flask webserver which is running the player.
If someone more experienced with Python/C or any other languages can help build out a simple player that I can integrate I'd be welcome to that as well.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Have you looked into using libmpv for the player backend? It should support true gapless playback and the ability to natively play all major audio formats without needing to invoke ffmpeg commands. You can see how the sublime-music client is using libmpv with Python here |
@dweymouth I actually did take a look at sublime music when trying to decide how to implement the new player. The requirements at the time were:
I'm not sure if MPV supports streaming from html, but if so that would be an option. I'll do a bit of testing with MPV though, since I do also see some node packages that may be usable to avoid having to include a python dependency. |
Another possibility to avoid a Python dependency would be to write the backend player in C or C++, and use libffmpeg directly (or keep the approach of invoking the ffmpeg binary as a subprocess) and Miniaudio (other cross-platform C++ audio libraries exist, but I can attest that miniaudio is super easy to integrate and works out-of-the-box on Mac and Linux - don't currently have a Windows box). You could use sockets to make calls to the C++ player like with the Python prototype, or probably a Node native module. I'm not a frontend or Node dev so can't offer too much advice there. If you are able to set up a c++ player stub that can be invoked from the FE and integrates into the project build system I may be willing to give the implementation a go. Can't give any promises on my time availability though. But do give the node packages a try too - if any of them support true gapless playback all this would become moot! |
I don't have any knowledge of C/C++ so that's why I ended up using Python. Most of the Python modules are just bindings for C++ libraries anyways, which did include Miniaudio, PortAudio, etc. I was also looking at Irrklang as a possible solution as well, but I found the documentation to be lacking. I'll try out an mpv implementation this weekend and update this thread on how it goes. If it's not feasible, I'll see what I can do in terms of setting up that player stub for you. It will most likely be fairly simple, with the player running as a separate process from the client (similar to how the mpv implementation will work as well I'm assuming). From my testing, I found sockets to be usable but also a bit clunky as there's lag between the player controls and the audio player. I was also thinking of having the player use keyboard shortcuts to manage the controls to eliminate the need for sockets for the player controls (though I would need to do a bit of testing to see if this is possible from the frontend client). |
OK, a totally new idea - you might be able to stick entirely with Javascript if you use the WebAudio API with the AudioBuffer source, and use one of the various Node packages that wraps ffmpeg or any other Node audio codec libraries to decode data from the stream into raw samples to fill the Buffer. Then for gapless, you just start decoding the next stream before your buffer is empty and you have a seamless transition between the tracks. Again I'm not a web dev so I have no idea if this would work but I don't see why it wouldn't. Edit: this might be worth exploring too: https://www.npmjs.com/package/node-mpv |
I've done a bit of testing with the Webaudio API + ffmpeg, but wasn't satisfied with the workability of it. Python seemed to more easily be able to handle all the requirements I was looking for. I started playing around with the node-mpv package you linked, and I think it will actually work perfectly here. This will most likely be the player approach moving forwards, since it will save a lot of headache from having to build player from scratch. Hoping to have a working prototype in the next couple of days so that I can go into full gear with the rest of the backend/frontend development. |
Does node-mpv play gaplessly? (I haven't tested but it should, as long as the next track is pre-loaded in the playlist b/c it's just using mpv under the hood.) Seems like the only potential headache here would be figuring out how to bundle mpv(.exe) into the installation package for all the OSes so the software can work out-of-the-box vs. requiring the user to download mpv and point Sonixd to it. IANAL, but since both Sonixd and mpv are GPL I think you should be good to go, license-wise, with bundling. Edit: looks like mpv gapless playback is disabled by default unless you pass |
If allowed by the license, packaging the From my initial testing, gapless was working out of the box with |
Hey Jeff, any idea when a first test-build will be available with gapless playback? Thanks |
Sorry for the delayed response. The project was on hold for a while due to conflicting prorities but I've now resumed work on the rewrite. I don't have a for-sure timeline but keep an eye on the rewrite repository for any changes. |
The first alpha release of Feishin has been released which uses MPV for gapless playback. |
Hey there, nice to hear back from you.
I´ll give it a try ;)
Stefan
…On Tue, Nov 22, 2022 at 12:03 AM Jeff ***@***.***> wrote:
The first alpha release of Feishin <https://github.com/jeffvli/feishin>
has been released which uses MPV for gapless playback.
—
Reply to this email directly, view it on GitHub
<#316 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBFUVV7LTJZMRIRLPXQOOLWJP5TBANCNFSM5VEKTQKQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
So I can't access my navidrome server directly now, right? I have to deploy
a Feishin server first?
Stefan
…On Tue, Nov 22, 2022 at 1:35 AM Stefan Guddat ***@***.***> wrote:
Hey there, nice to hear back from you.
I´ll give it a try ;)
Stefan
On Tue, Nov 22, 2022 at 12:03 AM Jeff ***@***.***> wrote:
> The first alpha release of Feishin <https://github.com/jeffvli/feishin>
> has been released which uses MPV for gapless playback.
>
> —
> Reply to this email directly, view it on GitHub
> <#316 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACBFUVV7LTJZMRIRLPXQOOLWJP5TBANCNFSM5VEKTQKQ>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
@stefan1983 Yes that's correct. Feishin uses its own server. I'll be attempting to add mpv player into Sonixd as well so hang tight on that. |
Gapless playback works in Feishin, I tested it successfully today with MP3 as well as FLAC files (via Navidrome). Great work! Thanks |
Hey there, is it planned to make Sonixd able to support true gapless playback? Most of my albums are Mix-CDs, Live Albums etc. and the short but still significantly hearable gap is a bit annoying between each new track.
For iOS I use amperfy and the engineer is looking into the same topic currently. Maybe a look here helps:
(BLeeEZ/amperfy#96 (comment))
Thanks a lot and keep it up.
The text was updated successfully, but these errors were encountered: