๐Ÿ’พ Archived View for bbs.geminispace.org โ€บ s โ€บ AuraGem โ€บ 5388 captured on 2023-12-28 at 16:12:41. Gemini links have been rewritten to link to archived content

View Raw

More Information

โฌ…๏ธ Previous capture (2023-11-14)

๐Ÿšง View Differences

-=-=-=-=-=-=-

AuraGem Music Public Radio

AuraGem Music's Public Radio is now live! It plays all public domain music currently. You can find a schedule of what music plays when on the homepage.

auragem.letz.dev/music/public_radio

Posted in: s/AuraGem

๐Ÿš€ clseibold

Sep 18 ยท 3 months ago ยท ๐Ÿ‘ gritty, stack, mediocregopher, IO ยท ๐Ÿค˜ 1

10 Comments โ†“

๐Ÿ‘ป mediocregopher ยท Sep 18 at 09:26:

This is great, love to see the experimentation here :) Works great on Lagrange at least, but I think my android client is still trying to download the whole file lol

๐Ÿš€ clseibold ยท Sep 18 at 13:19:

@LittlePrince The stream doesn't do one streaming quality. Everything is at or below 320 kbps, which should be just fine for my home network. I will consider dropping quality if there are significant problems, or if the problem happens to be that most end-users can not handle 320 kbps for some reason.

There are some drop outs even while being on my local network. I believe the problem is specific to the public radio and not the streaming of files in general. If you check the Shuffled Stream feature (which is a private stream that streams in shuffle mode from your own private library), there should be no drop outs, afaik.

I don't understand the timestamp suggestion for the Public Radio. The Public Radio is always live streaming. Every client that connects to the Public Radio should be within 2-5 seconds of each other on the same song, because the server just sends out the data of the current song starting from the current location and then continuing over time at the bitrate of the mp3 file.

Thanks for your suggestions, and for trying it out! I have some fun ideas in the future that I'm excited for. :)

Btw, Streaming has been a thing in Geminispace since 2020, lol. I'm just applying it to music, but there were text streaming experiments, and Astrobotany added a feature that was a very simple music creator that produced a music file that could be played/streamed a few years ago.

Solderpunk and many others on here knew about or were DJs on SDF's anonradio, so it's not totally out of the blue that there would be some music or music streaming popping up on geminispace :D

I will consider adding different streams for different qualities, but this would require re-encoding data on the fly or re-encoding the whole library and any new file that comes in to multiple quality files, and that is significantly more complicated than what I had initially planned.

๐Ÿš€ clseibold ยท Sep 18 at 13:33:

@mediocregopher Thanks for trying it out. What android client are you using? I think lagrange on mobile has a problem with streaming mp3 files, but I thought that was specific to the spartan protocol. Someone else mentioned that the streaming worked on Rosy Crowe (or whatever it's called, haven't used this client myself).

Btw, I read your post about Mobile Streaming. It was interesting because some of the things you talked about are some of the things I had to tinker with to get this to work.

On upload of music files, I get the bitrate of each file so I know how fast to livestream the data, since I can't actually tell if clients have finished playing the audio due to it being an infinite stream of mpeg data.

And then I have this "fake client" goroutine that just acts like a fake client that's "streaming" the radio and it handles setting the current location of the current song, and then when it finished "playing" the song (getting to the end of the mp3 file), it tells another goroutine to change the current file to the next song and change the current location to 0 (well, the location after the ID3v2 tags).

Then that broadcasts telling the fake client and all clients that the song has changed, and then they open the file and start sending the new file data over (and the fake client continues its process of fake "playing" the song and setting the current location in the file of the current song).

When a new client joins, it just opens the file and gets the current location (as set by the fake client) so that it's up to date with the rest of the clients.

It took me like 3-4 days to get this all working lol. There were definitely some problems in the beginning, but I'm so happy I figured it out!

P.s.: For that android client, I suspect, like you said, it's trying to download the whole file before starting to play it. This used to be the case for more clients until people started realizing streaming is a thing (even text streaming!) and so solderpunk made it clearer that streaming is allowed, and that connections are infinite unless they are deliberately closed by one party (the client or server), which dramatically helped the streaming situation. Tomasino, and a few others, got the ball rolling on the streaming stuff, and I supported it from the very beginning.

However, some clients don't allow for streaming because they either timeout, or don't display/play as data comes in, but after it's all downloaded and the connection has closed.

There are more clients besides Lagrange out there that allow for streaming on desktop, but I'm not sure what the situation is like for android or iOS.

There's more info about how streaming became a thing and was allowed in the Gemini History Must Reads page that I have:

โ€” auragem.letz.dev/GeminiHistoryMustReads.gmi

๐Ÿ‘ป mediocregopher ยท Sep 18 at 16:36:

@clseibold I'm using Rosy Crow on android, so not sure what's going on there. Maybe the issue is at the OS level somehow...

I had forgot about the figuring out the song bitrate in order to know how fast to dump the data onto the socket, that was yet another wrinkle :)

๐Ÿš€ mbays ยท Sep 19 at 05:55:

Nice. Works perfectly in diohsc (piping the stream to mpv). It's maybe a shame that you can't get track metadata in the stream, as with icecast streams. This seems to be impossible with mp3. I don't know about ogg vorbis.

๐Ÿš€ mbays ยท Sep 19 at 06:05:

@clseibold Did you think about also having "public account" for auragem allowing upload of royalty-free music?

๐Ÿš€ stack ยท Sep 19 at 12:40:

Which Gemini browsers (especially Android) are capable of streaming music? I was just thinking that I don't need anything but Lagrange, but sadly it does not play streams on Android.

๐Ÿš€ clseibold ยท Sep 19 at 13:51:

@stack Gaaah! Ok. So, I just found out that audio doesn't stream on Lagrange if you are on iOS, Android, or AppImage. There's no other way to do gemini audio streams, afaik, from iOS and Android until @skyjake fixes Lagrange. I have no idea about the AppImage situation and if there is a different non-AppImage version, but I believe someone else got the streams to work on Linux, so there must be.

I will be trying to speed up the development of my own vlc player that supports gemini links, because all the problems with existing gemini clients are getting annoying.

@mbays I'm glad it worked on one other client! lol. I'll add diohsc to the list of supported clients (and specify that you pipe it into mpv, and probably can pipe it into vlc too, I would guess).

I have thought about ways that people could upload public domain and royalty free music (as well as their own music). More on this coming soon :)

Thanks for trying it out and the feedback!

๐Ÿš€ skyjake ยท Sep 19 at 19:17:

Those builds of Lagrange that use the mpg123 software decoder (all desktop versions) should stream MPEG audio just fine. However, this decoder library is an optional dependency so it is possible the AppImage has some build config issues. I'll have to investigate.

When it comes to iOS and Android, software decoding and playback via SDL โ€” like it is done on desktop โ€” is unfortunately not a good idea because it is too inefficient. Your device will run hot and run out of battery, and that is unacceptable. Instead, the mobile builds need platform-specific code to use native audio APIs and hardware decoders.

On iOS, native audio playback is already implemented, but only for fully downloaded files when the app can hand over a complete "audio/mpeg" file to the native API.

On Android, native audio playback is similarly possible for audio files that have already been downloaded.

Streaming over Gemini and playing back via native APIs is not implemented on either platform. The amount of work required here is significant, and it is difficult to justify prioritizing it because this particular use case is very niche in Geminispace, because neither streaming nor audio are Gemini's "core competencies".

I would certainly want to implement support for better audio playback at some point, but there are more important things to invest my time into.

That said, if anyone has relevant iOS/Android code (playing streaming audio), you can send it my way. It should help make the eventual implementation easier.

๐Ÿš€ clseibold ยท Sep 19 at 19:27:

@skyjake Thanks for the response and for the clarifications. I didn't realize the mobile platforms made it so hard to do audio streaming. Seems like every developer I've known that has programmed for Android has complained about Android being annoying to program for. I'm considering workarounds since the situation on mobile is hard to deal with for those who have made gemini browsers for them.

I will say, however, that I don't think the audio streaming is as niche as you think it is, I just think it's *new*, which is different than saying it's niche. I've gotten a surprising number of comments, likes, etc., and traffic at AuraGem, since I launched AuraGem Music and the public radio.

Also, Gemini has had lots of music files served over it from its very beginning (e.g., Konpeito), which makes sense since it has some overlap with SDF and SDF's anonradio.