Sierra/Dynamix sound driver hacking

Getting old DOS games working. (DOSBox topics belong in DOSBox areas below, not here).

Re: Sierra/Dynamix sound driver hacking

Postby NewRisingSun » 2012-6-18 @ 19:25

ripsaw8080 wrote:The NRS drivers seem to work well enough on SQ3, but have glitches on KQ1 SCI, such as the first time you open the door of the witch's house there is a couple of seconds of ear-grinding noise at the end of the sample, but every time after the first seems fine.
Doesn't happen here. Then again I don't keep track of older, possibly error-prone, versions of my stuff being distributed.
tikalat wrote:The driver does use the 'low-res' replacements (debugger confirms SB DMA) but I think it should be his call what he wants to do with his work.
What are "low-res replacements", and what exactly are you all trying to do? If the goal is to get both MT-32 music and Sound Blaster PCM, but the latter only for those sound effects that are not just recorded from the MT-32, then modifying PCM-waveform-bearing sound resources to indicate whether it's an MT-32-recorded waveform or not, and having a custom MTBLAST.DRV look for that flag, is unavoidable. I've done this before.
NewRisingSun
Oldbie
 
Posts: 798
Joined: 2005-9-02 @ 02:26

Re: Sierra/Dynamix sound driver hacking

Postby ripsaw8080 » 2012-6-18 @ 20:18

NewRisingSun wrote:I don't keep track of older, possibly error-prone, versions of my stuff

Do you have newer, possibly less error-prone, versions of the drivers available? :)

NewRisingSun wrote:If the goal is to get both MT-32 music and Sound Blaster PCM, but the latter only for those sound effects that are not just recorded from the MT-32

The first MTBLAST driver for QFG2 uses separate SOUND.XXX files, so it can already do that: either the separate file is there or not.

NewRisingSun wrote:then modifying PCM-waveform-bearing sound resources to indicate whether it's an MT-32-recorded waveform or not, and having a custom MTBLAST.DRV look for that flag, is unavoidable.

Actually, it may be avoidable. The approach being used by the second driver is for it to hack the interpreter to play digital sounds despite the MT-32 device ID, so you don't need modified or separate sound resources, but at the moment it lacks selectivity. It may be possible to refine the second approach to only play specific digital sounds by number, perhaps going by a table within the driver. A table would be specific to QFG2, but the interpreter hacking tends to make it specific anyway.

With the first or second approach, still need someone to go through the digital sounds and identify which are just sampled MT-32 sounds so they can be excluded. The SCI tool linked by collector seems to work well enough for the job.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4232
Joined: 2006-4-25 @ 23:24

Re: Sierra/Dynamix sound driver hacking

Postby HunterZ » 2012-6-18 @ 20:32

How can you identify a sampled MT-32 sound versus other kind of sounds?
User avatar
HunterZ
l33t++
 
Posts: 6075
Joined: 2003-1-31 @ 19:04
Location: Seattle

Re: Sierra/Dynamix sound driver hacking

Postby NewRisingSun » 2012-6-18 @ 20:32

Attached find patch for Quest for Glory II. Because only two PCM sound effects are not recorded from the MT-32 (and yes, I went through all of them), just providing those two modified sound resources as separate files is the simplest option, certainly simpler than modifying the interpreter executable.

Also find MTBLAST.DRV for King's Quest I. Since in this game all PCM sound effects sound different from their respective MIDI data, no selectivity is needed. I got no static when knocking on the witch house door; if you still do, report.
HunterZ wrote:How can you identify a sampled MT-32 sound versus other kind of sounds?
Play the MIDI data on your MT-32, then play the PCM sound data. If they sound the same, minus the lower sampling rate in the PCM sound data, you know that it's been sampled from the MT-32.
Attachments
qfg2.zip
(10.22 KiB) Downloaded 584 times
kq1sci.zip
(1.95 KiB) Downloaded 639 times
Last edited by NewRisingSun on 2012-6-21 @ 17:05, edited 1 time in total.
NewRisingSun
Oldbie
 
Posts: 798
Joined: 2005-9-02 @ 02:26

Re: Sierra/Dynamix sound driver hacking

Postby ripsaw8080 » 2012-6-18 @ 22:41

Does your MTBLAST for QFG2 do something more than the others in this thread? Seems to be more-or-less the same thing with SOUND.XXX files. Granted that the separate SOUND.XXX is easier, but collector seemed to like more the idea of no extra resource files.

For my own ears, I prefer some of the other digital sounds over the MT-32 sounds, if for nothing else than the seeming lack of reverb. But it is, of course, subjective.

I tried the KQ1 MTBLAST.DRV and don't get the noise when opening the witch house door for the first time, so that's an improvement. I also tried it with SQ3 and it seems to work fine there as well. Thanks for the updated version of the driver. Do you also have a newer SNDBLAST.DRV with stereo FM for SCI0?
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4232
Joined: 2006-4-25 @ 23:24

Re: Sierra/Dynamix sound driver hacking

Postby Spikey » 2012-6-19 @ 02:24

For my own ears, I prefer some of the other digital sounds over the MT-32 sounds, if for nothing else than the seeming lack of reverb. But it is, of course, subjective.

This could also be that sometimes with MT-32 SFX, the reverb for the current song will intervene or conflict with the reverb (or lack thereof) for the SFX.

For me, the advantage is hearing them in stereo (think SQ4, the "LiftOff" sound where the starship pans in both channels) versus (relatively) low quality PCM in mono.

Attached find patch for Quest for Glory II. Because only two PCM sound effects are not recorded from the MT-32 (and yes, I went through all of them), just providing those two modified sound resources as separate files is the simplest option, certainly simpler than modifying the interpreter executable.

NRS, great to see you! Glad to see you're still around.

Excellent idea! makes a ton more sense than manually flagging each resource. I didn't think there were many other than the genie laugh, since that's all people mention.. if I may ask, what in blazes is the second one? Ad Avis screaming at the end?

Also find MTBLAST.DRV for King's Quest I. Since in this game all PCM sound effects sound different from their respective MIDI data, no selectivity is needed. I got no static when knocking on the witch house door; if you still do, report.

Very interesting as well! I had no idea all SFX were PCM. And also, genius, makes a lot more sense to just allow all SFX to be played PCM and music on the MT-32.

Great post, great thread. Thanks to Tikalat for his investigatory work also :)
User avatar
Spikey
Member
 
Posts: 223
Joined: 2003-2-04 @ 10:36
Location: South Australia

Re: Sierra/Dynamix sound driver hacking

Postby tikalat » 2012-6-19 @ 03:30

Dumping Krondor thoughts for future reference.

This is the magic routine that starts sifting through the MIDI track data (basically SCI1 MIDI-style, apart from the header).
Code: Select all
seg050:087F 50                                push    ax
seg050:0880 55                                push    bp
seg050:0881 1E                                push    ds
seg050:0882 33 F6                             xor     si, si
seg050:0884 26 C5 6F 08                       lds     bp, es:[bx+8]
seg050:0888 3E C5 6E 00                       lds     bp, ds:[bp+0]

; checks for 1-track vs multi-track (?) file (written for one device)
seg050:088C 3E 80 7E 20 FF                    cmp     byte ptr ds:[bp+20h], 0FFh
seg050:0891 74 11                             jz      short loc_33824
seg050:0893 26 80 BF 5B 01 00                 cmp     byte ptr es:[bx+15Bh], 0
seg050:0899 75 09                             jnz     short loc_33824
seg050:089B 3E 8A 4E 20                       mov     cl, ds:[bp+20h]
seg050:089F 26 88 8F 5C 01                    mov     es:[bx+15Ch], cl
seg050:08A4
seg050:08A4                   loc_33824:                              ; CODE XREF: sub_33721+F0j
seg050:08A4                                                           ; sub_33721+F8j
seg050:08A4 8B CD                             mov     cx, bp
seg050:08A6
seg050:08A6                   loc_33826:                              ; CODE XREF: sub_33721+225j

; instrument offset table
seg050:08A6 3E 8B 56 00                       mov     dx, ds:[bp+0]
seg050:08AA 83 FA 00                          cmp     dx, 0
seg050:08AD 74 36                             jz      short loc_33865
seg050:08AF 8B E9                             mov     bp, cx
seg050:08B1 03 EA                             add     bp, dx

; instrument sequence starts here
seg050:08B3 3E 8A 56 00                       mov     dl, ds:[bp+0]
seg050:08B7 80 FA FE                          cmp     dl, 0FEh ; '¦'
seg050:08BA 75 2C                             jnz     short loc_33868


The evil starts when you find out that each soundtrack piece is compressed per device. No lumping together like the SCI files.

So only the SB will have the digital PCM effects embedded in the track (Adlib / SB). Using anything else will not make them visible.

Plus the 2nd intro lightning bolt (play track #4) - doesn't even exist for non-SB. Never called or used.

Means you have use normal Adlib ($00) ID to give you the PCM. Then trick the game to use other ID ($07/ 0C) to get your normal MIDI. Game does keep music + SE in 2 separate memory segments (useful to know in figuring this out).


Some basic stuff attached - just fixes the SB init problem with fast CPUs. Has some decompressed MIDI binary blobs for others to look over. SX.OVL merger code.

=================================
=================================
=================================

Had a cheap idea for SQ3 + QFG2 driver-only versions: (inside the driver) check MIDI data and look for 3 pairs of magic bytes. Turn on/off digital as needed for matching pairs.

Bloatware. Non-award winning stuff. Only works with _original_ game. Classic amateurish. Yeah. Tikalat-style. ;)



If collector doesn't need any more specialized driver-only game hacks though, I'll call it quits for now. Do some private hobbyist stuff for awhile.
(like hack-merging a few more Sierra drivers/interpreters for my own fun or failing to do same for MI1-2)


Let the smart people take care of things. Why create more problems for myself? :p
Attachments
krondor___work.7z
(185.88 KiB) Downloaded 558 times
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Sierra/Dynamix sound driver hacking

Postby Spikey » 2012-6-19 @ 12:43

On Krondor, the game's music is designed to be heard on a SC-55, I don't think the MT-32 support is anything special, in fact, I think the MT-32 just plays the GM files with a GM SysEx bank, ala SQ5.

I think the MIDI SFX sound fine on a SC-55, but that's just me ;)
Hey, so, PCM sound effects won't play in Krondor CD version if you have GM selected? Is that right?
User avatar
Spikey
Member
 
Posts: 223
Joined: 2003-2-04 @ 10:36
Location: South Australia

Re: Sierra/Dynamix sound driver hacking

Postby HunterZ » 2012-6-19 @ 14:22

I guess you're right about Krondor. I think I lost sight of which MIDI synth was the one to use in my rage about not being able to hear the digital sounds along with it :)
User avatar
HunterZ
l33t++
 
Posts: 6075
Joined: 2003-1-31 @ 19:04
Location: Seattle

Re: Sierra/Dynamix sound driver hacking

Postby tikalat » 2012-6-19 @ 14:34

I don't think the MT-32 support is anything special, in fact, I think the MT-32 just plays the GM files with a GM SysEx bank, ala SQ5.


Attached MUNT log. Looks like plain GM-style?

Hey, so, PCM sound effects won't play in Krondor CD version if you have GM selected? Is that right?


Right you are. Same with Krondor floppy (unpatched or patched).

not being able to hear the digital sounds along with it


There's quite enough PCM-exclusive ones too. Even for cutscenes. Plus ~15-25 short speech clips.

The end of ch8 sounded so~ wrong to me - maybe it's my expectations though. Same with ch6 start (or was it 7?). Should listen to the SB track to see if it's just me.

Gunshot is used enough for SE - spells, lightning. Other areas. I want better (if PCM is better).
Attachments
krondor-mt32-munt.txt
(17.9 KiB) Downloaded 361 times
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Sierra/Dynamix sound driver hacking

Postby NewRisingSun » 2012-6-19 @ 16:47

tikalat wrote:The evil starts when you find out that each soundtrack piece is compressed per device. No lumping together like the SCI files.
That doesn't seem to be the case. Unless I am completely mistaken, all sound and music is in an archive with the extension .SX, with each tune compressed with the LZHUF compression algorithm. The decompression code is just written to skip unwanted bytes instead of adding them to the decompressed data buffer.

The cleanest way is still to just add the reference to the PCM track to the track lists of devices [h] and [m] (07 and 0C). Then the .SX archive needs to be rebuilt and put into the game directory to be used as a replacement of the original file encapsulated in KRONDOR.001.

Spikey wrote:I didn't think there were many other than the genie laugh, since that's all people mention.. if I may ask, what in blazes is the second one?
Something that sounds like a crossbow.
Last edited by NewRisingSun on 2012-6-19 @ 18:50, edited 1 time in total.
NewRisingSun
Oldbie
 
Posts: 798
Joined: 2005-9-02 @ 02:26

Re: Sierra/Dynamix sound driver hacking

Postby tikalat » 2012-6-19 @ 17:29

Looking over the list at the end of FRP.SX, that looks like all the names. Working backwards from the driver, I wouldn't have ever noticed that - they seemed to keep massaging the data over and over. Never got a complete soundtrack of all devices per tune - just separately. Chased those bytes around and never figured out where they were coming from.

The cleanest way is still to just add the reference to the PCM track to the track lists of devices [h] and [m] (07 and 0C). Then the .SX archive needs to be rebuilt and put into the game directory to be used as a replacement of the original file encapsulated in KRONDOR.001.


I can wait many more years to pick this up again. My interest in DOS-related hacking just got completely drained.

Thanks for looking into this though. I'm sure others will become motivated to finish this.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Sierra/Dynamix sound driver hacking

Postby HunterZ » 2012-6-19 @ 20:24

This sounds a bit over my head. I'm glad I got enough other people fired up about it to make more progress than I could have ever hoped to :)
User avatar
HunterZ
l33t++
 
Posts: 6075
Joined: 2003-1-31 @ 19:04
Location: Seattle

Re: Sierra/Dynamix sound driver hacking

Postby NewRisingSun » 2012-6-19 @ 21:55

All right, dearly beloved. I don't know this game at all, so this may be completely wrong after the title sequence, but I can now get General MIDI sound with PCM samples.

KRONDOR.EXE must be modified so that it even bothers to call up AUDBLAST.DRV with any RESOURCE.CFG entry other than SNDBLAST.DRV. The modification could be done more elegantly; right now it is forced to always load AUDBLAST.DRV, no matter the setting.

SX.OVL includes an AUDBLAST.DRV that doesn't fail to initialize on faster machines. Inappropriate trivia: the IRQ check routine that always fails wasn't done by Sierra but just copied from Creative Labs' very first Sound Blaster SDK.

FRP.SX has the sound resources modified so that PCM tracks are included in the [h] and [m] track lists as well.

I have only tried it with some "free download on Sierra's website to promote the game Betrayal in Antara" that's dated 1997 (readme file says "Betrayal at Krondor FREE RELEASE, Version 1.02"), so beware.
Attachments
krondor.zip
(1 MiB) Downloaded 985 times
NewRisingSun
Oldbie
 
Posts: 798
Joined: 2005-9-02 @ 02:26

Re: Sierra/Dynamix sound driver hacking

Postby tikalat » 2012-6-19 @ 22:33

I'm quite shocked. And stunned.

Digital effects are correct - act1. Intro. Act1 in-game. Battles. Must try more later. MIDI sounds spot-on.

That was a mighty damn fast job!! There is a god.


(Unpatched CD exe)


edit:
Thank you so very much!!!! Act1 = "Hold there!" (thought it was "Hello there!" - bad memory)

Going to make a speech list because of this. :)



edit2:
Okay did some more testing comparisons. Gen Midi music is correct - choirs, percussion, themes. Special digital SE are right - definitely better than some of the synth ones.


Battles - Alistair is right. I remember digital but listening much closer, I can sort out the Adlib synth. So SC-55 synth it is! (already correct).

Now if Alistair could give NewRisingSun the sound files with the corrected SQ5 drum program #s, he'd have performed 3 miracles in a mere week with that release.



edit3:
Should also mention that my 1.02 CD saves do load with NewRisingSun's EXE. Be warned though!

From EXE strings:
- CD = Version 1.02 CD
- Floppy 1.0 -> 1.2 patch = Version 1.2
- Antara = Version 1.00 (....? that's weird)



edit4:
40 lines of speech.
Attachments
krondor_speech.txt
(1.68 KiB) Downloaded 362 times
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Sierra/Dynamix sound driver hacking

Postby Spikey » 2012-6-20 @ 02:30

Attached MUNT log. Looks like plain GM-style?

Yeah, the CS in "CS_HARP" stands for Chris Stevens, who made a MT-32 patch bank to emulate the GM sounds. It's pretty horrible though (listen to Krondor or SQ5 on a MT-32 and you'll see why!), I don't know why they didn't just use the Sierra one.. Although it's far from perfect too.

Right you are. Same with Krondor floppy (unpatched or patched).

OK, neat. Well, now NRS has fixed it, anyway ;)

There's quite enough PCM-exclusive ones too. Even for cutscenes. Plus ~15-25 short speech clips.

The end of ch8 sounded so~ wrong to me - maybe it's my expectations though. Same with ch6 start (or was it 7?). Should listen to the SB track to see if it's just me.

Gunshot is used enough for SE - spells, lightning. Other areas. I want better (if PCM is better).

Sure. Krondor is a game where the SFX would be preferable in PCM because it's not a MT-32 game natively. I wonder if any other GM games fall into this category..That have the problem that is.


Now if Alistair could give NewRisingSun the sound files with the corrected SQ5 drum program #s, he'd have performed 3 miracles in a mere week with that release.

I'm pretty sure NRS already knows which are which, i think he told me originally ;) But I'm happy to supply him with the track names if he has time and needs the info.

My main NRS project I want completed someday is Willy Beamish with CD version and MT-32 support, but we'll see. :) He's done so much for me I should dedicate my website in his honour- hey, maybe I'm onto something.. ;) We'll see, 10th anniversary coming up.
User avatar
Spikey
Member
 
Posts: 223
Joined: 2003-2-04 @ 10:36
Location: South Australia

Re: Sierra/Dynamix sound driver hacking

Postby HunterZ » 2012-6-20 @ 05:00

I thought there was a newer patch version of Krondor than what was released for free?
User avatar
HunterZ
l33t++
 
Posts: 6075
Joined: 2003-1-31 @ 19:04
Location: Seattle

Re: Sierra/Dynamix sound driver hacking

Postby NewRisingSun » 2012-6-20 @ 05:41

The MTBLAST patch for Willy CD was never finished because Cloudschatze mentioned that although most things work, some sound effects were missing. I can't find anything wrong from listening to the introduction, so here goes. Report if you find something missing.

EDIT: Uploaded new version.

HunterZ wrote:I thought there was a newer patch version of Krondor than what was released for free?
Point me to it, and I'll patch that as well.
Attachments
willycd.zip
(143.58 KiB) Downloaded 684 times
Last edited by NewRisingSun on 2012-6-21 @ 17:05, edited 3 times in total.
NewRisingSun
Oldbie
 
Posts: 798
Joined: 2005-9-02 @ 02:26

Re: Sierra/Dynamix sound driver hacking

Postby tikalat » 2012-6-20 @ 12:45

1.02 floppy upgrade
http://www.sendspace.com/file/6550vn


edit:
1.02 floppy patched exe (based on NewRisingSun patch)
(use with official package earlier - SX.OVL + FRP.SX)


edit2:
Added 1.02 cd patched exe


CS in "CS_HARP" stands for Chris Stevens


Oh! Thought it meant "Custom Sound". Then MS = Mark Seibert? Seen those initials enough.


I wonder if any other GM games fall into this category..That have the problem that is.


That's a good question.


My main NRS project I want completed someday is Willy Beamish with CD version and MT-32 support, but we'll see. Happy He's done so much for me I should dedicate my website in his honour- hey, maybe I'm onto something.. Wink We'll see, 10th anniversary coming up.


Only did Beamish once on Sega CD. Not familiar at all memory-wise.

I think he's worthy of a tribute - basically done more than most of us could combined. :approval:



Now I get this itch to do some Scumm game that I've heard about a unused feature but never had the skill to bother. With all that open-source work, should be easier. :)
Last edited by tikalat on 2013-7-14 @ 01:29, edited 1 time in total.
tikalat
Member
 
Posts: 287
Joined: 2012-4-13 @ 16:39

Re: Sierra/Dynamix sound driver hacking

Postby NewRisingSun » 2012-6-20 @ 16:13

I've only sent this out via private message so far. This patch for SQ5 allows for using all sixteen MIDI channels on General MIDI, so that the Glockenspiel and the Reverse Cymbal no longer get cut off by the Alert sound during the flight simulator sequence in the introduction. And drum map changes are now sent to the output device. New compared to the version I sent out privately is automatic remapping of illegal drum map numbers to the ones recognized by GS level 1, which is required to get them to sound right on later Sound Canvases. 4.PAT adds a voice reserve sysex to better make use of the sixteen MIDI channels, and ADL.DRV is the stereo FM driver.

tikalat wrote:There is a god.
No, there isn't.
Spikey wrote:He's done so much for me I should dedicate my website in his honour- hey, maybe I'm onto something..
Don't do anything that I wouldn't do.
HunterZ wrote:I thought there was a newer patch version of Krondor than what was released for free?
Could someone please provide an overview of all the versions and patches to this silly game? The websites on this game are confusing as hell, why with the "free" version not really being free and supposedly bugged, and some patch originally being an update to a floppy version but also fixing bugs in the free version, and similar incomprehensible gibberish.
Attachments
sq5.zip
(68.69 KiB) Downloaded 604 times
NewRisingSun
Oldbie
 
Posts: 798
Joined: 2005-9-02 @ 02:26

PreviousNext

Return to DOS

Who is online

Users browsing this forum: No registered users and 0 guests