Closed JimBayne closed 1 year ago
Could you share an example MIDI file that does not work well?
Thanks for the quick response. I have attached a sample midi file.
Try listening to / rendering the first 10 bars with the patch for channel 6 set to
patch# bank32 bank0
063 121 001 Synth Brass 1
... 063 121 002 Synth Brass 3 ... 063 121 003 Analog Brass 1 ... 063 121 004 Jump Brass 1
I find they all sound identical, but ...
I don't thing MeltySynth is the problem. I have tried using Coolsoft's Virtual Midi Synth with the GM2 compatible SoundFount from https://musical-artifacts.com/artifacts/1346 and Virtual Midi Synth has the same problem. All patch variants for the same patch # from the different banks sound the same.
It's most likely that the SoundFont has the same audio samples for the different banks.
Do you know of a SoundFont that does have a full set of GM2 samples? SampeMidiFile.zip
I checked the SF2 and found that it contains the different banks with the different samples. You can confirm this by opening the SF2 with some SF2 editor.
All the numbers below are zero-based indexing to avoid confusion.
The MIDI file you provided uses Synth-Brass 1 (patch 62, bank 0) in the track 10. To override that instrument with Jump-Brass 1 (patch 62, bank 3), I used the following code, and it seems work.
sequencer.OnSendMessage = (synthesizer, channel, command, data1, data2) =>
{
if (channel == 10 && command == 0xC0 && data1 == 62)
{
synthesizer.ProcessMidiMessage(channel, 0xB0, 0, 3);
synthesizer.ProcessMidiMessage(channel, 0xC0, 62, 0);
Console.WriteLine("Overrided!");
return;
}
synthesizer.ProcessMidiMessage(channel, command, data1, data2);
};
I believe that bank32 (bank change course) is unnecessary in this case, since all the bank numbers in the SF2 are less than 128. Bank32 will be necessary only if there are more than 128 banks for a patch.
Many thanks. Your response was extremely helpful, and solved the problem for me. I had the bank 32 LSB and bank 0 MSB values reversed when I interpreted the patch maps. Once I sorted that out, my MeltySynth patch overrides began to work. I couldn't really hear the difference with the Synth-Brass patches, but when I tested with the Sitar patches it became very evident that I was obtaining different voicings.
Many thanks for this wonderful product.
I am currently using it to render midi files to audio in a variety of ways.
I am stuck however, trying to override GM patch changes in the midi sequences with GM2 patch changes. I don't seem to be able to get the overrides to work.
I am using a SoundFont that claims to be GM2 compatible from https://musical-artifacts.com/artifacts/1346, and have the following code in place ...
` ... other stuff ...
The PatchOverRide's are working, however the BANK_0, and BANK_32 bank changes have no effect. For instance
Patch Bank32 Bank0 Name 063 121 001 Synth Brass 1 063 121 002 Synth Brass 3 063 121 003 Analog Brass 1 063 121 004 Jump Brass 1
all result in the same instrument being selected (063 121 001 Synth Brass 1) - i.e. no difference in the sound.
Do you have any suggestions as to how I can overcome this issue?
Regards Jim Bayne