by mrmufungo · 7y ago · 0 comments
The current process is rather simple: I utilize M3U8 for storing segment information, and manually parse the file when a play request is received. I grab the first few (Opus-encoded) segments, pass them through an OfflineContext to maintain a specific sample rate, and store the resulting buffer in a wrapper object. Each object is stored in an array, and is responsible for re-creating the AudioNode when stopping or starting.
The hardest part about this (for me at least) was fetching and scheduling accurately while the player is running. I group segments requests together, and schedule after each group has finished downloading. It's not perfect, as I occasionally get pops between each segment: Chrome seems to be less noticeable than Firefox in this regard. I schedule based on the buffer duration, but there seems to be subtle differences between browsers.
In any case, I've had quite a bit of fun working on this project.
Could you elaborate a bit more on what the site does, perhaps in an ELI5 way (explain it like I'm 5 years old)? It's not entirely obvious at a glance, i.e is it like SoundCloud?/How does it differ?/Can it be used to create music?
In terms of interaction, it's similar to SoundCloud. I've been using SoundCloud for years - just right after they transitioned to their V2 site. I've also used Bandcamp for selling my own music, and always felt their approach was transparent and fair when it came to monetization. When I started this project, a little bit of both went into the design and structure.