There's no way to send patch change info when routing MIDI out??

• Jan 8, 2013 - 04:51

This is actually an issue about audio under Linux. I'm using KXStudio, which is the best overall Linux audio system, available on its own or as repositories to add to any Ubuntu-based system such as Linux Mint or Ubuntu Studio or whatever.

Incidentally, KXStudio works without PulseAudio for all audio settings, so MuseScore doesn't need it. The KXStudio developer went and packaged MuseScore so it wouldn't force the installation of PulseAudio.

Anyway, the fluidsynth synthesizer within Musescore 1.2 takes way too much CPU use. It overloads and is glitchy with ALSA and completely overwhelms JACK when in realtime mode. The only way to get a smooth sound is to use only a MIDI out and send the signal to qsynth or some other soundfont synthesizer external to Musescore. This uses the same sounds and MUCH less CPU! So something is definitely very inefficient within Musescore.

Now, this solution would be perfectly fine if for one thing: now there's no way to set the sounds correctly. Musescore doesn't seem to send out patch change information, so it doesn't make qsynth use the right patches for each instrument! There really is no simple patch-change option for MIDI out?? It seems like the simplest thing to just send the same output to external MIDI as would have been used for the internal synth!

Is this perhaps something fixed in newer pre-release updates??

This is quite frustrating as I have no way to get a good result with the current setup.


Comments

Ok, my overall question about patch-change is still valid, but not really a big issue.

On installation, the reverb was set to zero. I moved it just a tad and now the synthesizer works with moderate CPU!! No issues! Woohoo!! I can send audio directly to JACK or ALSA! No glitches!

I don't know if it was the reverb specifically or just that moving something at all got the synth to reset. Anyway, it all works now! Well, not the patch-change MIDI out, that is still an issue, but just a minor one.

In reply to by wolftune

I have used Musescore with both Qsynth and Linuxsampler. The key here is understanding how Mscore currently does midi out. What ever instrument that is on the top staff will be routed to midi channel 1. As you move down the score each staff will be on the next corresponding midi channel except for the strings and trumpet. The strings have three different articulation options and each of these uses a midi channel. So say violin is the top staff of the score. This means channel 1 is the normal articulation, and channel two is the pizzicato, and channel three is the tremolo articulation. So if the Viola is on the next staff below the violin it will be routed to channel 4. The trumpet if it were on the top staff has two articulations normal and mute, so it would take up channel 1 and 2. Thus, the next instrument down would be on channel 3. You can't actively route the midi channel right now in Mscore, but you can understand how it works which will make it easy to use with Linuxsampler or Qsynth.

One important note of caution though, if you add a new instrument into your score say somewhere in the middle, you will have to move all your previously mapped instruments down one channel in Linuxsampler or Qsynth. So you really need to decide which instruments you want from the start or you'll be in for a lot of extra setup work if it is a big score. If you compose for full symphony orchestra, as I do, it can really be a pain if you leave out a clarinet or something, lol.

The articulation switching can be a really cool thing with the strings and trumpet. If you are using Linuxsampler or Qsynth you can use the second and third channel for anything you want. I am coding up some orchestral instruments in SFZ for Linuxsampler, and I often use the second or third channel for the crescendo and trill samples that I have in my library.

Hope I answered your question about the midi routing.

Cheers.

In reply to by AnthonyDeaton

Yes, this is a good answer. But I hope that patch-change MIDI info could be sent, that this could be planned for future versions. It should be simple enough for Musescore to send a patch-change signal on start and this would set each channel to the right instrument. That's how it is supposed to work. Then, this should be able to be turned off for manual override of GM patches.

In reply to by wolftune

Okay, I am starting to think I answered a way more complicated question than the one you asked. Are you asking about having the proper instrument selected in a Gm soundfont in qsynth? In other words you are hoping that if you open qsynth with a GM that it would already have the instuments in the same channels that you had setup in Musescore? Is that the question your are asking?

Actually, my concern was about functioning at all initially before I got the internal synth to work better, so yes, your answer was appropriate and very helpful.

But ALSO I do want to be able to send out GM patches to qsynth as you describe. This ought to be an option, and it looks like Musescore doesn't support this, which is unfortunate.

In reply to by wolftune

Actually, it will be rather difficult for Musescore to do this and no Linux notation editing program before could do it either. There is really no communication between Musescore and Qsynth the way you are using it. What you and I are doing is simply piping midi out of Musescore and into a different sampling engine. If you were to export the file as midi, however, and the channels were not set properly, then that would be an issue for Musescore, but working on the fly is a completely different matter.

What you are suggesting is really the job of the sample engine's frontend, in this case Qsynth. Unfortunately, I don't think Qsynth supports saving settings like that. I use Qsampler as a frontend to Linuxsampler and it does have a save session feature, so I only have to set things up once and all the settings including channels, volume, effects, etc are saved. When you want to work on the project again, you can open it up and all the channels and settings are already set up for you.

Rui Nuno Capela is the author of both Qsynth and Qsampler. I have worked with him before on a project and he is a really nice person who enjoys hearing from his users. You can reach him at rncbc@rncbc.org. You could at least put in a feature request for saving settings and see if he is interested.

I haven't used Qsynth in many years, so he may have already added a save feature that I don't know about, but he can let you know about that if you care to contact him.

Best of Luck with All Your Projects,

Anthony

In reply to by AnthonyDeaton

I don't think this is true at all. Sending a patch-change instruction is a completely standard MIDI routine. All MuseScore needs to do is send that signal as the intiial MIDI thing on each channel when hitting "play" or just when playing from the beginning of the score. This is completely normal behavior. It shouldn't require anything special from qsynth.

In reply to by wolftune

The only thing to remember about this is that MIDI is a device-dependent protocol.

ie You can send as many patch (program) change messages as you like, but if the synth your are sending messages to is set up differently from the message source then you will get the sounds present on that synth for those patches.

eg You have MuseScore setup to play a piece for violin and piano, MuseScore, as a GM compatible sequencer sends patch changes of 40 for the violin and 0 for the piano.

The synth receiving the midi messages, however, is not GM compatible, and has Patch 0 set to a trombone and patch 40 set to electric guitar.

Consequently, when you play the score from MuseScore the synth will play the violin part with electric guitar and the piano part with trombone.

It is your responsibility as the user to ensure that the preset patches are compatible with the transmitting sequencer, which is where the saving of presets mentioned by Anthony comes in.

HTH
Michael

In reply to by ChurchOrganist

so Musescore, obviously, should have a setting to choose to send out GM patches. This needs to be able to be turned on and off. Otherwise, when sending out via MIDI, there should just be an instrument setting per staff, just like the mixer setting right now, it should include something where the user can simply enter what patch number to send.

In reply to by wolftune

No

- as I said MIDI is device-dependent.

Program change numbers are completely device-dependent.

It is up to the user to ensure that the sending and receiving parts of the MIDI change are using compatible sounds, so if you want to here GM compatible patch changes you have to make sure that the receiving synth is setup to be GM compatible - it doesn't happen at the transmission end.

Musescore will send a program change based on the instrument(s) selected in the Mixer dialogue - with the default soundfont, yes those will be GM compatible. If however you are using different soundfont - say the Jeux Pipe Organ soundfont then they will be program changes compatible with the Jeux soundfont.

But if your sampler doesn't have a GM compatible set of samples loaded then it will respond to those program changes with whatever it has loaded for those program change numbers - so you could be sending out program change numbers form MuseScore which coincides with the internal GM soundfont, and have the program changes interpreted as something completely different by the receiving synth.

For example if the receiving synth is a Yamaha DX27 then whatever patch changes MuseScore sends will be interpreted with the actual patches contained within the DX27.

You must ensure that both ends of the chain are configured correctly or you won't get the results you expect.

HTH
Michael

In reply to by ChurchOrganist

Sorry, the point is that GM is a standard! I don't expect Musescore to know what to send to anything else, and so of course anything else would have to be manually set up.

That's no reason not to function with GM which is a standard. MuseScore currently only send the right signal to its INTERNAL GM synth. Why can't it do the same for an external GM synth?

Yes, this won't work with non-GM, but GM exists. Musescore already uses it. Why restrict to internal? Qsynth could use the same soundfonts as Musescore, but there are many advantages to running qsynth externally.

At any rate, what Musescore should do is allow the mixer to just specify a patch number for external synths so that you can choose in Musescore to make a staff be whatever patch without worrying about what channel it is. This would work fine with the DX, you would choose that staff one be patch 12, and the DX would go to patch 12, whatever that is. And then this would be saved with your Musescore file, which is nice.

In reply to by wolftune

Yes, Stickwolf, you are right about everything you said excepting the idea that it is such a quick and easy fix. What you are asking for can be done; however, jack support was added in version 0.96 and people immediately started asking why gm midi bank selection didn't work for external samplers. We are at version 1.2 now and heading for 2.0 and this feature doesn't appear to even be on the horizon.

The Musescore team is (I think) overly obsessed with their internal synth, and they weren't even all that interested in jack support. The jack support that we have now is basic and that is all that we can safely hope for in the near future. GM routing is a question that has been asked several times before on this forum and it was added to the wish list in version 0.96, so don't hold your breath for Musescore to get it done tomorrow.

You are right that Qsynth is much nicer sounding than the internal synth in Musescore, especially the reverb, but there is certainly better sound to be had by switching to Linuxsampler. Especially since you are using GM which is the lowest of the low. You are using a framework (SF2) that has been dormant for nearly ten years. I doubt that you are using anything else that outdated on your computer (I am willing to bet that you aren't visiting this page with the old Netscape browser), so why use such outdated technology for sound? With Linuxsampler you can use GIGA and SFZ which are light-years ahead of SF2. You can use keyswitching to change articulations on the fly and you'll get the benefits of round-robin and many loop modes and a ton of modulation, eq, and filtering that can't be matched by SF2. If you are going to go to all the trouble to use an external sampling engine, you may as well get the full benefit of it. Plus, you will have the session save ability which will negate the need for Musescore to send GM bank info. Linuxsampler itself comes with a host of advantages too, so please do yourself a favor and at least check it out.

However, if you really want to continue on with GM SF2, then there are a few options that you can pursue. Remember that Musescore is open source so anyone can contribute, so you can hack the code yourself to add exactly what you want; however, I don't want to mislead you into thinking that it is going to be as easy as you think. I got the impression that you thought this would be a five-minute job, and unless you are intimately familiar with QT, it will assuredly involve some work. If you decide to do this, you can then submit your patch to Musescore and they can adopt it so that it will become part of Musescore's future releases.

The second thing that you can do is the sampler frontend save feature that I already mentioned. If you can find a way to save your project in Qsynth, than that can actually be more beneficial in many ways to having Musescore in control of things. There are other Fluidsynth frontends, that may have a save feature, but I always preferred Qsynth, for the same reason as you---it sounded the best of any that I tried, but I haven't used SF2 in years, so there may be other options now.

Lastly, you could use a midi router. I used to use one back in the day of SF2, but I don't remember the name of the program. It did have a save functionality, but was kind of a pain to work with, so I only used it for really complicated scores, but it could accomplish what you need.

Wish that I had better news and could be of more help, but that's the only options that I can think of, so I wish you the best of luck with whatever you decide.

In reply to by AnthonyDeaton

I don't think the issue is that the dev team are "overly obsessed with their internal synth".

From what I can gather from talking to Lasconic it is that they lack someone with the knowledge of writing MIDI protocols in C++, and apparently they are waiting for something called the Drumstick Project to provide the libraries for writing this code. Unfortunately it doesn't yet support all 3 OSs that MuseScore is compiled for.

There are a couple of Issues which discuss this problem which you might find worth reading: #5163: Option to select the MIDI Output and #12726: MIDI OUT implementation.

Sadly it is beyond the remit for 2.0, but if we could find a coder to implement it, it would definitely be something that should go into the next major version or before.

In reply to by ChurchOrganist

Actually, I'm running KXStudio and working with the amazing devs toward having a really robust Linux music system. I've got Linux Sampler installed automatically as part of the system, and the whole thing is working on better integration. But I'm not (yet) a programmer, so I'm trying to just understand things.

After my request, falkTX, the KXStudio developer, just packaged MuseScore so it would no longer ask for Pulse Audio to be installed. The whole KXStudio system runs sans pulse via JACK and ALSA and somethign called Cadence snd-aloop daemon which routs all the system's audio through ALSA and JACK so everything works cleanly!

I'm also now working on founding a new system for FLOSS and Free Culture fundraising that is truly a departure from the existing platforms that do crowdfunding like Kickstarter etc (send me a private message if you're curious or want to be involved). But there's also stuff that is worthwhile in its own way like freedomsponsors.org which I think is excellent and would like to encourage people to use. So I'm trying to do what I can to help all this be the best it can be.

Thanks for clarifying things for me.

Cheers,
Aaron

In reply to by wolftune

Audio output has never been an obsession, being internal or not. MuseScore is a score editor, its obsessions are easy and beautiful music notation for all (read not only for the 10 KXStudio users, but also the XXX million users of Windows and Mac) . It happens it gives audio feedback, but it's a bonus. MuseScore was one of the first software to support Jack natively on the 3 major OS. Jack midi support is not perfect, Jack control is missing but as someone said, patches are welcome, especially for the simplest things!

Do you still have an unanswered question? Please log in first to post your question.