XMPlay MIDI plugin

Started by Ian @ un4seen,

Knurek

Quote from: Ian @ un4seenBtw, I noticed that your example files are pretty slow to load, due to it being a solid archive. So I've tweaked that a bit, and here's an updated 7-Zip plugin to try...

   www.un4seen.com/stuff/xmp-7z.dll

Works much, much faster, thank you. What's with the speed increase, do you unpack the whole archive at once and keep the files in the temp folder/RAM or something?

BTW, I've found a bug with MIDI looping. Here's an example:

www.snesmusic.org/hoot/midiloop.rar

ToT.mid has the looping section doubled in the MIDI file, so you can check how the loop switching should sound.

ToT-DNloop.mid uses Duke Nukem's format loop markers (0x74 and 0x75 I believe). XMPlay doesn't detect that now.

ToT-FF7loop.mid uses FF7 PC loop markers (loopStart, loopEnd). While XMPlay does detect the loop in this file, the loop switch isn't seamless. Not sure if it's xmp-midi or the file itself to blame (but if the MIDI is to blame, then the doubled file should exhibit the same behaviour, right?).

Also, the file doesn't fade-out at the end, would be nice if looped MIDIs would fade as MODs do.

Ian @ un4seen

Quote from: Knurek
Quote from: Ian @ un4seenBtw, I noticed that your example files are pretty slow to load, due to it being a solid archive. So I've tweaked that a bit, and here's an updated 7-Zip plugin to try...

   www.un4seen.com/stuff/xmp-7z.dll

Works much, much faster, thank you. What's with the speed increase, do you unpack the whole archive at once and keep the files in the temp folder/RAM or something?

Yep, solid archives are unpacked to memory, and then automatically freed when not accessed for a while.

Quote from: KnurekToT-DNloop.mid uses Duke Nukem's format loop markers (0x74 and 0x75 I believe). XMPlay doesn't detect that now.

There doesn't appear to be any markers (or other special meta-events) in this file. Do you have any details of the looping system used, eg. what's 0x74 and 0x75? :)

Quote from: KnurekToT-FF7loop.mid uses FF7 PC loop markers (loopStart, loopEnd). While XMPlay does detect the loop in this file, the loop switch isn't seamless.

Oops! When the loop position is the start of the file, it was skipping past any notes on the first tick. Should be sorted now...

   www.un4seen.com/stuff/xmp-midi.dll

Quote from: KnurekAlso, the file doesn't fade-out at the end, would be nice if looped MIDIs would fade as MODs do.

That's strange, fading seems to have been disabled for anything but MODs. I'm not sure exactly when/why that happened, but here's an update to try...

   www.un4seen.com/stuff/xmplay.exe

Knurek

Quote from: Ian @ un4seenYep, solid archives are unpacked to memory, and then automatically freed when not accessed for a while.

I just hope it won't bug out with a 512 MB solid archive on a 512 MB system. :P

Quote from: Ian @ un4seenThere doesn't appear to be any markers (or other special meta-events) in this file. Do you have any details of the looping system used, eg. what's 0x74 and 0x75? :)

I can only paste you the sourcecode of the converting program (both FF7 and Duke Nukem loops inserting). Hope that helps.

  case 1:
       if(!loopPointUsed)
      {
      smfInsertControl(smf, sseq2mid->track[trackIndex].offsetToAbsTime[offsetToJump], midiCh, midiCh, 0x74, 0);
      smfInsertControl(smf, absTime, midiCh, midiCh, 0x75, 0);
      loopPointUsed = true;
      }
      loopCount = 0;
      break;

  case 2:
       if(!loopPointUsed)
      {
      smfInsertMetaEvent(smf, sseq2mid->track[trackIndex].offsetToAbsTime[offsetToJump], midiCh, 6, "loopStart", 9);
      smfInsertMetaEvent(smf, absTime, midiCh, 6, "loopEnd", 7);
      loopPointUsed = true;
      }
      loopCount = 0;
      break;

The loopchanges work quite fine, thank you! Now to reprocess all those midi files... Argh...


CaitSith2

Quote from: Ian @ un4seen
Quote from: KnurekToT-FF7loop.mid uses FF7 PC loop markers (loopStart, loopEnd). While XMPlay does detect the loop in this file, the loop switch isn't seamless.

Oops! When the loop position is the start of the file, it was skipping past any notes on the first tick. Should be sorted now...

   www.un4seen.com/stuff/xmp-midi.dll

Seems the loop point code is still incomplete.  When it hits the "loopEnd" marker,  it should go back to the "loopStart" marker, rather than play past the "loopEnd" marker.  For an example of a midi with the "loopEnd" marker, in the middle of data beyond the marker, look at http://ds.caitsith2.net/magical%20starsign.rar.

Ian @ un4seen

Quote from: Knurek
Quote from: Ian @ un4seenYep, solid archives are unpacked to memory, and then automatically freed when not accessed for a while.

I just hope it won't bug out with a 512 MB solid archive on a 512 MB system. :P

If people want to use solid archives and still open/play individual files from them, they gotta face the consequences ;)

Quote from: KnurekI can only paste you the sourcecode of the converting program (both FF7 and Duke Nukem loops inserting). Hope that helps.

I see, it's using a controller rather than a meta-event. Here's an update to try...

   www.un4seen.com/stuff/xmp-midi.dll

Quote from: CaitSith2Seems the loop point code is still incomplete.  When it hits the "loopEnd" marker,  it should go back to the "loopStart" marker, rather than play past the "loopEnd" marker.  For an example of a midi with the "loopEnd" marker, in the middle of data beyond the marker, look at http://ds.caitsith2.net/magical%20starsign.rar.

Yep, "loopEnd" markers were ignored as it assumed they would just be at the end, but the update above includes an option to use the loop end point.

CaitSith2

Seems I found that most video game system music formats do not have the limitation of midi/module formats.   Specifically,  that limitation is that all tracks in the formats have to be the same length.

More or less,  I have encountered several games that use varied track lengths.  (In one case, Track 0 is 30 seconds, Track 1, 34 seconds, Track 2 & 3, 40 seconds. (These tracks loop at those lengths)).  Unfortunately, midi loops at Track 0s loop length, cutting Track 1-3 short, and repeating them early.

I truely wished there were a PC side format that I could convert to, that did not suffer this limitation.

Knurek

Quote from: CaitSith2More or less,  I have encountered several games that use varied track lengths.  (In one case, Track 0 is 30 seconds, Track 1, 34 seconds, Track 2 & 3, 40 seconds. (These tracks loop at those lengths)).  Unfortunately, midi loops at Track 0s loop length, cutting Track 1-3 short, and repeating them early.

Wouldn't it be possible to fill all tracks shorter than the longest one to it's length? I mean, it still sounds like something doable to me...

Torkell

A better approach would be to extend all tracks until the loop points meet. E.g. if you have track 1 is 40 seconds long and track 2 is 30 seconds, then create a file with track 1 repeated three times and track 2 four times to give a total length of 120 seconds.

'course, this isn't particularly optimal for non-simple ratios (as in CatSith2's example).


Edit: eek, when did I pass 1000 posts?

Knurek

Quote from: BoggyBA better approach would be to extend all tracks until the loop points meet. E.g. if you have track 1 is 40 seconds long and track 2 is 30 seconds, then create a file with track 1 repeated three times and track 2 four times to give a total length of 120 seconds.

That's what I had in mind actually.

Quote from: BoggyBEdit: eek, when did I pass 1000 posts?

I'd say about 90 posts ago. :P

CaitSith2

Im working on doing something,  to make an option for doing 2 pass looping.  (First pass finds out all of the loop point lengths, and figure out how many times each track should loop, and the second pass then creates the midi file, using the info gleaned from the first pass.

A game that is bad for differing track lengths, is Magical Starsign.  (ambience effects are often on the longer track, and doesn't sound right as a result of the looping, unless the midi was converted using the 2 loops option, rather than the loop point options.)

johnsonlam

Quote from: Ian @ un4seenYep, the XMPlay MIDI plugin has finally appeared. It's a softsynth (ie. doesn't use MIDI hardware), and uses SF2 soundfonts. It's setup to use the Creative/Soundblaster soundfont by default, but any of the many SF2 soundfonts freely available on the 'net can be used (in the plugin config).

Hi Ian,

Thank you very much for the great player and BASS library!
Will you consider implement the support for '.PAT' sample?
There's an Open Source with large number of files:

http://freepats.opensrc.org

Thanks again.

Ian @ un4seen

I'm afraid there aren't currently any plans to add support for PAT files, but maybe there's something that can convert them to an SF2 file? Maybe Awave?

piovrauz

Mmm, may sound like as trange request, but how about an option to remove or disable instrument(s) on sf2? I'm asking this because I have a .sf2 that charge an instrument in bank 1, so when I "autoload matching name sf2" listning a mid, it mess up.

Thanks. 

Ian @ un4seen

Are you saying a soundfont in the plugin config is overriding a matching soundfont? That shouldn't be possible, but if it is happening, please upload the MIDI and matching SF2 to have a look at here...

   ftp.un4seen.com/incoming/

heftig

#164
I'm having a problem with a few MIDI files here: the drums don't play, apparently because the drum notes have zero length.

Could you add support for this to the plugin? If not, is there an quick way of making all zero-length events of channel 10 longer? I've uploaded two midi files prefixed with 'zerolengthdrums' to your FTP.

This also applies to BASSMIDI.

piovrauz

Well, tomorrow I'll upload the son+sf2 files. Today I can't. Bye!

Ian @ un4seen

Quote from: heftigI'm having a problem with a few MIDI files here: the drums don't play, apparently because the drum notes have zero length.

Yep, 0 length notes weren't being played (or heard at least :)), but they should be ok now...

   www.un4seen.com/stuff/xmp-midi.dll


piovrauz

Troublesome MIDI file uploaded, CH.7z contain all file you need to have my sf2 setup.

Ian @ un4seen

Quote from: piovrauzTroublesome MIDI file uploaded, CH.7z contain all file you need to have my sf2 setup.

The problem is caused by the MIDI file using bank 1, but the matching SF2 doesn't have a bank 1. So if the plugin config soundfonts do have a bank 1 (containing the required preset), that'll be used instead. This is shown in the "Samples" info window.

I guess an option could be added to make matching SF2 files apply to all banks. Here's an update to try...

   www.un4seen.com/stuff/xmp-midi.dll

piovrauz

Yup, as usual works like a charm!  :)

I've tested with a bunch of files, I suppos it's ok now. You're my superhero...

Piovrauz

heftig

Hmm... 0 length drums are kinda buggy.

Compare "Flyin' Machine.mid" with "Flyin' Machine2.mid" from the 52 second mark onwards.

In the first version some drum notes don't get played, apparently at random.

I used a sequencer software to lengthen the drum notes of "Flyin' Machine2.mid". It sounds flawless there.

piovrauz

Well... I speaked too fast... I've uploaded mrvain.7z to the ftp. At beginning there must be some sort of harp, but it is here no more (with the new option active). It's the only MIDI that isn't fine now, all others are ok. I also noticed a little increase in the loading time. Why?

Ian @ un4seen

Quote from: heftigHmm... 0 length drums are kinda buggy.

Compare "Flyin' Machine.mid" with "Flyin' Machine2.mid" from the 52 second mark onwards.

In the first version some drum notes don't get played, apparently at random.

I used a sequencer software to lengthen the drum notes of "Flyin' Machine2.mid". It sounds flawless there.

Yep, I see the problem. It's sorted in the rev.1 update, which is now up on the XMPlay page.

Quote from: piovrauzWell... I speaked too fast... I've uploaded mrvain.7z to the ftp. At beginning there must be some sort of harp, but it is here no more (with the new option active). It's the only MIDI that isn't fine now, all others are ok. I also noticed a little increase in the loading time. Why?

I don't know about the loading (nothing's changed there), but the missing sound is due to the custom soundfont using samples from the AWE's ROM, which of course XMPlay doesn't have access to :)

Without the "Use on all banks" option enabled, it'd fall back to the soundfonts in the plugin config instead, but that'd probably sound quite different anyway, as custom soundfonts don't generally follow the General MIDI standard. For example, the missing ROM samples are named "SawStackWave" and "SawtoothWave", but they're on preset 8, which is "Celesta" in General MIDI.

Rich Nagel

#174
(re: 0 length drum notes)

Is this a common thing in MIDIs? I'm a MIDI musician (and massive fan of the format) for well over a decade and a half now (as well as having cazziliions of downloaded MIDI files), and I have yet to find one that had 0 length drum notes (?).

Also, in my years of MIDI music composing, I myself have always made the drum notes the proper duration for sheet music printing... in other words, they are sequenced exactly how they would be played (and are quantized as such).

Are these a common thing? Seems that a 0 length drum note (or any other MIDI note/patch for that matter) would be attributed to poor sequencing on the composer's part (?). Hehe, I mean, a "0" means just that... ZERO <BG>.