Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
806 stars 65 forks source link

Feature: FM synth music playback via libADL #59

Closed JPLeBreton closed 5 years ago

JPLeBreton commented 6 years ago

This is probably a well-down-the-road thing, but just in case it's useful and/or more appealing than getting a more conventional MIDI synth working within the project, there are libraries like this that will emulate an OPL3 FM synth chip and play MIDI data: https://github.com/Wohlstand/libADLMIDI Many people first played Shock 1 with a Sound Blaster card and this gives that authentic sound.

Rugaliz commented 6 years ago

I dunno about using a soundblaster soundfont but the soundtrack with a Roland SC-55 sounds great https://www.youtube.com/watch?v=O3fWoGwnTG0 I use fluidsynth to get this sound when i play Doom in Gzdoom.

JPLeBreton commented 6 years ago

LibADL isn't a soundfont, it's an entirely different kind of synth for playing music. The sounds characteristic of FM synthesis can't be replicated with a soundfont.

As for getting the (totally unrelated to FM synth) SC-55 sound, there are a couple of soundfonts out there that apparently do a good but not perfect job. Currently Shockolate uses SDL2_mixer to play MIDI via whatever is available on the system, and it's probably possible to point that towards an SC55 like soundfont.

Interrupt commented 6 years ago

Modern midi support really can destroy the soundtrack, the Soundblaster version sounds so much more like the electronica it was trying to replicate: https://www.youtube.com/watch?v=dcOVe2rX_80 It's worth a shot playing midi through something like this to see how it sounds once we've got the XMI soundtrack working again.

JPLeBreton commented 6 years ago

In case it helps, GZDoom is an example of a project that integrates libADL alongside several other music playback options: https://github.com/coelckers/gzdoom/tree/master/src/sound

Interrupt commented 6 years ago

I've been playing around a bit with this and have it playing the Midi music over at https://github.com/Interrupt/systemshock/tree/adlmidi

It sounds amazing in some places, and not so great in others. There's also some basic XMI midi support in there which kinda plays the SS XMI files, but it plays all the tracks at the same time so it's just a wall of noise right now with those files.

Interrupt commented 6 years ago

The XMI support in adlmidi has been getting better with some recent commits so I've been using that as a base to unearth the layered XMI track playback along with the Music AI system that controls all of this. This work is on branch https://github.com/Interrupt/systemshock/tree/adlmidi-xmi

It seems to be sequencing the tracks correctly now in my proof of concept but libAdlMidi seems to either be playing the file for too long before looping, or there's some loop points in the XMI files that aren't being handled properly since there's a long period of silence at the end of the music snippets.

Interrupt commented 5 years ago

Have been taking another stab at this: https://github.com/Interrupt/systemshock/pull/163

Interrupt commented 5 years ago

This is in now, for the most part.