u/RevoIncubus

my game has no audio files at all - the music is synthesized live on a fake SNES sound chip that the sound effects have to share
▲ 174 r/love2d+1 crossposts

my game has no audio files at all - the music is synthesized live on a fake SNES sound chip that the sound effects have to share

first time posting anything i've made, so sorry if this is the wrong format for here. sound on though, the video's kind of pointless muted.

https://www.youtube.com/watch?v=VlU3gKWoeV4

it's an ARPG thing in LÖVE. the reason there's no music file is honestly i'm just terrible at arranging music so I figured I could make some procedural stuff and i wrote the synth and then it sort of took over the project.

so there's a software SPC700 in there now. 32kHz, 4-tap gaussian resampling, one global echo capped at 240ms. and 8 voices - not 8 for the music, 8 for everything, the same as the actual chip. the music and the sound effects are fighting over the same eight slots.

which i didn't plan for and now really like? every SNES sound driver had this exact problem and they all solved it the same way, effects steal voices from the music in a priority list. mine takes the score's FX voice first and its kick and bass absolutely last. so if a fight gets busy you can hear the melody thin out while the drums keep going. i left it in. a big fight costs you the tune, which felt more interesting and really made it hit my nostalgia.

the tracks are just lua tables - patterns, chords, kit, tempo range - rendered sample by sample into a queueable source. costs about 0.6% of a core. because it's being generated rather than played back it can react to what's happening:

- there's one "tension" number that comes off your health, and it moves the tempo, brings an alarm voice up, and swaps the bass sample through five progressively deeper tables. that last one is how you'd actually deepen a bass on a SNES, there's no per-voice filter on the chip and there isn't one here either.
- a couple of the tracks are dubstep-ish and need a filter sweeping inside a held note, which the hardware also can't do. but a tracker can rewrite a voice's sample pointer mid-note, so the wobble is eight tables baked through a resonant lowpass at eight different cutoffs and an LFO just swaps between them without touching the playback position. only works because every table is the same length and phase aligned. there's an assert for that because when it isn't, it clicks on every single swap and it took me a while to work out why.
- all ten tracks got calibrated to the same loudness with proper K-weighting, because RMS kept telling me the sub-heavy one was the loudest and my ears very much disagreed.

sound effects are 99 sounds built out of a shared 25-table kit, all generated the same way. the thing that took longest there was that they peaked as loud as the music but sat about 15-20dB under it in RMS, so a screen full of explosions was raising the actual energy of the mix by like 2%. peaks like a gunshot, but weirdly weak. turned out to be three things stacking, normalisation crushing the transient into the body, an envelope going on top of a decay, and impacts getting pitched up on samples that were already too short. a fight lifts the mix 44% now.

and because the music is all code i ended up being able to just hand it to the player. there's a little audio studio in the game where you can pick a track, mess with the tempo, drag ten EQ bands around, stack a second track on top of the first sharing the same step clock, and record the whole thing out to a .wav. mostly i built it to make trailer music for myself and then figured i may as well leave it in. A ton of features started this way on this project.

there's also 300-odd weapon combinations but that's a whole other thing and this is already long.

anyway it's not on steam, there's no page, i just don't really have anyone local to share with that finds it cool, so I figured I'd do that thing they always tell you to do and look to teh community. Happy to answer any questions

u/RevoIncubus — 11 days ago