OpenTTD supporting Roland MT32

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

jostein.topland
Engineer
Engineer
Posts: 4
Joined: 04 May 2020 18:53

OpenTTD supporting Roland MT32

Post by jostein.topland »

Hi,

I'm playing the original TTD music with OpenTTD using musicdriver = "dmusic:port=2" together with the Munt Roland MT32 emulator. Music plays, but the instruments selected are wrong. This is due to OpenTTD choosing General Midi instead of the proprietary Roland MT32 format when playing MIDI files.

I've verified this choosing General Midi from TTD's settings in DOSBox connecting it to Munt. The exact same instruments and sound are the same as OpenTTD, which is wrong. Choosing Roland LAPC-1/MT32 from TTD's settings in DOSBox connecting it to Munt plays the original music perfect.

Is there already a way to let OpenTTD output the proprietary Roland MT32 MIDI format instead of General Midi or is it planned for development?

Regards,
Jostein Topland
Attachments
ttd-mt32.png
ttd-mt32.png (19.98 KiB) Viewed 4130 times
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: OpenTTD supporting Roland MT32

Post by jfs »

I have considered adding support for it, but honestly it's so niche I'm not sure it's really worth the added complexity to the music code.
Really just download my recordings and play them in your music player of choice ;)


(The complexity is not in decoding the music itself, the song data uses the same format as the General MIDI soundtrack. Rather adding the support for also reading and transmitting the SysEx data in the LAPC1.PAT file adds complexity, as does having a way to indicate that needs to be done, and possibly a way to indicate that the music set requires an MT-32 synth and a way for the music driver to indicate it is a port connected to an MT-32 synth.)
User avatar
kamnet
Moderator
Moderator
Posts: 8548
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: OpenTTD supporting Roland MT32

Post by kamnet »

As much as I love MIDI, I'm not sure if it's worth the hassle.

I think most players would be way more satisfied if the music player instead played MP3, MP4, WAV or FLAC. Sadly, far to many have no appreciation for MIDI, even using a proprietary sound font or better players.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: OpenTTD supporting Roland MT32

Post by jfs »

I ended up spending a few hours hacking in MT-32 music loading yesterday after all. It's not finished, there is a weird issue with pitch bend going crazy, which I'd have to verify with the original music driver disassembly. (And I'll have to add a workaround for the RA-50 issue of not having "all notes off" support, though that's even more niche.)

Some time later I'll record the crazy pitch bend, it sounds funny ;)
jostein.topland
Engineer
Engineer
Posts: 4
Joined: 04 May 2020 18:53

Re: OpenTTD supporting Roland MT32

Post by jostein.topland »

jfs wrote: 05 May 2020 08:58 I ended up spending a few hours hacking in MT-32 music loading yesterday after all. It's not finished, there is a weird issue with pitch bend going crazy, which I'd have to verify with the original music driver disassembly. (And I'll have to add a workaround for the RA-50 issue of not having "all notes off" support, though that's even more niche.)

Some time later I'll record the crazy pitch bend, it sounds funny ;)
I appreciate you looking into this, man. Would love to hear that wacky tune :lol:
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: OpenTTD supporting Roland MT32

Post by jfs »

Here it is, extra funky version of the Tycoon DELUXE Theme, two repetitions.
Notice how the oddness only sets in halfway through, but then hangs around in the repetition a bit.
Also notice how the notes collapse at the start, this is due to my poor handling of the patchset data loading where I just dump everything out at the start of every tune, and transmitting those about 1175 bytes of data takes a non-zero amount of time across a 31250 bits/s serial line.
Attachments
TycoonDeluxeThemeBrokenOTTD.ogg
(4.37 MiB) Downloaded 175 times
jostein.topland
Engineer
Engineer
Posts: 4
Joined: 04 May 2020 18:53

Re: OpenTTD supporting Roland MT32

Post by jostein.topland »

jfs wrote: 05 May 2020 17:29 Here it is, extra funky version of the Tycoon DELUXE Theme, two repetitions.
Notice how the oddness only sets in halfway through, but then hangs around in the repetition a bit.
Also notice how the notes collapse at the start, this is due to my poor handling of the patchset data loading where I just dump everything out at the start of every tune, and transmitting those about 1175 bytes of data takes a non-zero amount of time across a 31250 bits/s serial line.
Hahaha! Go home TTD orchestra, ur drunk. That trumpet is mental @1:12 :lol:

Still, this is very close. Just some fine-tuning with that portamento and the start. Great work!
jostein.topland
Engineer
Engineer
Posts: 4
Joined: 04 May 2020 18:53

Re: OpenTTD supporting Roland MT32

Post by jostein.topland »

I notice that the latest OpenTTD playing the original music files also does the pitch incorrectly. The guitar goes all out of control when it bends the notes. Not using the Munt or MT32.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: OpenTTD supporting Roland MT32

Post by jfs »

jostein.topland wrote: 06 May 2020 21:30 I notice that the latest OpenTTD playing the original music files also does the pitch incorrectly. The guitar goes all out of control when it bends the notes. Not using the Munt or MT32.
I investigated this, and that just can't be true.
See the attached screenshots of a MIDI tool showing events from the same position in a dump from DOSbox running unmodified TTD, and a dump from my decoder. All parameters and event ordering is exactly identical. The only difference is that the dump from DOSbox has 130 additional events at the beginning, and it's probably some of that initialisation I'm missing.

(You can use the "dumpsmf" command in the OpenTTD console to write the currently loaded MIDI to a new file. It will write exactly the MIDI data that would be sent to the synth during playback.)
Attachments
2020-05-08_21-20-45.png
Capture of MT-32 soundtrack via DOSbox
(264.62 KiB) Not downloaded yet
2020-05-08_21-20-52.png
Dump of MT-32 soundtrack decoded by my OpenTTD patch
(267.48 KiB) Not downloaded yet
User avatar
jez
Traffic Manager
Traffic Manager
Posts: 158
Joined: 23 Aug 2003 21:24

Re: OpenTTD supporting Roland MT32

Post by jez »

kamnet wrote: 05 May 2020 01:40 As much as I love MIDI, I'm not sure if it's worth the hassle.

I think most players would be way more satisfied if the music player instead played MP3, MP4, WAV or FLAC. Sadly, far to many have no appreciation for MIDI, even using a proprietary sound font or better players.
Yeah, but it doesn't support MP3. "Because the original game didn't" apparently. The original game didn't do half of what OpenTTD does, so I'm not sure how that's an argument.
=== Jez ===
Taschi
Route Supervisor
Route Supervisor
Posts: 425
Joined: 11 Oct 2014 22:58

Re: OpenTTD supporting Roland MT32

Post by Taschi »

Please explain to me what advantage a MP3 player in OpenTTD would have over just installing VLC and listening to your preferred music that way?
User avatar
jez
Traffic Manager
Traffic Manager
Posts: 158
Joined: 23 Aug 2003 21:24

Re: OpenTTD supporting Roland MT32

Post by jez »

Because it's not the same experience, is it? You have to manually start/stop the music player, you can't pick from the playlist in-game, the music doesn't change on the title screen, etc. For the relative simplicity of opening a fallback MP3 file if the midi isn't there, it seems worth it to me. But then a lot of things do, which OpenTTD doesn't have.
=== Jez ===
Taschi
Route Supervisor
Route Supervisor
Posts: 425
Joined: 11 Oct 2014 22:58

Re: OpenTTD supporting Roland MT32

Post by Taschi »

For me, the very first thing I do on any strategy game is turning off the in-game music. Sure, listening to Spotify instead requires like three extra mouse clicks but it also means I can listen to whatever I want to listen to.

So, to be brutally honest, I think spending any amount of effort on the in-game music player is a waste of time for me personally, and I also think that sentiment is shared by a fair amount of OpenTTD players.

There's also the matter that even a single song in MP3 format can easily as big as the entire OpenTTD installer, and utterly eclipses most NewGRF addons in size. Sure, bandwidth and storage are a lot cheaper these days than in the DOS days, but they're still not free.
User avatar
jez
Traffic Manager
Traffic Manager
Posts: 158
Joined: 23 Aug 2003 21:24

Re: OpenTTD supporting Roland MT32

Post by jez »

lol, you're worried about the *size* of mp3s? Besides, they wouldn't be included in the installer anyway, you'd provide your own.

Frankly, I don't care what you prefer. I'd prefer in-game MP3 music.
=== Jez ===
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: OpenTTD supporting Roland MT32

Post by Eddi »

Taschi wrote: 28 May 2021 19:48 For me, the very first thing I do on any strategy game is turning off the in-game music. Sure, listening to Spotify instead requires like three extra mouse clicks but it also means I can listen to whatever I want to listen to.

So, to be brutally honest, I think spending any amount of effort on the in-game music player is a waste of time for me personally, and I also think that sentiment is shared by a fair amount of OpenTTD players.
for the record, i have the opposite opinion.

music gives a special flair to any game, and i like listening to each game's soundtrack. at least for a while... if you spend a really long time on a game, it might become a bit repetitive.
Taschi
Route Supervisor
Route Supervisor
Posts: 425
Joined: 11 Oct 2014 22:58

Re: OpenTTD supporting Roland MT32

Post by Taschi »

lol, you're worried about the *size* of mp3s? Besides, they wouldn't be included in the installer anyway, you'd provide your own.
If you provide your own music, there is absolutely zero reason why the player should be integrated into the game, aside from "i'm too lazy to start VLC".

And because you have directly and explicitly stated that you do not care about my opinion, I do not have to consider your opinion either and can state that I am factually, objectively correct.
music gives a special flair to any game, and i like listening to each game's soundtrack.
Yeah - if the game has a high-quality soundtrack that is well-integrated into the overall game, I generally do the same. I wouldn't dare turn off the music for Mass Effect 2.

Three points here: a) OpenTTD's soundtrack is so peripheral to the game that it isn't even installed by default, b) the soundtrack is generally a lot less closely connected to the gameplay in strategy games than in more linear, story-driven games and c) as long as we're talking about the game's default soundtrack, the file format really is kind of irrelevant (or, in the case of the original TTD music, MIDI is actually the more faithful format). Switching from MIDIs to any kind of PCM audio really is only relevant to people who want to listen to their own music instead of the game's actual soundtrack.

I mean, if jez wants to have a fully-featured MP3 player inside of OpenTTD they're free to just write one themselves, but if the actual dev team spent their time and effort building one I think that would be a bit of a waste of time.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: OpenTTD supporting Roland MT32

Post by Eddi »

nobody intends to write an mp3 player.

at most you'd look for an existing library, and write a bit of interface code.
User avatar
kamnet
Moderator
Moderator
Posts: 8548
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: OpenTTD supporting Roland MT32

Post by kamnet »

jez wrote: 28 May 2021 14:18
kamnet wrote: 05 May 2020 01:40 As much as I love MIDI, I'm not sure if it's worth the hassle.

I think most players would be way more satisfied if the music player instead played MP3, MP4, WAV or FLAC. Sadly, far to many have no appreciation for MIDI, even using a proprietary sound font or better players.
Yeah, but it doesn't support MP3. "Because the original game didn't" apparently. The original game didn't do half of what OpenTTD does, so I'm not sure how that's an argument.
No, the in-game player doesn't support MP3 because nobody has bothered to implement it. Owen Rudge actually started working on a replacement player over a decade ago that would have supported other audio formats, but he never finished and it's on the backburner. And nobody else has stepped up. But as long as the player still supports the original game audio files, then it fulfills the goal of being 100% faithful reproduction of Transport Tycoon Deluxe. And if it does more, yay.

By comparison, the original graphics are in PCX file format. OpenTTD still supports that for the original game files, even though almost all the graphics and NewGRFs now use PNG.
User avatar
jez
Traffic Manager
Traffic Manager
Posts: 158
Joined: 23 Aug 2003 21:24

Re: OpenTTD supporting Roland MT32

Post by jez »

The original music included MT32, so actually, it's not being 100% faithful to the original because I can no longer play that music.
=== Jez ===
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: OpenTTD supporting Roland MT32

Post by jfs »

The actual problem I see with implementing MP3/Ogg/whatever sampled music format playback in the game is that it will mean adding a new external dependency to the game, for example ffmpeg. That's a big dependency to pull in, and could easily double the download size for Windows and Mac builds, and complicate support for Linux etc. packages.

Adding support for the MT-32 music is much more doable, but it'll require a bunch of additional hackery since the MT-32 music depends on a second file for the SysEx patches it programs the synth with, and the current file format defining music sets doesn't have a great way for that.

Obviously, then the question of AdLib music would also come up. The issue there is that none of the platforms OpenTTD primarily supports today have a good way to talk directly to an OPL2 or OPL3 chip. Integrating an OPL2/OPL3 emulator (e.g. from DOSbox) is possible, but they aren't fully accurate and somewhat defeats the purpose.
(I have thought about trying to support OPL2LPT/OPL3LPT devices via parallel port, but haven't managed to get it working with a modern parallel port on Windows so far.)
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 3 guests