Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After GM system on, GM2 system on does not re-activate bank select. #1323

Open
nanitaro opened this issue Apr 28, 2024 · 10 comments
Open

After GM system on, GM2 system on does not re-activate bank select. #1323

nanitaro opened this issue Apr 28, 2024 · 10 comments
Labels

Comments

@nanitaro
Copy link

nanitaro commented Apr 28, 2024

FluidSynth version

Execute fluidsynth --version and provide the output.

FluidSynth runtime version 2.3.5
Copyright (C) 2000-2024 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

FluidSynth executable version 2.3.5
Sample type=double

Describe the bug

Provide a clear and concise description of the current situation, e.g. how the bug manifests.

1.GM system on. (Bank Select is disabled.)
2.The next time you perform a GS or XG reset, the bank select will remain inoperative.

Expected behavior

Provide a clear and concise description of what you expected to happen.

After performing a GS or XG reset, the bank select is to be re-activated.
There also seems to be a problem with the Voices not being initialized after executing a GS and XG reset.

Steps to reproduce

Please explain the steps required to duplicate the issue, esp. if you are able to provide a sample application. E.g. how to start fluidsynth, what shell commands to enter, what midi events to send, etc.

I have created a SMF file that reproduces the situation.
test.zip
SoundFont uses GeneralUser GS 1.471.

The SMF file is processed as follows.

  1. Bank Select MSB 03.
  2. Program Change 125.(Door is selected)
  3. Door sound is played.
  4. GM system on
  5. Bank select MSB 03. (Ignored.)
  6. Program change 125.(Telephone 1 is selected.)
  7. Phone tone is sounded.
  8. GS reset
  9. Bank select MSB 03. (Ignored.)
  10. Program change 125.(Telephone 1 is selected.)
  11. Telephone tone is sounded.
  12. XG system on
  13. Bank select MSB 03.(Ignored.)
  14. Program change 125.(Telephone 1 is selected.)
  15. Telephone tone is sounded.

Bank select works with 9 and 13,
11 and 15 want the door tone to ring.

Additional context

If you are able to illustrate the bug with an example, please provide simple
source code below or as attached file. List any other information that is relevant to your issue, e.g. stack traces, related issues, build logs, suggestions on how to fix, links to related discussions at fluid-dev, etc.

insert code snippets, soundfonts or anything relevant here, or attach it as extra file(s) if it's too much
@nanitaro nanitaro added the bug label Apr 28, 2024
@mrbumpy409
Copy link

OMG, I was just running into this bug while testing for my upcoming GeneralUser GS update. I thought I was going crazy! One of the MIDI files I was testing must have been sending a GM reset command, and then after that, bank selection stopped working even after issuing a GS reset command. The only way to get bank select working again was to restart Qsynth.

@nanitaro nanitaro changed the title After GM system on, GS or XG reset does not re-activate bank select. After GM system on, GS or XG or GM2 reset does not re-activate bank select. Apr 29, 2024
@nanitaro
Copy link
Author

Additional report.
As with GS and XG, the GM2 system on does not re-activate the bank select function.

@RoqueDeicide
Copy link

I've checked test.mid file in Sekaiju7.9. It appears, that you're sending GM System Enable message with device ID 0x7F, but the rest of your SysEx messages are being sent with device ID 0x10 (16 in decimal). Maybe you should try sending them with 0x7F instead.

In other words the GS message should look like this: F0 41 7F 42 12 40 00 7F 00 41 F7. This is the exact form that I use and it works for me.

And XG message: F0 43 7F 4C 00 00 7E 00 F7.

@nanitaro
Copy link
Author

nanitaro commented May 7, 2024

Thank you.
It seems to work as a hack.
However, GM2 system on still does not work.

Indeed, 0x7F (broadcast) was the standard for device IDs for GM and GM2 system on.
However, for GS reset and XG system-on device IDs, 0x10 was the standard.
As far as I know, for the XG system-on device ID, it is specified that it must be 0x1X (upper 4 bits fixed at 0001).
(This is described in the MU2000 manual.)

In many SMFs (Standard MIDI files), it was common to hack the GM system on and then do a GS reset (or XG system on).
It was done for compatibility reasons.
We would appreciate it if you could support GS reset and XG system on with the device ID set to 0x10 in order to play such SMFs correctly.

@RoqueDeicide
Copy link

GM2 style bank selection is currently not supported, probably because FluidSynth was designed for Soundfont 2 spec, which was made before GM2 was a thing.

As for device ID, you can set synth.device-id to 16 to enable GS and XG SysEx messages, or 127 to enable all SysEx messages.

Incidently, FluidSynth by choice doesn't follow XG standard when it comes to checking the device ID in the SysEx message: it compares the entire byte as opposed to its lower half. Apparently following XG standard to a T breaks a lot of MIDI files.

Here is a link to SysEx code section for more details:

@nanitaro
Copy link
Author

nanitaro commented May 8, 2024

FluidFeatures#sysex-messages
The documentation states that the GM2 system on works.
However, as it stands, after GM2 system on, bank select is disabled.
GM2 bank select is similar to XG, with MSB ignored and LSB specified.

For GS and XG, the desired behavior was achieved by setting the synth.device-id option to 16.
Thank you.
Perhaps it would be better to include in the documentation that this option be set to 16 when playing conventional SMF.
fluidsettings#synth.device-id

@mrbumpy409
I suspect this is a Qsynth issue where the synth.device-id option cannot be changed.
I will raise the issue in the Qsynth repository.
As for the GM2 system-on not working, this is a FluidSynth issue as described above.

@nanitaro nanitaro changed the title After GM system on, GS or XG or GM2 reset does not re-activate bank select. After GM system on, GM2 system on does not re-activate bank select. May 8, 2024
@mrbumpy409
Copy link

I can confirm that changing the device ID in the GS reset SysEx to 7F allows CC0 bank change to work again. Thank you!

@derselbst derselbst added this to the 2.3 milestone May 19, 2024
@derselbst
Copy link
Member

I found time to look into this:

  • GS and XG reset honor CC0, if device ID is set properly, as pointed out before - I've added a sentence about ID16 to the docs.
  • A GM System ON message sets the bank selection style to FLUID_BANK_STYLE_GM, which ignores CC0 and CC32, documented here
  • Currently, fluidsynth treats GM2 ON the same like GM ON, therefore bank selection is ignored.

So how to fix this?

  1. I could set the bank selection style to XG after GM2 ON (quick fix, but possibly inaccurate)
  2. Someone would need to introduce a new bank selection style for GM2 specifically, PR welcome.

@derselbst derselbst removed this from the 2.3 milestone Jul 21, 2024
@hikari-no-yume
Copy link

hikari-no-yume commented Jul 31, 2024

As I understand it, there's an informal convention that device IDs 0 through 15 are for MIDI devices responding only to the corresponding channel (so, device 0 responds to channel 0), whereas IDs from 16 and onwards are for devices that respond to multiple channels. For that reason, GS defaults to a device ID of 16, because a GS synthesiser can respond to at least 16 different channels.

@hikari-no-yume
Copy link

Oops sorry, XG doesn't use device IDs that high, my mistake. The device ID = channel ID is probably just a Roland thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants