Replies: 1 comment
-
I love musicat very much. It help me in leraning language. More function added will be welcom:play more slowly,hotkey:cmd+ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ever since I started working on musicat, the audiophile in me wanted to implement gapless playback. Yet I decided to park it, live with the gaps on The Dark Side Of The Moon and just use the
<audio>
element. That way I could focus on building out features that I needed first.But now that I'm quite happy with how the app is turning out, it's time to (temporarily) stop making fancy features and start getting my hands dirty in a PCM stream. It's also time to offload the CPU-heavy stuff away from the the web frontend, and start actually learning Rust since this is a Tauri app after all.
So over the past few months I have played around with a few ideas to try and enable gapless support, constantly re-architecting the whole playback engine and eventually scrapping WebAudio altogether and doing the decoding and the playback in Rust (Symphonia + cpal). Of course, going native is great, but let's have a look at why the various WebAudio approaches didn't work:
<audio src="local track">
:<audio>
elements and try to crossfade between them during the gapless transition.src
MediaSource
, to which you can append chunks usingSourceBuffer.appendBuffer()
. Browsers can be very strict with how you use this buffer, and I found the implementation to be very clunky. I believe this is what YouTube and Spotify use.Essentially, I went down a rabbit hole, progressively getting closer to the raw audio stream in the process. And I'm so glad I did, because I feel like I have peeled off all the layers of abstraction and browser limitations that were getting in the way. In hindsight, building a desktop audio player using web technologies probably wasn't the best idea. But I'm happy with a hybrid architecture where Rust is the I/O, audio, heavy-lifting layer, and the Svelte app is just the presentation layer. Granted, the database is still using IndexedDB which is in the browser, but that's something for another day.
For the next few days I'll keep doing some testing on the rust-audio-backend branch, then merge it into
main
.Beta Was this translation helpful? Give feedback.
All reactions