SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.63k stars 1.11k forks source link

Assets midi conversion #840

Open FolkertVanVerseveld opened 7 years ago

FolkertVanVerseveld commented 7 years ago

The original Age of Empires uses MIDI for background music using the system's default sound banks for MIDI. I think it is best to add MIDI conversion support to the assets converter tools, rather than add MIDI playback support to the engine directly. MIDI is especially troublesome to get working on linux due to lack of good soundfonts and playback software.

It is possible to get MIDI playback working on linux by using libfluidsynth (one of my projects uses this library to support MIDI playback), but I don't think this is what we want.

TheJJ commented 7 years ago

So we would mixdown the midi tracks to opus? I doubt that many players would miss the background music though :stuck_out_tongue:

FolkertVanVerseveld commented 7 years ago

Come to think of it, converting MIDI to opus is more a pain in the ass than providing support for MIDI playback. I think both options are troublesome, since MIDI on linux sucks. I also couldn't figure out whether it would be feasible to stream the raw converted audio from libfluidsynth to OpenAL so you can regulate the volume etc. If that is not possible we have to look for other options.

The background music is essential for good gameplay experience but I certainly don't want to implement a MIDI playback library :stuck_out_tongue:

StepS- commented 7 years ago

Actually, AOE1 has a full-fledged CD soundtrack. The compact disk is a Mixed Mode CD, that means it contains both the game files and the CDA tracks. This audio playback doesn't work in the original game on pretty much every contemporary system, moreover it is not even supported by the ISO file format if you backup your CD. You will also not see the audio files with most file managers. It's also missing in the Gold Edition and some other re-releases, as far as I know. As the result, the "backup solution" (midi) is used. However, midi is not the original soundtrack of the game: the midi files are lo-fi clones of the soundtrack to fit seamlessly on the HDDs at the time. Therefore, you need to use software that is able to rip the CDA music from Mixed Mode CDs, to extract the tracks as WAV, then convert to OPUS as necessary. No need to upscale the lo-fi midi variants. Unless you want to also support the broken re-releases of the game. You can read more about this problem in the UPatch HD discussion threads. The latest UPatch allows you to play with the original CD soundtrack instead of midi.

FYI, if you read that wiki article then you can also see that AOE2 was exactly the same. So if you set this ripping system in place, it'll also benefit AOE2 as well.

CapsAdmin commented 7 years ago

OpenAL-soft has midi extensions so if that works properly I don't think there's any need to mess with libfluidsynth if you're going to support midi. I think it's best to stick with opus but if it's not too much work why not also support midi.

http://openal.org/pipermail/openal/2014-January/000005.html

You still need to use the microsoft owned soundfont if you want the true original sound. Not sure how that works licensing wise. It would be neat if you could specify your own soundfont anyway so people can get and use the microsoft owned one somehow if they want on Linux.

edit: Oh I assumed you were using OpenAL for some reason but apparently you're not.