-
Notifications
You must be signed in to change notification settings - Fork 203
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
Gapless playback #31
Comments
This could be done by using an array of |
I might consider a switch to Web Audio API instead of the current Audio element implementation. Might be a first step to #114 |
I wonder if it is enough to have 2 elements - |
The problem is the next sont can be the previous one. I've done some test, and there's still a microcut between the |
I still don't quite get why this is a problem.
As I understand, if we have say 1000ms overlap/crossfading duration, we should not worry about these conks of microcuts, because transition period is still much longer. |
You need to preload three songs: the current one, the next one, and the previous one. If they are preloaded, then the microcute should be smaller.
Yes sure, but what if there is a 0ms crossfade (the user will be able to choose a value), there would still be one ;) |
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/audioTracks Trough an experimental flag though :/ |
Could you not have an array This should always leave the previous track as nowPlaying[0], Current playing as nowPlaying[1] and next track nowPlaying[2]. probably won't work knowing me :D |
I tried it, the result is unfortunately the same, there's still a mini-gap :( |
I'd not realised the mini-gap before :( just played War of the Worlds and there it was... |
A gapless JavaScript/CSS audio player for HTML5 PROBLEM: There are 2 modern APIs for playing audio through the web, and both of them have problems:
SOLUTION: Use both!
http://github.com/regosen/Gapless-5 |
Just tested this in chrome and the gap is still there but it's a lot lot smaller. |
This project looks interesting: It currently triggers an FFmpeg process upon a single audio file and streams it into OPUS blocks. https://somweyr.de/opus/demo.html -> Demo of actual different tracks being played back gaplessly. Using the Electron client purely as an Open stream connected to an application that pulls each file and blockifys each file into a folder, this means the process can become multithreaded transcoding the previous. If each block contains only 2seconds worth of data could a crossfade be longer than the length of a block? |
I've been playing around with the WebAudio API in Musseks for a slightly different reason (accurate timestamps for synchronizing audio with lighting with my synesthesia project), which it turned out the HTML |
This is also a useful article: http://dalecurtis.github.io/llama-demo/index.html |
@s0 great to hear! #128 is a blocker for that though. I really want to solve this so I will try to find myself some time to work on AudioContext. I would also like to try https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/audioTracks as maybe Gapless playback comes baked in. |
Made progress with updating my precise-audio library for gapless playback with a small POC in the browser. Seems to work relatively well in chrome when playing LAME encoded MP3 files:
After I've tightened up the library a bit more, I'll work on pulling the functionality into museeks, and hopefully open a PR soon. |
PreciseAudio provides an API for gapless playback, and presents mostly the same interface as Audio, so switching to this library didn't require too many changes, and paves the way for martpie#31 PreciseAudio also uses an AudioContext internally, and makes the audio graph available for mutation via getAudioNodes(), which will allow for features such as equalizers (martpie#127) or visualizers / analyzers. Fixes martpie#128
Use the gapless API from PreciseAudio to enable gapless playback. Most of the work is done in the player reducer, to ensure that PreciseAudio has the latest queue whenever a state change happens to either the queue or the player. Fixes martpie#31
What
Currently, when a song is over, the
src
of the audio tag is changed, but the tag has to preload the file a bit. So there is a micro interruption of a few miliseconds.How
Instead of having a single Audio object, need to have an array of 3:not working :[[previous, current, next]
. Then when playing next or previous, it should be faster, cause tracks will already be loaded + Pop/Shift audio when needed.The text was updated successfully, but these errors were encountered: