Are there any plans to make a better music driver than Adlib-emulation? Just using simple samples instead of Adlib might enhance both audio and performance?
I would be willing to help if there is interest with the developers.
Better music driver?
Moderator: ScummVM Team
- eriktorbjorn
- ScummVM Developer
- Posts: 3561
- Joined: Mon Oct 31, 2005 7:39 am
Re: Better music driver?
Out of curiosity, how would that work? Unlike MIDI, the Adlib music does not tell you anything about what real-life instrument it's supposed to sound like. It just gives you a bunch of "magic" settings for how to generate the sound.mattias800 wrote:Are there any plans to make a better music driver than Adlib-emulation? Just using simple samples instead of Adlib might enhance both audio and performance?
I would be willing to help if there is interest with the developers.
-
- Posts: 5
- Joined: Tue May 29, 2007 12:36 am
Re: Better music driver?
Actually, the Adlib-driver receives the same MIDI commands as any other driver, and they contain full information on which instruments to use. There just are no samples to play, which is why Adlib-emulation was implementederiktorbjorn wrote:Out of curiosity, how would that work? Unlike MIDI, the Adlib music does not tell you anything about what real-life instrument it's supposed to sound like. It just gives you a bunch of "magic" settings for how to generate the sound.mattias800 wrote:Are there any plans to make a better music driver than Adlib-emulation? Just using simple samples instead of Adlib might enhance both audio and performance?
I would be willing to help if there is interest with the developers.
On the PC version you have the FluidSynth driver which is a more advanced version of what I'm thinking for the DS. Haven't tried it myself actually though.
Anyway, I don't know exactly how the music drivers in ScummVM work, but my guess is that you can just replace the change instrument, and note commands to the driver with commands to a propietary driver which loads the correct samples for that instrument and then plays the note.
Well, wont get into details, but with a little work on the software I think the music quality could be vastly improved. Of course, people would have to assemble the instrument samples also
-
- Posts: 5
- Joined: Tue May 29, 2007 12:36 am
- eriktorbjorn
- ScummVM Developer
- Posts: 3561
- Joined: Mon Oct 31, 2005 7:39 am
Re: Better music driver?
I may have misunderstood you. If you're talking about playing the MIDI music, then it's possible that you could make a sample-based MIDI emulator. In fact, I believe that's how TiMidity used to work, though nowadays it also supports SoundFonts.
FluidSynth also emulates MIDI, using SoundFonts, but it's actually a lot slower than the Adlib driver. My old 450 MHz P3 (which I retired a few months ago) wasn't quite fast enough to play the more demanding music through it.
The reason there's a FluidSynth driver, but no TiMidity driver, is that FluidSynth offers a nice programming library, while TiMidity, to the best of my knowledge, doesn't. To make a TiMidity driver, you would pretty much have to copy the entire thing into ScummVM. Which, of course, is a possibility. I think that's what was done with the MT-32 emulator. Of course, you'd also need a set of instruments. Freepats is what Debian recommends for TiMidity even though they describe it as incomplete.
Not all games have MIDI music, though, and if you're talking about the dedicated Adlib music, I see no way of replacing that with samples. Apart from the expected note on/off messages, you also have messages to manipulate the Adlib registers. And that's some serious black magic. This article has some information about it, and is what I used for reference while trying to help LordHoto track down bugs in the Kyrandia Adlib music player.
As a special case, ScummVM can play MIDI music through Adlib, but only because it has a set of Adlib instruments meant to mimic the General MIDI instrument set. Dedicated Adlib music is in no way limited to using them, though.
FluidSynth also emulates MIDI, using SoundFonts, but it's actually a lot slower than the Adlib driver. My old 450 MHz P3 (which I retired a few months ago) wasn't quite fast enough to play the more demanding music through it.
The reason there's a FluidSynth driver, but no TiMidity driver, is that FluidSynth offers a nice programming library, while TiMidity, to the best of my knowledge, doesn't. To make a TiMidity driver, you would pretty much have to copy the entire thing into ScummVM. Which, of course, is a possibility. I think that's what was done with the MT-32 emulator. Of course, you'd also need a set of instruments. Freepats is what Debian recommends for TiMidity even though they describe it as incomplete.
Not all games have MIDI music, though, and if you're talking about the dedicated Adlib music, I see no way of replacing that with samples. Apart from the expected note on/off messages, you also have messages to manipulate the Adlib registers. And that's some serious black magic. This article has some information about it, and is what I used for reference while trying to help LordHoto track down bugs in the Kyrandia Adlib music player.
As a special case, ScummVM can play MIDI music through Adlib, but only because it has a set of Adlib instruments meant to mimic the General MIDI instrument set. Dedicated Adlib music is in no way limited to using them, though.
-
- Posts: 5
- Joined: Tue May 29, 2007 12:36 am
Ah, thanks for the explanation, I understand alot better now
How many games use dedicated Adlib, as opposed to MIDI? Would there be any point to making an improved MIDI driver?
I was messing around with ScummVM DS last night, but couldn't get it to sound any other way than the default sound
I don't know too much about Adlib or ScummVM unfortunately, but I have some knowledge in DS coding and music engines.
How many games use dedicated Adlib, as opposed to MIDI? Would there be any point to making an improved MIDI driver?
I was messing around with ScummVM DS last night, but couldn't get it to sound any other way than the default sound
I don't know too much about Adlib or ScummVM unfortunately, but I have some knowledge in DS coding and music engines.
- eriktorbjorn
- ScummVM Developer
- Posts: 3561
- Joined: Mon Oct 31, 2005 7:39 am
I don't know for sure, and I only have the PC versions, but...mattias800 wrote: How many games use dedicated Adlib, as opposed to MIDI? Would there be any point to making an improved MIDI driver?
Maniac Mansion and Zak McKracken and the Alien Mind Benders don't even have Adlib. They use PC Speaker or PCjr emulation instead.
Indiana Jones and the Last Crusade has Adlib music, but does not seem to have MIDI.
The 16-colour versions of Loom and, I'm told, The Secret of Monkey Island do not support MIDI out-of-the-box, but can be made to using patches from LucasArts.
The AGI (Sierra-on-Line) games seem to pre-date Adlib, as well.
The Legend of Kyrandia does have MIDI music, but it's not as well supported as the Adlib music.
Future Wars supposedly has MIDI music, but ScummVM currently only supports the Adlib music.
In some cases, the MIDI music is written for the Roland MT-32, so playing it on anything else may be sub-optimal. That's probably why I generally prefer Adlib for Monkey Island 2: LeChuck's Revenge, for instance.
-
- Posts: 5
- Joined: Tue May 29, 2007 12:36 am
- eriktorbjorn
- ScummVM Developer
- Posts: 3561
- Joined: Mon Oct 31, 2005 7:39 am
I don't know. I think Monkey Island 2 and Fate of Atlantis have some custom MT-32 instruments, at least, but I don't own an MT-32 myself so I don't know much about it.mattias800 wrote:Oh, not good statistics
The ones that support MT32, do they generally use standard sounds, or do they program their own patches?
Well, some of the games I listed do have MIDI music, and I think that the number of games that have MT-32 but not General MIDI is fairly small. But the games that don't have MIDI at all won't use the FluidSynth driver. (And FluidSynth, as I wrote earlier, needs a faster CPU than Adlib does.)All of these games wont work with the FluidSynth-driver either then?
The problem with implementing sampled music on the DS, is that there is very little memory available for samples. Possibly less than 500Kb in places. I wouldn't be comfortable with any less headroom there. So for those games, Adlib would be the only way.
Of course, the older games use less memory, so it would be feasible there.
There is also the issue that each Kb added to the binary size decreases memory available for samples. And this would take up memory even when not in use. Loading only in-use samples from disk as needed would be the way to go, but unfortuantely the disk speed varies quite a bit between different card readers.
On the plus side, the DS has a 16 channel hardware mixer which would be ideal for mixing the music, with no CPU overhead except for the memory bus used by the DMAs to play the sounds.
So, if you want to have a go, be my guest, but it's going to be tough.
Of course, the older games use less memory, so it would be feasible there.
There is also the issue that each Kb added to the binary size decreases memory available for samples. And this would take up memory even when not in use. Loading only in-use samples from disk as needed would be the way to go, but unfortuantely the disk speed varies quite a bit between different card readers.
On the plus side, the DS has a 16 channel hardware mixer which would be ideal for mixing the music, with no CPU overhead except for the memory bus used by the DMAs to play the sounds.
So, if you want to have a go, be my guest, but it's going to be tough.