Background Music for Multiplayer Piano
What is it?
Background Music is a bot for Multiplayer Piano. Users can opt in for Background Music in channels where they hold the Crown. The bot joins a maximum of three channels (as per restrictions set by Multiplayer Piano as of writing) and plays randomly selected songs (MIDI files) whenever the room is quiet. It stops playing if overplayed.
Demo
You can see a video demo on YouTube.
Source Code
You can see the source code on GitHub.
History
Background Music was created in November of 2022 and later replaced with Requests. As with most of my code, it's written in JavaScript and runs via Node.js.
At first, the bot automatically cycled channels looking for active, but quiet rooms. If the room's chat box stayed active and enough players were present, it would start to play background music when nobody was using the piano.
This approach was interesting to me because it had a dynamic quality, as it continuously found the most appropriate place to operate - or so I thought.
Ultimately though, the site admins received several complaints about it, so I had to tweak it to be opt-in. Whoops.