vgmrips

The forum about vgm files
It is currently 2017-12-12, 19:48:35

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: FM OPL Midi Player
PostPosted: 2015-02-14, 14:24:32 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Offline
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 2883
Location: Germany
When MaliceX mentioned my MIDI Player recently, I noticed that it never had an offical release.
There is a link to it in a post dealing with fixed Sonic & Knuckles PC MIDIs, but else I only posted it in IRC.

So, this is the offical release of MidiPlay, my FM OPL MIDI Player.
You can download the Win32 Binary and you can also get the source code (includes VC6 project files)
The archive with the binary contains various instrument sets and a few .txt files related to the research I did.

The MIDI player focuses on support for usual MID files, but CMF and LAA (Lucas Arts songs, v1+v2) also work.
Controls are similar to VGMPlay (because it's based on it), i.e. cursor keys for seeking, ESC quits, Space pauses, 'F' fades out and 'R' restarts the song.
You can enable WAV and VGM logging by editing the .ini file. (VGM logging locks the sample rate to 44100 Hz, btw.)
If you have an OPL sound card, you can play the MIDIs on it directly, too. (for Windows NT/2000/XP you need to install PortTalk)

MIDI support
The initial implementation was based on observations from the Windows OPL driver, but there are various improvements:
  • Modulation Wheel and Expression
  • pan law volume compensation (makes hard-panned channels slightly louder to make up for the missing speaker)
  • RPNs for Pitch Bend Range and Fine/Coarse Detune
  • Sustain Pedal (was half-broken in WinFM driver) and Sostenuto
  • multiple drum channels via SysEx events (GS mode) and Bank MSB (XG mode)
  • SysEx messages for GM Master Volume and XG Master Volume/Detune/Transpose
The improvements can be disabled by editing the .ini file. (e.g. for playing back the S&K PC MIDIs)
The drum pitch table is currently hardcoded and based on SB16.VXD from Creative's Win95 driver. I know that Windows 2000/XP uses a different table (actually none, it just uses the drum note ID as drum frequency). The one used in Windows 3 is different as well.

CMF support
All common controllers are supported, polyphony is possible. A few things behave differrently from the official SBFMDRV.COM though. Especially the volume calculation is off.

LAA support
LAA v1: sounds accurate, but lacks software vibrato
LAA v2: I'm pretty sure that the instruments are off. The volume calculation (although ported from ScummVM) seems questionable and there's no software vibrato. Pressing 'S' executes the next conditional jump.

I haven't worked on it since January 2013, so there are still a few bugs in it. IIRC it can crash sometimes when seeking through MIDIs that make heavy use of the sustain pedal or don't terminate notes properly.

Anyway, enjoy listening to MIDIs as they sounded back in Windows 95!


Top
 Profile  
 
 Post subject:
PostPosted: 2015-02-15, 10:21:16 

Musicians Musicians
Contributors Contributors
Offline

Joined: 2012-09-29, 11:45:48
Posts: 211
Location: Australia
Nice to see this finally being released. ;)

_________________
-dj.tuBIG/MaliceX


Top
 Profile  
 
 Post subject:
PostPosted: 2015-06-06, 23:58:03 
Offline

Joined: 2015-06-06, 23:44:58
Posts: 1
Thanks a lot ValleyBell and MaliceX. I've been looking for something like this since my PIII died in 2010 :(
Both emulators sounds almost exactly as I remember.

malice, if you're reading this: where can we get the latest binary for the user mode driver?


Top
 Profile  
 
 Post subject:
PostPosted: 2015-06-07, 8:04:26 

Musicians Musicians
Contributors Contributors
Offline

Joined: 2012-09-29, 11:45:48
Posts: 211
Location: Australia
andre wrote:
Thanks a lot ValleyBell and MaliceX. I've been looking for something like this since my PIII died in 2010 :(
Both emulators sounds almost exactly as I remember.

malice, if you're reading this: where can we get the latest binary for the user mode driver?


There's a separate thread for it here (although yes it is lacking in updates): viewtopic.php?f=15&t=1167

It needs to go through a rewrite. I've come across some serious issues with strange memory corruption issues and such with my fork of khokh2001's user mode driver. Difficult to debug.

_________________
-dj.tuBIG/MaliceX


Top
 Profile  
 
PostPosted: 2015-06-15, 23:15:46 
Offline
User avatar

Joined: 2015-06-08, 20:42:22
Posts: 30
Location: Argentina
Hello, ValleyBell. I am very pleased with your work and I already converted some of my old MIDIs into VGM to play them on my phone! (and save space by ditching unnecessary streaming audio formats :wink:)

Now, I found a few issues with the OPL3 emulation: instruments with certain volumes get lost in the mix, which didn't happen with MaliceX's OPL3 User Mode driver, or at least not that I remember. My most legit reference is a Pentium 1 at 100 MHz with Windows 95 and Sound Blaster 16 CT2230 that I used to have (I still have the sound card with me), and I don't remember having had volume issues with the MIDIs in question. Save for a few polyphony issues (and the fact that my sound card didn't support - or didn't have the drivers to support sustain pedal and volume changes on notes already playing, back in the day), MaliceX's driver seemed to be more accurate to me in terms of volume and, most noticeably to me, the sound of the drums. Both yours and MaliceX's kick drum are perfect, but the toms are different and the ones in the OPL3 User Mode driver seemed more accurate to me.

The point being: is there any way MidiPlay can support other FM based GM/GS/XG banks, or convert banks used by other FM based applications or games with FM sound? I'm particularly interested in being able to use banks included in htsfms, like the one that I used for making this cover of Turbulence from Dune: The Battle For Arrakis.

Thanks a lot for making such an awesome program! Keep it up! :D


Top
 Profile  
 
 Post subject:
PostPosted: 2015-06-16, 12:10:08 

Musicians Musicians
Contributors Contributors
Offline

Joined: 2012-09-29, 11:45:48
Posts: 211
Location: Australia
htsfms is a completely different beast altogether as far as its algos are concerned, and wouldn't be compatible with OPL3 register commands.

I think the only reason mine sounded different is because I was using khokh2001's OPL3 core instead of DOSBOX's. The volume is probably more "accurate" (in terms of resembling the Win95/98 FM stuff in its full cruddy glory) on my one because it was directly taken from Windows' reference code. :P Have you tried enabling the WinFM volume modes on MidiPlay?

I can't remember if there were any differences with the tom patches on the Windows VxD patch set, but I recall it was something like a different pitch or something.

_________________
-dj.tuBIG/MaliceX


Top
 Profile  
 
 Post subject:
PostPosted: 2015-06-16, 14:55:53 
Offline
User avatar

Joined: 2015-06-08, 20:42:22
Posts: 30
Location: Argentina
I have the WinFM mode set by default for my MIDIs to sound as authentic SB16 as possible (without newly added controller support). I also tried the VxD reading Win95 (the one I attached in this message) and it sounds really, really weird, like it's not even meant to be used as a GM bank.

Admin edit: Removed fullquote.


Attachments:
SB16_VXD_DrumNote_Win95.zip [370 Bytes]
Downloaded 98 times
Top
 Profile  
 
 Post subject:
PostPosted: 2015-06-16, 20:39:34 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Offline
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 2883
Location: Germany
You can use other FM banks, if you convert them to the right format. That requires some knowledge about OPL FM instruments though.
Each instrument is 1Ch bytes long. The order of the operator bytes is:
20 40 60 80 E0 23 43 63 83 E3 (for bytes 00h-09h)
Operator C0 is at offset 18h, the other bytes are ignored by MidiPlay.

The volume calculation might be slightly inaccurate, because I'm using an approximation of the original look-up-table. I also ignore the "base volume" of the FM instruments - not sure if the original FM driver does that. Both things might make a few instruments louder than in the WinFM driver. (Now that I think of it - I ommitted the *0.9 factor on the volumes to make everything louder. That might break the volume relation a little, since that factor is applied to the logarithmic volume values.)
The reimplementation is based on observations made by listening to the Windows 2000 FM driver, btw, which has cheap support for the sustain pedal (releasing it stops all notes on the channel) and supports changing the volume of playing notes. I can confirm that, with the SB16 driver, at least the volume changes don't have an immediate effect.

The polyphony issues might come from the fact that I use a more complex algorithm to determine the channel the next note should play on.

The pitch of the drums is an interesting thing, btw. MidiPlay currently uses the pitches I extracted from SB16.VXD, but they are hardcoded into the .exe. (search for 23 23 34 30) It doesn't read them from an external file - SB16_VXD_DrumNote_Win95.bin is provided just for reference.
From what I've observed Windows 2000 uses the drum's note ID has pitch value. (23 24 25 26 etc.) The Windows 3.1 driver seems to use even different pitch values that I haven't researched yet. So far I prefer the Win95 ones, btw.


Top
 Profile  
 
 Post subject:
PostPosted: 2015-06-18, 23:22:14 

Contributors Contributors
Offline

Joined: 2015-06-18, 22:26:41
Posts: 50
I tried this with an xfm file from The Elder Scrolls Arena, and the program couldn't play it. Renaming the extension to mid didn't fix the issue either despite becoming playable in other players like foobar.


Attachments:
DUNGEON1.7z [1.15 KiB]
Downloaded 81 times
Top
 Profile  
 
 Post subject:
PostPosted: 2015-06-19, 8:26:08 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Offline
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 2883
Location: Germany
That's not an MID file, but an XMI file. The player supports only MID, CMF and LAA and not all those other MIDI variations like XMI, HMI, etc. that the MIDI plugins in Winamp and foobar support.


Top
 Profile  
 
 Post subject:
PostPosted: 2015-09-02, 5:51:50 

Programmers Programmers
Offline
User avatar

Joined: 2012-08-12, 8:47:12
Posts: 9
Location: Riverside, CA, USA
Feel free to swipe my MIDI processing library if you want to handle more formats. It loads MID, RMI, XMI, MUS, MIDS, HMI, HMP, GMF, and LDS, into a common track/event structure, and can downmix the result into both .MID files and a timestamped event stream, and supports searching for loop markers. I may yet add partial unrolling of loop end/start points, to maintain the timing of note off commands that are past the loop end marker.

https://gitlab.kode54.net/kode54/midi_processing


Top
 Profile  
 
PostPosted: 2015-11-27, 18:45:20 
Offline
User avatar

Joined: 2015-06-08, 20:42:22
Posts: 30
Location: Argentina
I finally got my hands on just what little software I needed to record all the samples to post here.
Later on I will do the same about the mentioned issue I said I had been experiencing with volume relations, but before I report this "issue" I'll look through it more thoroughly.

So, here are the samples I rendered using two of the provided .bin banks in the player - the one used by default and one of the others of which purpose I still don't know (despite ValleyBell having told me it was for tone reference), and a What-U-Hear recording of MaliceX's original OPL3 User Mode MIDI driver, and the original MIDI just in case it's needed.


Attachments:
File comment: Tom timbre test with the SB16_VXD_InsDrum and SB16_VXD_DrumNote_Win95 banks, and MaliceX's OPL3 User Mode driver.
toms_test.zip [261.19 KiB]
Downloaded 88 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group