The Procedural music generator is a simple solution for low-cost background music. All parameters of generators should be set according to game state to maximize immersion.
Common ideas:
Area where player resides: Calmer music for safe, empty areas(lower tempos)
Amount of onscreen activity: faster, more aggressive music with more activity
Player state: more dramatic, sharp music if character is wounded/poisoned/stunned/teleporting(active state change), more repetitive music if character is engaging with repetitive activity like running/shooting.
Amount of Other players:more instruments played