Author Topic: XMPlay MIDI plugin  (Read 710771 times)

saga

  • Posts: 2777
Re: XMPlay MIDI plugin
« Reply #750 on: 14 Oct '14 - 12:20 »
tch, the link shows http:// before the ftp://, but the link itself is fine.
Yep, auto-linking for ftp links is broken in SMF 1.1 (you have to manually turn them into links to prevent this from happening)... But 1.1 will soon reach its end of life anyway so I guess Ian will have to upgrade to a version with working ftp auto-linking... :)

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #751 on: 15 Oct '14 - 16:56 »
Is it the ChromiumRevA soundfont that you're editing, rather than the "XG_Sound_Set__from_SoundMAX_DLSbyXG_" soundfont that the MIDI plugin is using? When in XG mode, the plugin will give a soundfont that appears to have XG drums in bank 127 priority over other soundfonts that don't, even if those other soundfonts would normally have priority (they're higher in the list). The ChromiumRevA soundfont's bank 127 doesn't look like it contains XG drums, so it is ignored in favour of the "XG_Sound_Set__from_SoundMAX_DLSbyXG_" soundfont which I guess does (I don't have that soundfont to check).

I have ChromiumRevA above XG Sound Set in priority, and I assigned 127:16 to ChromiumRevA. I know that it has XG drums because whenever soundfonts don't have an instrument for that specific patch it will just default to something completely different. I think it's the Honkey-Tonk patch for ChromiumRevA?

The ChromiumRevA soundfont includes program/kit numbers in bank 127 that aren't valid XG kits (it's actually a duplicate of bank 128), so the MIDI plugin doesn't think it has XG drums and it gets ignored in favour of the "XG_Sound_Set__from_SoundMAX_DLSbyXG_" soundfont, which does appear to have XG drums in bank 127.

Regarding what happens when a program isn't available, the plugin will first try the same program in bank 0 (128 if it's a drum channel), and if that isn't available, then it will try program 0, ie. the "Standard kit" if it's a drum channel.

Master_E

  • Posts: 7
Re: XMPlay MIDI plugin
« Reply #752 on: 15 Oct '14 - 19:18 »
Is it the ChromiumRevA soundfont that you're editing, rather than the "XG_Sound_Set__from_SoundMAX_DLSbyXG_" soundfont that the MIDI plugin is using? When in XG mode, the plugin will give a soundfont that appears to have XG drums in bank 127 priority over other soundfonts that don't, even if those other soundfonts would normally have priority (they're higher in the list). The ChromiumRevA soundfont's bank 127 doesn't look like it contains XG drums, so it is ignored in favour of the "XG_Sound_Set__from_SoundMAX_DLSbyXG_" soundfont which I guess does (I don't have that soundfont to check).

I have ChromiumRevA above XG Sound Set in priority, and I assigned 127:16 to ChromiumRevA. I know that it has XG drums because whenever soundfonts don't have an instrument for that specific patch it will just default to something completely different. I think it's the Honkey-Tonk patch for ChromiumRevA?

The ChromiumRevA soundfont includes program/kit numbers in bank 127 that aren't valid XG kits (it's actually a duplicate of bank 128), so the MIDI plugin doesn't think it has XG drums and it gets ignored in favour of the "XG_Sound_Set__from_SoundMAX_DLSbyXG_" soundfont, which does appear to have XG drums in bank 127.

Regarding what happens when a program isn't available, the plugin will first try the same program in bank 0 (128 if it's a drum channel), and if that isn't available, then it will try program 0, ie. the "Standard kit" if it's a drum channel.
Then why does the patch read "Power_127"?

Also, whenever I try to force ChromiumRevA onto something I know it doesn't have, I always get Honky-Tonk, not Grand Piano.

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #753 on: 16 Oct '14 - 15:27 »
Are you setting ChromiumRevA on a single preset, ie. via the right list in the config window? If so, when a soundfont is assigned to a single preset and it doesn't contain that preset, then the first preset from the soundfont will be used. "Honky-tonk" is indeed the first preset in the ChromiumRevA soundfont.

Regarding the "Power_127" case, is that just in the config window's preset list, or do you also see it used in playback of an XG MIDI file, eg. in the "Samples" info window?

Master_E

  • Posts: 7
Re: XMPlay MIDI plugin
« Reply #754 on: 16 Oct '14 - 17:55 »
Are you setting ChromiumRevA on a single preset, ie. via the right list in the config window? If so, when a soundfont is assigned to a single preset and it doesn't contain that preset, then the first preset from the soundfont will be used. "Honky-tonk" is indeed the first preset in the ChromiumRevA soundfont.

Yeah. I am.

Regarding the "Power_127" case, is that just in the config window's preset list, or do you also see it used in playback of an XG MIDI file, eg. in the "Samples" info window?

It's only in the config window. But I find it strange that it doesn't go to Honky-Tonk if supposedly it doesn't have a kit.

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #755 on: 17 Oct '14 - 17:45 »
If you assigned ChoriumRevA to 127:16, then you would end up with "Power_127", because it does have a 127:16 preset called "Power_127". If you assign it to a preset that it doesn't have (eg. 127:17), then you should end up with "Honky-tonk" (the 1st preset in the soundfont).

Note that although ChoriumRevA does include drum kits in bank 127, the MIDI plugin doesn't believe that they are XG drum kits, so they won't be used in XG playback. They will be used in non-XG playback that happens to use bank 127 though.

raygrote

  • Posts: 31
Re: XMPlay MIDI plugin
« Reply #756 on: 23 Jan '15 - 10:57 »
Hi Ian and all,
I sure missed a lot of updates! Most of what I have to say here has to do with sFZ playback. It's a lot so I don't want to sound pushy or anything, but since I use Sforzando for my sFz playback, and that's one of the best free players now, I thought I'd mention some things. I'm not trying to compare Bass to Sforzando, just trying to make its SFZ support better since I do want to use it in all its glory.
First, I was really surprised to read that SFZ playback was supported. it hit me out of nowhere. I haven't done a lot of testing with it, but there are a few suggestions I have.
First off, I am largely in favor of the SFZ filter and pitch envelopes as I think they have a much wider range of control than they would in the sound font equivalent. For example, if I want to put a really fast attack or decay on a filter, the sound font wouldn't be able to approach those really fast bwaw type of filter sounds with the Bass engine anyway. At least they didn't when I last tried it which was midi Rev 12.  but Bass will let you do it in an SFZ. I tested it. Also, panning with CC10 appears to be a bit problematic, both with sound fonts and sFZ playback. Most synths, when you adjust the pan, appear to adjust the balance of the output to that channel. But Bass seems to do soft panning, so if a sound is panned to the right by default, panning left just pushes it toward the center. This is a problem with any sound fonts that have stereo samples as you have to specify L and R samples separately, so there's no way around the fact that panning for those samples can become very restrictive, depending on how widely your l and r samples are spaced out. With SFZ, you can work around this by calling one stereo sample, such as piano-c4.wav, and it works. However if you had piano-c4l.wav and piano-c4r.wav and panned them out with opcodes, it would still exhibit this old behavior of just shifting the pan values and not adjusting the actual balance, if that makes sense. Is there a possibility of correcting this at some point? It would really open up some midi files to sound more like they were intended.
Also, while we're on opcodes, there are just a few opcodes I could see myself using and that are pretty commonplace: trigger=attack/release, reverb properties such as size and damping (the things that Bass already supports with sysex), and I'm not sure if these are supported but restricting the controller ranges for notes, such as having samples for pedal up versus pedal down and linking them to the value of control 64. There are loads of things like that i use in Sforzando. And also, like you said it wouldn't be all that common to actually need separate filter and pitch control, but I can think of cases where it would be useful.
One more thing and I'll be done for now. When I heard that SFZ support was coming in, I thought of creating a collection of sFZ instruments that I could use to override some patches of sf2 files I have. So I was wondering if there was such a thing as a way to write a text file that would reference sfz files and call them to specific program and bank, similar to how some sound font editors export presets in a text file. Something like:
000,000,Grand Piano.sfz
Where the first column is bank, second column is program, third column is relative path to the sfz file. For all I know this may be already possible and i haven't found it yet, but I'm throwing it out there. It's all hypothetical at this point. It would be a quicker way to get around the single instrument limitation of sFZ than setting it up in the midi config dialog, you could instead load a sflist file and it would be right there. The only problem is, if some SFZ files shared the same sample references, we wouldn't want them mistakenly being loaded twice, so we'd have to have a path checking system to make sure each sample called is only being loaded once. Which probably wouldn't be too hard to do, but I'm no programmer!
Hopefully I didn't overwhelm everyone here in the forum! This is great work so far and I'm loving it!
« Last Edit: 23 Jan '15 - 11:03 by raygrote »

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #757 on: 26 Jan '15 - 14:44 »
Also, panning with CC10 appears to be a bit problematic, both with sound fonts and sFZ playback. Most synths, when you adjust the pan, appear to adjust the balance of the output to that channel. But Bass seems to do soft panning, so if a sound is panned to the right by default, panning left just pushes it toward the center. This is a problem with any sound fonts that have stereo samples as you have to specify L and R samples separately, so there's no way around the fact that panning for those samples can become very restrictive, depending on how widely your l and r samples are spaced out. With SFZ, you can work around this by calling one stereo sample, such as piano-c4.wav, and it works. However if you had piano-c4l.wav and piano-c4r.wav and panned them out with opcodes, it would still exhibit this old behavior of just shifting the pan values and not adjusting the actual balance, if that makes sense. Is there a possibility of correcting this at some point? It would really open up some midi files to sound more like they were intended.

The MIDI plugin's panning (CC10) processing of SF2 stereo samples matches what Creative/E-mu (the SF2 spec creator) does, which is that the left and right channels are panned rather than the balance being adjusted. That's probably because they are actually 2 seperate mono samples rather than a single stereo sample, so they get processed the same as mono samples. The same processing is applied to separated SFZ stereo samples, ie. when it's 2 mono samples (like in your piano-c4l/r scenario). With unseparated stereo samples, panning is treated as a balance control. Here's an update that adds an "Alternative stereo sample panning" option to have panning treated as a balance control with apparently separated stereo samples too...

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

Also, while we're on opcodes, there are just a few opcodes I could see myself using and that are pretty commonplace: trigger=attack/release, reverb properties such as size and damping

Do you have an SFZ file that demonstrates the use of the trigger opcode? If so, please upload that to have a look at here...

   ftp.un4seen.com/incoming/

A single reverb effect is applied to all channels, so I'm afraid it isn't really possible for the parameters (besides level) to be adjusted on a per-sample basis.

I'm not sure if these are supported but restricting the controller ranges for notes, such as having samples for pedal up versus pedal down and linking them to the value of control 64.

The controller range opcodes (loccN/hiccN) aren't currently supported. If you have an example SFZ file demonstrating that stuff, please upload that too.

When I heard that SFZ support was coming in, I thought of creating a collection of sFZ instruments that I could use to override some patches of sf2 files I have. So I was wondering if there was such a thing as a way to write a text file that would reference sfz files and call them to specific program and bank, similar to how some sound font editors export presets in a text file. Something like:
000,000,Grand Piano.sfz
Where the first column is bank, second column is program, third column is relative path to the sfz file. For all I know this may be already possible and i haven't found it yet, but I'm throwing it out there.

The MIDI plugin doesn't currently provide that option, but I'll look into adding an option to export the soundfont config to a text file, and a corresponding import option.

kode54

  • Posts: 124
Re: XMPlay MIDI plugin
« Reply #758 on: 21 Feb '15 - 08:09 »
The MIDI plugin doesn't currently provide that option, but I'll look into adding an option to export the soundfont config to a text file, and a corresponding import option.
Perhaps you could support my silly notion of a format, .sflist files? They are supported by BASSMIDI Driver as well as foo_midi and Cog for Mac OS X.

The format is a UTF-8 formatted (hopefully) list:

[commands|]<relative or absolute path>

Commands for all supported formats will consist of ampersand (&) delimited lists of arguments:

p[target bank #,]<target patch #>=[source bank #,]<source patch #>

And an argument I currently don't support in the BASSMIDI Driver:

c<single channel number>
   or
c<lower channel number>-<upper channel number>

Range of channel numbers starts with 1.

Multiple patch or channel commands may be issued before a single SF2 or SFZ file. Source patch numbers are supposed to be 0,0 or 0 for SFZ files, but I guess some day I can make that parameter optional, assuming a single patch in the 0:0 slot.

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #759 on: 23 Feb '15 - 16:14 »
An export option that writes a "<bank> <preset> <file> <gain>" line for each soundfont config entry has already been added, but if there is an existing soundfont list format, it would make sense to use that if possible. I see a few compatibility issues that the XMPlay plugin would have with the described format. The XMPlay plugin has a gain setting; perhaps a "g<dB gain>" option could be added for that? It also doesn't have source bank/patch options, so perhaps the "=[source bank #,]<source patch #>" part could be optional? When that's omitted, the destination bank/patch numbers would be used as the source too, and if that patch isn't present in the soundfont, then the first patch found in the soundfont is used. That would be useful/convenient for SFZ files (which only have 1 patch), but even more so for single patch SF2 files, as it means you don't need to know the bank/patch number used in the SF2 file. Is there the option of using entire banks from soundfonts? If not, perhaps a "b<target bank #>[=<source bank #>]" option could be added for that? Putting it all together, you could have something like this...

Code: [Select]
; use patch 10 in bank 0 from marimba.sf2 with +3dB gain
p0,10&g3|marimba.sf2
; use bank 0 from bank0.sf2 with +1dB gain
b0&g1|bank0.sf2
; use all banks/patches from main.sf2 with -1dB gain
g-1|main.sf2

That is assuming that earlier entries have priority over later ones. Btw, is there comment support, either on a separate line or at the end of a soundfont config line?

kode54

  • Posts: 124
Re: XMPlay MIDI plugin
« Reply #760 on: 26 Feb '15 - 04:30 »
Actually, I initially made it so that later entries take precedence over earlier entries. Sort of like an overrides list. Load your fallback banks first, then poke in your individual overrides later. Then my players would poke in the file specific banks or sflists.

There could be comment support, as well as the other features you suggested.

The only problem is that I don't currently have a common way of supporting this. So perhaps a simple C based parser could be published in the BASSMIDI examples? Something to take a given base sflist path, and turn it into two separate lists: the list of unique HSOUNDFONTs requested by the sflist, and a list of BASS_MIDI_FONTEX presets in the correct order to apply to a stream.

Also, I have no idea how to implement the gain feature with BASSMIDI. I assume it's not possible at this time. EDIT: Oh, BASS_MIDI_FontSetVolume. That may require special consideration, since it may be possible to load the same font multiple times in a given sflist, and a player like mine will pass unique paths through a global cache, which has reference counts, and releases fonts about ten seconds after they're no longer in use.

Further EDIT: It may help with BASSMIDI if something could be done about opening the same SoundFont multiple times. I currently cache unique paths with reference counts, because I found that at some version, opening the same path multiple times returns the same handle, but freeing the handle once frees it immediately, no matter how many times it is opened in the process.
« Last Edit: 26 Feb '15 - 04:35 by kode54 »

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #761 on: 26 Feb '15 - 14:50 »
Actually, I initially made it so that later entries take precedence over earlier entries. Sort of like an overrides list. Load your fallback banks first, then poke in your individual overrides later. Then my players would poke in the file specific banks or sflists.

OK. The XMPlay plugin could reverse the list when importing/exporting in that case.

The only problem is that I don't currently have a common way of supporting this. So perhaps a simple C based parser could be published in the BASSMIDI examples? Something to take a given base sflist path, and turn it into two separate lists: the list of unique HSOUNDFONTs requested by the sflist, and a list of BASS_MIDI_FONTEX presets in the correct order to apply to a stream.

Yep, perhaps an example parser could be added to the MIDITEST example.

Also, I have no idea how to implement the gain feature with BASSMIDI. I assume it's not possible at this time. EDIT: Oh, BASS_MIDI_FontSetVolume. That may require special consideration, since it may be possible to load the same font multiple times in a given sflist, and a player like mine will pass unique paths through a global cache, which has reference counts, and releases fonts about ten seconds after they're no longer in use.

Further EDIT: It may help with BASSMIDI if something could be done about opening the same SoundFont multiple times. I currently cache unique paths with reference counts, because I found that at some version, opening the same path multiple times returns the same handle, but freeing the handle once frees it immediately, no matter how many times it is opened in the process.

It did used to be the case that duplicate BASS_MIDI_FontInit calls (with the same file) would return the same soundfont handle, but that shouldn't be the case since BASSMIDI 2.4.6. Duplicate soundfonts will still share resources now, but they will have their own handles (and own gain settings) and the soundfont's resources won't be totally released until all instances have been freed via BASS_MIDI_FontFree.

kode54

  • Posts: 124
Re: XMPlay MIDI plugin
« Reply #762 on: 27 Feb '15 - 01:29 »
What if two handles race each other for free/init cycles? For example, I unload all the fonts at the end of a song, then load them again in another thread at almost the same time, if not the same exact time?

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #763 on: 27 Feb '15 - 17:39 »
BASS_MIDI_FontInit/Free should be thread-safe, so what you describe should work fine, although it'll be more efficient if the new song's soundfonts are initialized before the old song's soundfonts are freed (rather than the other way round), as that'll mean any shared soundfonts won't need to be totally reinitialized.

winner

  • Posts: 306
Re: XMPlay MIDI plugin
« Reply #764 on: 28 Feb '15 - 00:47 »
...The issue in this case is that the Bass Trombone Solo's WAV files are 24-bit, which the plugin doesn't currently support, but here's an update that adds support for them (by discarding the least significant 8 bits)...

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


Ian, I'm having the same trouble loading SFZ wave files if the files are of type 32-bit float, 44,100 Hz sampling rate.
 

kode54

  • Posts: 124
Re: XMPlay MIDI plugin
« Reply #765 on: 28 Feb '15 - 02:07 »
BASS_MIDI_FontInit/Free should be thread-safe, so what you describe should work fine, although it'll be more efficient if the new song's soundfonts are initialized before the old song's soundfonts are freed (rather than the other way round), as that'll mean any shared soundfonts won't need to be totally reinitialized.

Which is why I need a release thread to handle freeing SoundFonts, rather than freeing them immediately.

winner

  • Posts: 306
Re: XMPlay MIDI plugin
« Reply #766 on: 1 Mar '15 - 18:31 »
...The issue in this case is that the Bass Trombone Solo's WAV files are 24-bit, which the plugin doesn't currently support, but here's an update that adds support for them (by discarding the least significant 8 bits)...

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


Ian, I'm having the same trouble loading SFZ wave files if the files are of type 32-bit float, 44,100 Hz sampling rate.
 

I supposed this would probably be out of scope for the midi plugin to handle. I converted the wave files to PCM and they work fine.

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #767 on: 2 Mar '15 - 16:07 »
Yep, the MIDI plugin currently only supports 16-bit or 24-bit WAV files, so floating-point WAV files would need to be converted to that. Using floating-point WAV files seems a bit extravagant (use of disk/memory space) anyway :)

raygrote

  • Posts: 31
Re: XMPlay MIDI plugin
« Reply #768 on: 21 Mar '15 - 04:08 »
Hi,
I've just encountered what could be a pretty bad glitch in the plug-in. Revision 12 didn't do this.
In revision 13a, sometimes release envelopes will start to fade, then abruptly cut. For a while I dismissed it, but I finally decided to have a look. it seems that if loop points are enabled for a sample, then release envelopes for that sample can become pretty odd. If loops are disabled, the problem  seems to go away, at least on the tests I've tried. I haven't looked for problems with the other portions of the envelope such as attack and decay. I also haven't tested SFZ playback yet. For samples with very quiet loops, this behavior takes on a life of its own. Staccato notes on the Personal Copy piano patches should produce some results, as the releases on it are pretty much nonexistent with the current plug-in. Other sound fonts with other patches do it too, but none are as extreme as Personal Copy's pianos.
I hope this can be fixed soon, as it's the only thing I don't like about this version. Please let me know if you need any other info/uploads.
Thanks for reading.

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #769 on: 23 Mar '15 - 17:02 »
That sounds like a problem that I also encountered fairly recently. It should be fixed in the current "stuff", so please give this a try...

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

Let me know if you still have the problem with that, and if so, upload a soundfont and MIDI file that is particularly affected...

   ftp.un4seen.com/incoming/

FB

  • Guest
Re: XMPlay MIDI plugin
« Reply #770 on: 24 Mar '15 - 15:09 »
Hi Ian, sorry for asking this if this has been explained before, I would like to know how each type of looping for samples works, so we could maybe track if something is working strangely or not, thank you!

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #771 on: 24 Mar '15 - 17:55 »
Do you mean the SF2 sample looping? If so, it should work as described in the SF2 spec, which you can get at the bottom of this wikipedia page...

   www.wikipedia.org/wiki/SoundFont

Let me know if you have found something that is working strangely.

winner

  • Posts: 306
I've been using XMPlay with .sf2pack soundfonts for many months now and currently have midi plugin 13f. Sometimes playback can be interrupted when the soundfont is unpacked and there is a pause or stuttering of audio.

I'm sure the severity of the interruption is influenced by some factors such as CPU speed, available memory, compression method, etc., but I wonder if there would be some way of mitigating this trouble. Perhaps the interruption is because the midi plugin has to wait for the soundfont to finish unpacking before it can be accessed.

Other than using uncompressed/unpacked soundfonts, is there a way to avoid this? Would there be a programmed solution whereby XMPlay could foresee the upcoming need to use a packed soundfont and unpack it even much earlier than normal? Perhaps there could be a slider adjustment for this? Maybe even part of the plugin programming could compute a variable adjustment time to invoke the unpacker based on the size of the compressed/packed file that is next needed to unpack for playing?
« Last Edit: 4 Apr '15 - 23:39 by winner »

kode54

  • Posts: 124
Re: XMPlay MIDI plugin
« Reply #773 on: 5 Apr '15 - 03:55 »
I assume samples are unpacked as they are used.

I would suggest using the fastest compression algorithm possible if you want it to unpack quickly. That would be FLAC. If you are already using FLAC, then I don't know what to tell you.

Ian @ un4seen

  • Administrator
  • Posts: 26171
Re: XMPlay MIDI plugin
« Reply #774 on: 6 Apr '15 - 14:29 »
Yes, the samples are loaded/unpacked as they are needed during playback of the MIDI file. Perhaps the option of pre-loading all needed samples before starting playback could be added. I'll look into that. In the meantime, you could try increasing the buffer length in the "Output" options page, which should help to prevent sample loading delays causing stuttering playback.