Skip to content

Improve the music/sound system #53

@dengr1065

Description

@dengr1065

The current sound system was made mainly with the browser in mind, to gracefully handle audio-on-interaction, slow and limited network etc. It also uses Howler.js, an audio library for "modern web" that hasn't gotten any updates since September 2023.

Out of features it provides we only use audio sprites, which also require a build step that uses an unmaintained npm package which in turn depends on audiosprite (last release in 2020). The README of the projects states the following:

Why?

iOS, Windows Phone and some Android phones have very limited HTML5 audio support. They only support playing a single file at a time and loading in new files requires user interaction and has a big latency. To overcome this there is a technique to combine all audio into single file and only play/loop certain parts of that file.

It is obvious that a lot of time has passed since then and we're not even targeting mobile platforms. In my opinion, the audio sprites usage is no longer necessary.

So, here's what I'd like to see in the new sound system:

  • No dependency on Howler.js
  • The opposite of audio sprites - we are currently using a single file for the main OST (theme-full.wav/mp3). Mainly for user experience:
    • Provide manually crafted metadata file with the track list
    • When starting the game, play beginning from a random track
    • If possible with the current audio file, shuffle the tracks
    • Allow display of the currently playing track in pause menu
    • (Optional) Allow some user control over what is playing
  • Better control from the states, such as fading out when exiting a savegame
  • (Optional) An API to let mods easily add more music to the game that can be toggled in the game settings, as well as defining what music can play under what conditions
    • Example: play a different OST set once some level is reached
  • Smooth transitions for track changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions