cadence’s website.

Some changes will be applied after reloading.
Some changes will be applied after reloading.

Listening online

I'm in the process of adding a feature to Amanda which allows you to listen to music online on the web dashboard instead of having to join the voice channel in Discord. This means audio quality will be better for people on low quality connections, since it's buffered in the browser, and also for people on mobile, since Discord's audio quality on mobile is GARBAGE, and also for people who just don't have Discord open at the time — like me, soon!

Currently this feature only supports songs from SoundCloud, but I intend to make it compatible with more song types over the coming days, most importantly YouTube.

To use it, just open the dashboard, select a server with an ongoing voice session, and press the "listen in browser" button. After a few seconds, you'll start hearing the glorious tunes without needing to open Discord.

This works by embedding a hidden iframe to SoundCloud and then controlling it through their widget API, which allows the embedding page to pause, play, and load more stuff. The documentation is sadly not very good - the LOAD_PROGRESS event doesn't seem to exist, one property in the event callback is named loadedProgress instead of loadProgress, and it seems like you have to unbind all events before calling .load. Also, all widgets created from the same frame are actually the same widget reference, which is really dumb in my opinion. I tried looking at their code to see if I could change this, but I think it's compiled with webpack and I don't care enough to figure out what all the one-character variable names are supposed to be.

YouTube also has an iframe API which I can use. I suspect that it'll be better documented and less janky than SoundCloud's, but we'll see.

For Frisky Radio I just need to make an audio element with the source and it'll just work.

I don't have to worry about browser autoplay restrictions because no sound plays until the user clicks a button, and after the user clicks a button the browser treats everything as a manual play, not an auto play, so I'm perfectly fine.

I've built some pretty good syncing logic which means that when you join an ongoing song you'll be synced to somewhere around 200-500 ms away from what the bot is playing in voice, but if you keep listening and another song loads, it'll be behind by about 2 seconds since I don't have any preloading. This is something that I'd like to revise in the future, but I'm not super bothered. The main impact of this is that songs might end a couple of seconds early, but I think this is acceptable since many songs already have a fade out or silence at the end, so most of the time you won't be missing much.

None of the iframes load until you actually press the button to listen, so there's no privacy concerns from secretly loading an iframe from YouTube that you aren't going to use.

Overall, Git says that this feature has: 20 files changed, 601 insertions, 219 deletions.

I also finished the very last COSC 241 lab, which means that overall I have missed only half of one lab, which means that I've completed 23/24 halves.

Sleeping is becoming difficult. Normally I fall asleep pretty quickly because I get into bed so late, but the last couple of nights I was lying there for 40 minutes or so, which isn't super fun when I'd like to perhaps be awake by noon the next day.

I'd really like to get out of the house and go down to the computer labs at the university to be in an environment where I can focus, but the times of day that I've been waking up have not been conducive to this goal. Perhaps tonight will be different.

— Cadence

A seal on a cushion spinning a globe on its nose.
Another seal. They are friends!