HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: mzso on 2013-11-14 23:14:27

Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2013-11-14 23:14:27
Hello!

I want to convert or play some old video game files. Apparently there were some tools that did that but everything'a been removed since then. I only found this (http://www.winamp.com/plugin/final-fantasy-viii-plug-in-1-1/171287) that claims to play .sgt files, but it crashes winamp. I'm guessing it's missing some dll-s which I don't know where to get...
Also apparently the darned directmusic composer isn't available anywhere since microsoft removed it from their website.
So at this point I'm lost...
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: kode54 on 2013-11-14 23:54:38
If you or I can locate any information on the format, I could possibly add it to my MIDI processor library, which could then translate them to general MIDI format, as well as play them directly.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2013-11-15 02:17:10
That'd be cool. Although I'm not optimistic, microsoft doesn't have many documented formats.
I at best saw guides to using music stuff but nothing of the format itself.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: kode54 on 2013-11-15 04:58:37
I wasn't assuming that Microsoft documented it, I was assuming that some other clever programmer had beaten me to the punch and saved me some trouble.

For instance, Peter Pawlowski did make a DirectMusic plug-in for Winamp years ago, although I don't know if he still has the source code to that anywhere.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2013-11-15 12:36:15
I wasn't assuming that Microsoft documented it, I was assuming that some other clever programmer had beaten me to the punch and saved me some trouble.

For instance, Peter Pawlowski did make a DirectMusic plug-in for Winamp years ago, although I don't know if he still has the source code to that anywhere.

Really? Is it still available somewhere?

Edit:
Is this relevant: http://msdn.microsoft.com/en-us/library/wi...7(v=vs.85).aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/dd551277(v=vs.85).aspx) ?
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2013-11-19 11:59:37
I'm guessing Peter doesn't hang around this section much...

Anyway I dug up directmusic composer. And now I remember why I gave up years ago. I can't get it to export audio to wav. There's a record button that apparently does nothing. There's an export to wav option, but it doesn't output anything, ever no matter what I play in the program.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2013-11-19 13:30:10
I meant to say "DirectMusic Producer"
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: CoRoNe on 2013-11-19 20:55:27
A week ago I reinstalled 'No One Lives Forever' just for fun. A game that uses DirectMusic (dls-files).
These files can indeed only be opened with DirectMusic Producer, which doesn't have an export function.
If foobar (through plugin) could be made to play these, that would be really great.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: DVDdoug on 2013-11-19 22:05:46
If you can play the file, you can record it.

If your soundcard/driver supports "What-U-Hear" or "Stereo Mix", you can record internally using any recording software (Audacity will work fine). 

If you have a desktop computer, you can run a loopback cable from line-out to line-in, and record line-in.  If you want to listen while looping-back, you need a Y-adapter (splitter) to keep your speakers connected.

Or, there is a program called Total Recorder that can record "what you hear" internally even if your soundcard/driver doesn't directly support it. 
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2013-11-19 22:30:40
If you can play the file, you can record it.

If your soundcard/driver supports "What-U-Hear" or "Stereo Mix", you can record internally using any recording software (Audacity will work fine). 

If you have a desktop computer, you can run a loopback cable from line-out to line-in, and record line-in.  If you want to listen while looping-back, you need a Y-adapter (splitter) to keep your speakers connected.

Or, there is a program called Total Recorder that can record "what you hear" internally even if your soundcard/driver doesn't directly support it.

It'd take an exorbitant amount of time, because the music is in sgt pieces. Also I'm not sure if wheter there's a quality reduction (Which isn't that hot to start with) if I capture something from the sound card.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2014-02-21 19:23:50
I wasn't assuming that Microsoft documented it, I was assuming that some other clever programmer had beaten me to the punch and saved me some trouble.

For instance, Peter Pawlowski did make a DirectMusic plug-in for Winamp years ago, although I don't know if he still has the source code to that anywhere.

Hello!
Did you look into it?
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: CoRoNe on 2015-01-27 00:55:13
Hi kode54, do you have any news on this subject? Have you perhaps contacted this Peter Pawlowski guy in the last 14 months?
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2015-01-27 01:03:43
There's this small program (https://mega.co.nz/#!M5w22ISS!LlGOM2rKL7rwBDqxEbCMAHsBEk5XVnXxQfhmtSd7etE) which came with some toolkit for No One Lives Forever I think. It reads/plays the directmusic files from within .REZ files of the game.
Would it be any help in deciphering the format?
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: kode54 on 2015-01-27 05:01:54
I did not contact Peter regarding the format, as I forgot. You may contact him if you wish, he uses the account name "Peter" on these forums, and is currently busy with foobar2000 Mobile. I can ask him on IRC tonight, but I'm not sure if he'll remember what he did with the source code to that old component.

Any closed source Windows program would probably not be that useful, since they're probably using the old DirectMusic runtime to play the files, and not actually handling the formats themselves.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2015-01-27 09:53:17
Any closed source Windows program would probably not be that useful, since they're probably using the old DirectMusic runtime to play the files, and not actually handling the formats themselves.

I see. I was assuming it didn't because I installed nothing of the sort. Now that you pointed it out, I can see in process explorer that it loads dmusic.dll and multiple other dm*.dll-s from syswow64. So I guess it still comes with windows.

Hi kode54, do you have any news on this subject? Have you perhaps contacted this Peter Pawlowski guy in the last 14 months?

I'm assuming you didn't have any luck finding the mentioned directmusic plugin by Peter for Winamp either, right?
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: Reiginsei on 2015-01-27 13:21:31
Google "directmusic producer hitman"

The technique to export to wav apparently was only tested on an older version of DirectMusic Producer, so it may not work if you use the latest dx9 version.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2015-01-27 14:05:31
Google "directmusic producer hitman"

The technique to export to wav apparently was only tested on an older version of DirectMusic Producer, so it may not work if you use the latest dx9 version.

I think I had the old one when I tried. But only ever got an empty file.
Might have tried this guide, I've been messing around with it for quite a while.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: CoRoNe on 2015-01-27 22:01:54
@kode54: Ooooh, Peter... foobar2000's author!

I'm assuming you didn't have any luck finding the mentioned directmusic plugin by Peter for Winamp either, right?
You mean this one (http://www.un4seen.com/forum/?topic=10196.msg111730#msg111730)? I haven't used WinAMP in ages, because I stopped using it, but when I just installed it to test the plugin, it instantly crashed on me. WinAMP itself, as well as the plugin.

This website (http://www.vgmpf.com/Wiki/index.php?title=SGT) looks interesting. It mentions the WinAMP plugin, DirectMusic Producer and Simple DirectMusic Player (which I both can't get to work), and FMOD. I guess you could give FMOD Studio (102MB!) a try.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2015-01-28 00:34:10
@kode54: Ooooh, Peter... foobar2000's author!

I'm assuming you didn't have any luck finding the mentioned directmusic plugin by Peter for Winamp either, right?
You mean this one (http://www.un4seen.com/forum/?topic=10196.msg111730#msg111730)? I haven't used WinAMP in ages, because I stopped using it, but when I just installed it to test the plugin, it instantly crashed on me. WinAMP itself, as well as the plugin.

This website (http://www.vgmpf.com/Wiki/index.php?title=SGT) looks interesting. It mentions the WinAMP plugin, DirectMusic Producer and Simple DirectMusic Player (which I both can't get to work), and FMOD. I guess you could give FMOD Studio (102MB!) a try.

Yeah I found that. Not sure if that's the one. Anyway, it needs to be configured. But I got access violations when I tried creating a profile in it's config. Anyways it doens't look like it's much good for nolf(which is what I was interested in).
You can only load one dls no sty. And there seems to be a lot of other configuration missing here in the Control Files for nolf music.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: kode54 on 2015-01-28 02:18:30
I talked with Peter last night. He lost the source code, but definitely knows that it did not understand the formats themselves. It was split off of in_midi because it required the DirectMusic runtime to decode the files, while everything else in_midi supported dealt with Standard MIDI streams.

You may be best looking into whether either of the Wine or ReactOS projects has implemented DirectMusic yet.
Title: Is there a way to play/convert directmusic sgt/dls files?
Post by: anyeos on 2015-08-05 16:21:47
Hey guys, I guess I can help (if you are under Linux):


If you are under Linux use first winetricks to install all the necessary libraries. Specially choose dmusic. Follow some Wine videogame with DirectX guide if you don't know what you need or how to do it.

Next, search on internet for a program called "Vista MIDI Fix.exe".

Run it and you will get a dialog to choose the default MIDI output for your "Windows" system.

You can choose your real ports (or just use timidity as virtual port), so you can use any real hardware output and redirect it to some hardware input (with a MIDI wire) where you can record the midi output produced by any game (in my case Final Fantasy VIII). Or you can try using some virtual software port where you can dump all the MIDI events to some file or program.

Final Fantasy VIII use the infamous .sgt files too.

I didn't tried nothing more. I am actually playing Final Fantasy VIII with music working over timidity (as a virtual midi port).

I guess we can use some virtual midi port with jack or some other audio application under Linux where we can eventually capture the MIDI events. It will work because timidity only supports standard MIDI events and it is working as expected. In some way DirectMusic is working with the game in that manner (as I know this game only supports DirectMusic).

Anyway if you run the dxdiag program in the tab where you can test Music it will eventually play the music (note that your option will not be displayed as default "yes", I don't know why, maybe it is for older versions of games using DirectMusic, but it works anyway).

I don't know who made that "Vista MIDI Fix.exe" and it will not be easy to find but works. Of course, under your own risk (I don't know if that program had virus, troyans, and so, almost as I know my Wine installation is working as expected). Please, don't give me any responsibility if you get in trouble, I advised you.

Bye
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: frabert on 2018-02-27 12:38:46
Hi everyone, sorry to resume such an old thread, but this is one of the first pages I found while searching for this very topic, so I thought it might be useful to people looking for info on this in the future.
I am working on a library to load and render DirectMusic file without the use of DirectX nor Wine; you can check it out here (https://github.com/frabert/libdmusic).
Bye!
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2018-02-27 14:40:22
Hi everyone, sorry to resume such an old thread, but this is one of the first pages I found while searching for this very topic, so I thought it might be useful to people looking for info on this in the future.
I am working on a library to load and render DirectMusic file without the use of DirectX nor Wine; you can check it out here (https://github.com/frabert/libdmusic).
Bye!
Cool!
So I could use dmrender to convert sgt files that NOLF uses to wav? (Are you per chance familiar with the game?)
With all the spatial sound effects and all?

Does it only render on file at the time? The has a crapload of .sgt files, it might take a long time to convert them one, by one and join them.
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2018-02-27 16:46:12
Oh, wait. There are no builds of dmrender/dmplay.
Could you provide some executables that one could try?
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: frabert on 2018-02-27 19:36:36
Oh, wait. There are no builds of dmrender/dmplay.
Could you provide some executables that one could try?
Hi mzso :) You can find prebuilt binaries up to date with the current master commit at https://ci.appveyor.com/project/frabert/libdmusic/build/artifacts

Also, you could use dmrender in a batch file and render the files sequentially, but you should be aware that the library is - right now - more geared towards being integrated in game engines and the like, so sgt files are meant to be looped, not rendered as a single file. As a result, you have to specify the length of the rendered section.

I am afraid I am not familiar with NOLF...
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2018-02-27 20:21:29
Oh, wait. There are no builds of dmrender/dmplay.
Could you provide some executables that one could try?
Hi mzso :) You can find prebuilt binaries up to date with the current master commit at https://ci.appveyor.com/project/frabert/libdmusic/build/artifacts

Also, you could use dmrender in a batch file and render the files sequentially, but you should be aware that the library is - right now - more geared towards being integrated in game engines and the like, so sgt files are meant to be looped, not rendered as a single file. As a result, you have to specify the length of the rendered section.

I am afraid I am not familiar with NOLF...
Thanks. I gave dmplay a try, by attempting to play the extracted audio files from said game. But I only got a crash at first. It seems like dmplay can't handle either spaces or non-ascii characters in the path. (which is quite sad in this day and age.)

Anyway. After I worked around that bug I got:
Code: [Select]
Loading segment... done.
Start playback...  done.
Begin rendering... Rendering started. Insert the next segment to be played, or 'exit' to end playback.
And it stays like this.
But I don't get any sound. Not looped or anything, nothing at all.
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: frabert on 2018-02-27 20:27:29
Could you elaborate on the issue with non-ascii characters? I am actually quite interested in supporting non-ascii paths on multiple platforms, so this is definitely a bug. Also, could you contact me via eMail (it's on my profile) in case you are interested in helping me with rendering those files? I am going to need the files for tests, but I do not have a game copy handy
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2018-02-27 20:37:18
Could you elaborate on the issue with non-ascii characters? I am actually quite interested in supporting non-ascii paths on multiple platforms, so this is definitely a bug. Also, could you contact me via eMail (it's on my profile) in case you are interested in helping me with rendering those files? I am going to need the files for tests, but I do not have a game copy handy
Hmm... At first I couldn't reproduce it, so it doesn't happen in all instances, but here's how I got a crash:

Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2018-02-27 20:48:49
Update:
I sent an e-mail
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: zeaofsuos on 2019-01-29 23:02:14
Oh, wait. There are no builds of dmrender/dmplay.
Could you provide some executables that one could try?
Hi mzso :) You can find prebuilt binaries up to date with the current master commit at https://ci.appveyor.com/project/frabert/libdmusic/build/artifacts

Also, you could use dmrender in a batch file and render the files sequentially, but you should be aware that the library is - right now - more geared towards being integrated in game engines and the like, so sgt files are meant to be looped, not rendered as a single file. As a result, you have to specify the length of the rendered section.

I am afraid I am not familiar with NOLF...

frabert, How do you get this libdmusic software of yours to run? There are no executables?
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: mzso on 2019-01-30 10:08:07
frabert, How do you get this libdmusic software of yours to run? There are no executables?

You can find builds here: https://github.com/frabert/libdmusic/releases

Though the last time I checked it didn't play files all that well.
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: kode54 on 2019-08-23 01:17:08
Looks like we got a mention, and maybe I can add some more helpful information about that Winamp plugin I mentioned before.

https://www.youtube.com/watch?v=gVPxPBcVDzI

@Peter, who is also the author of foobar2000, made the MIDI plugin for Winamp under contract, and also cracked several obscure MIDI formats from old games back in the day.

He also made a DirectMusic plugin for Winamp. This DirectMusic plugin either played the audio without touching Winamp's output plugins or DSPs or visualization, or it used a really dirty hack that only worked for real-time playback. Basically, DirectMusic also let you pass it your own DirectSound object(s) for output instead of letting it create its own output devices, and he crafted a fake DirectSound output device that just passed sample data to the plugin and eventually to the player, and passed an instance of this device to DirectMusic. Dirty hack. Apparently it was also prone to crashes? But I'm not sure.

This new libdmusic thing is probably way closer to working on anything recent, or on anything other than Windows. It's also a likely step toward Wine supporting the DirectMusic APIs, and maybe writing a shim for running old games on newer Windows systems.
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: oblivioncth on 2020-04-18 03:49:42
Although utilities like libdmusic will ultimately end up being much more convinent to use, I did just want to make it clear for the record that there is a way to render directly to WAV from within DirectMusic Producer. While use of this feature is far from intuitive (par for the course for software from 2001), the built in Help documentation is actually half decent, which funny enough is much less true these days, if even present at all for a given tool.

This is the last version that was created and works for me under Windows 10 1909 with no modifications: http://files.rajko.info/dx90_directmusicproducer.exe

The documentation states that the record to WAV feature at the bottom that the mzso mentioned is supposed to be inaccessible unless everything is set up correctly to use it, which does not seem to be the case and is quite possibly an oversight.

In order for it to work you have to set up a custom "Audiopath" that uses the "FileOutput" effect, by clicking New->Audiopath once you have a project created/opened. I suggest selecting the option to base yours off of one of the existing ones, I named mine "Direct2Wave", name doesn't matter, then in its settings (get there by double clicking the .aup file that was created (it should bring them up automatically).

Right click on it on the list and remove the Standard Buffer, the right click and hit Insert Buffer, then right click on the buffer that was added and select Add/Remove Buses so you can choose if you want stereo or mono recording. Then right click on the buffer again and select Properties and check "Share buffer with other audiopaths" and "Enable Doppler Effect/SetFrequency". I'm not entirely sure what these settings do (the Help documentation covers those topics) but all the default Audiopaths used them so I turned them on. Finally, all the way on the right drag the "FileOutput" effect into the buffer and it then should show up with a FileOutput1 instance under the Effects list.

Now you are ready to record. First, in the upper left dropdown for Audiopaths change from whichever standard one the program is set as to the one you just created. Then, at the bottom click the "..." next to the symbol of an audio waveform (the one to the right of that is for recording to MIDI) and provide an output filename and path.

When you are ready, click the waveform button to start recording and then procceed to make whatever sound you want within the program. Play the SGT directly using the play button at the top, click a note on a key in the SGP editor, play a sample/instrument in the DLS editor, etc. and when you are finished click the waveform icon again. You should get a WAV with everything you just did at the location you set. Worked for me anyways.

This is especially useful for recording SGTs used as sound effects that have pitch or effect variations that are changed to using RNG as you can see which key note corresponds to each variation (1 through 32 possible) and hit each of those exact keys to get all of the varations while you're recording.

I don't know how libdmusic handles SGTs with variations since I haven't tried it yet as I wrote a MATLAB script to help me process the WAV output for use in another game after it is recorded from DMP because it was before I had found this thread.
Title: Re: Is there a way to play/convert directmusic sgt/dls files?
Post by: JayYA on 2023-05-25 05:07:32
Although utilities like libdmusic will ultimately end up being much more convinent to use, I did just want to make it clear for the record that there is a way to render directly to WAV from within DirectMusic Producer. While use of this feature is far from intuitive (par for the course for software from 2001), the built in Help documentation is actually half decent, which funny enough is much less true these days, if even present at all for a given tool.

This is the last version that was created and works for me under Windows 10 1909 with no modifications: http://files.rajko.info/dx90_directmusicproducer.exe

The documentation states that the record to WAV feature at the bottom that the mzso mentioned is supposed to be inaccessible unless everything is set up correctly to use it, which does not seem to be the case and is quite possibly an oversight.

In order for it to work you have to set up a custom "Audiopath" that uses the "FileOutput" effect, by clicking New->Audiopath once you have a project created/opened. I suggest selecting the option to base yours off of one of the existing ones, I named mine "Direct2Wave", name doesn't matter, then in its settings (get there by double clicking the .aup file that was created (it should bring them up automatically).

Right click on it on the list and remove the Standard Buffer, the right click and hit Insert Buffer, then right click on the buffer that was added and select Add/Remove Buses so you can choose if you want stereo or mono recording. Then right click on the buffer again and select Properties and check "Share buffer with other audiopaths" and "Enable Doppler Effect/SetFrequency". I'm not entirely sure what these settings do (the Help documentation covers those topics) but all the default Audiopaths used them so I turned them on. Finally, all the way on the right drag the "FileOutput" effect into the buffer and it then should show up with a FileOutput1 instance under the Effects list.

Now you are ready to record. First, in the upper left dropdown for Audiopaths change from whichever standard one the program is set as to the one you just created. Then, at the bottom click the "..." next to the symbol of an audio waveform (the one to the right of that is for recording to MIDI) and provide an output filename and path.

When you are ready, click the waveform button to start recording and then procceed to make whatever sound you want within the program. Play the SGT directly using the play button at the top, click a note on a key in the SGP editor, play a sample/instrument in the DLS editor, etc. and when you are finished click the waveform icon again. You should get a WAV with everything you just did at the location you set. Worked for me anyways.

This is especially useful for recording SGTs used as sound effects that have pitch or effect variations that are changed to using RNG as you can see which key note corresponds to each variation (1 through 32 possible) and hit each of those exact keys to get all of the varations while you're recording.

I don't know how libdmusic handles SGTs with variations since I haven't tried it yet as I wrote a MATLAB script to help me process the WAV output for use in another game after it is recorded from DMP because it was before I had found this thread.

Thanks for the effort, but I still don't know how to use it when I download it (that's my problem) and I don't even know how to install it.