Press a Key to export MIDI

• Apr 29, 2022 - 12:39

It will be nice to permanently integrate functions like this plugin does (I assigned it to F2):

import QtQuick 2.0
import MuseScore 3.0
MuseScore {
menuPath: "Plugins.MIDI Exporter"
description: "Export MIDI Plugin"
version: "1.1"
onRun: {
var s = curScore
var p = curScore.path;
p = p.slice(0, -5);
p = p.replace(/\//gi,"\")
writeScore(s, p, 'mid')


I'm not sure what you're asking for other than saying you already did what you're asking for by using the plugin framework?

In reply to by jeetee

What Im' asking is:
instead to make ppl looking for this feature and barely find it, why don't implement it as stable feature?
What i dose is simple: exports MIDI file directly. So that each update, just pusha button and the file is updated.

When working jointly with DAWs, in MIDI, this is very helpful.

In reply to by tormyvancool

File > Export is where that built-in function is.
Since the end product of MuseScore is sheet music, I personally don't feel exporting to MIDI should become a single button press action.

Also keep in mind that MuseScore offers direct MIDI out for DAW integration as well

In reply to by jeetee

I know you have to go up there: File > Export etc
It takes long when you do it often. This is the way to work when you interface apps like MuseScore with a DAW and you are working, not hobbying. You need action speed. Consequently the shortcut is a very practical way; That's why int the world, they used to give shortcuts to the end users.
I do use them (shortcuts) on any application, and they are way way more practical.

However, this is my request for a feature. Not a legal obligation :-)

About the Direct MIDI you are talking about.
Because so far MuseScore website reports the use of LoopBe1 (I own) but it doesn't work at all( I also opened a ticket on the Gitlab of the programmer). Is this the integration you referred to? If yes, now you know why it's not what I'm using and why.

Moreover and beside this, even using the LoopBe1 system suggested by MuseScore, ti has not the same effectiveness of exporting MIDI as I asked for, especially within Reaper.
Up there, Reaper automatically updates the Lanes once the MIDI file is updated

What does it mean?
It means that I modify the orchestral Score, I update (in my case with the shortcut) the MIDI and automatically also the DAW (Reaper) gets the MIDI items/lanes updated. I just push pay, and I get the result ready for production.

In reply to by jeetee

Music Production. This is my job.
So, I write scores with MuseScore.
I export MIDI that are dynamically imported in Reaper. it means: each change to the MIDI file, is automatically applied to the MIDI Items in Reaper. Hence, whenever I change notes or adjust anything, automatically I get the changes also in the DAW and I can proceed further with my work.

The very first time I export the file, of course is by File > Export
By using the macro I shown, I do the job just pushing (in my case) F2 (since I assigned the macro to that), the file is immediately updated in milli-seconds, hence I just push F2, and I go to Reaper (constantly opened) and I get what I need to get.

My idea is: there are tons of users up there, that are not familiar with code.
Why don't include this feature, instead to make them write their own code?
Giving to all of them the possibility I got?
Not only: the code I posted, is ok for Windows. Not for MAC.
Instead, if the feature is built in, all the users can have it, and its profitable for them as well, without coding.


In reply to by tormyvancool

I'm still missing the part of this answer that states to what end you're using Reaper though. It's obviously not for editing and tweaking the score or even the plain MIDI data, as for that end you seem to be using MuseScore and need a bit of "instant sync" to Reaper. (Unless of course there is further mixing with audio tracks going on)
My other best guess is that you're using it as a VST Host?
In which case again I'd believe you should be able to just use the direct MIDI output from MuseScore. I'm not sure why you think that loopmidi should be a requirement here; from what I gather it can help in software rooting of MIDI signals, but should not be a necessity in and of itself.

I also don't see why the plugin code you posted should be Win-only and not working on Mac or linux? What is the issue with running it on those platforms?
And if you wish to distribute this plugin, feel free to add it to the plugin repository at

The thing is that I think you overestimate how useful this specific implementation of that feature is; because it for one assumes that you'll want the midi export to be in the same folder as the score file; which perfectly fits your workflow, but likely not so much those of others. In which case a built-in function would have to have some configurability as to setting an export location, in which case the difference with the current Export dialog (imho) becomes quite small.

Again, I'm not saying it "should never happen". I'm stating that for the specific and narrow use case you (so far) provided, the plugin approach seems to precisely, perfectly and swiftly fulfill and address that need. And if you believe that approach will benefit many others, then a first step is sharing that plugin.
If this results in many users requesting this (over the past years, not so much yet) then we can consider either distributing the plugin with the software or make the function built-in.

In reply to by jeetee

let's repeat.
Since it's not an overestimation, it's what I already told.
Of course who doesn't do this job for living, can't get on the tip of his fingers the real advantages.
But I trying to make it understand, trying to rephrase.

MuseScore is the notation editor I do use to write the scores that I need.
Then I export the MIDI files and I import them into Reaper to go on with mixdown with the other audio (not MIDI) tracks I have in production.

This is a normal routine operation. Nothing special or out of ordinary.
Right till here?

Ok. During this process, MuseScore is always active. If ever I want to change phrases/notes/else, I do in the score . Why up there and not in Reaper directly?
Because: for my kind of work, I do need the score to print out when the work is finished.
I print the Score and the Parts and I deliver them to the Customer, together with the whole agreed Production.

Hence I find the job done in much less time (and it is so).

Now, I thought that implementing this solution INSIDE the Program, it goes to the advantage of many ppl that normally are NOT familiar with coding, looking for scripts etc that means the 80% of the ppl working in Audio Production. they need "click & go" operations. Are they right? Yes, they definitely are.

That's it.
You don't want to implement this smal use case?
Ok fine.
I got a sensation of "We can't" rather than "we can" mindset (my sensation) but as I said: it's fine.

However, here below the code for Windows and for MAC so you can spot the small difference, answering to your question:"I also don't see why the plugin code you posted should be Win-only and not working on Mac or linux".
Perhaps there are better ways. Don't know. Never used that language before.
Imagine who never programmed and has not any idea on what to do and howe. He/She will be quite intimidated

import QtQuick 2.0
import MuseScore 3.0
MuseScore {
menuPath: "Plugins.MIDI Exporter"
description: "Description goes here"
version: "1.1"
onRun: {
var s = curScore
var p = curScore.path;
p = p.slice(0, -5);
p = p.replace(/\//gi,"\")
writeScore(s, p, 'mid')

Here the one for MAC

import QtQuick 2.0
import MuseScore 3.0
MuseScore {
menuPath: "Plugins.MIDI Exporter"
description: "Description goes here"
version: "1.1"
onRun: {
var s = curScore
var p = curScore.path;
p = p.slice(0, -5);
writeScore(s, p, 'mid')

At this point, I should consider this use-case ignored by the manufacturer. It's a pity. We spent more time to talk than to do , but it is what it is :-)

In reply to by tormyvancool

I agree that a plugin is the way to go for this. The problem with a button is that there would also need to be a button for the other nine export methods. And where would all those buttons be put? In a drop down menu? Possibly that shows the last export method used so that all you need to do is select it? 2 clicks different from how export works now. Yes, I know clicks are time, and time is money.

In reply to by bobjp

yes I get your point. as well.
perhaps a solution can be that for the 9 export methods that could be the possibility to add shortcuts as well.
Then uyes, drop down menu btu with shortcuts we avoid the 2 clicks and it' sufficient to press a button and no opening windows or "ok" but just the way the code I posted does.

This will make the life way easier

In reply to by tormyvancool

> "Since it's not an overestimation, it's what I already told."
The overestimation I was alluding to wasn't about how many time and effort a single keypress solution (which you now have) saves you in your particular flow. The overestimation imho is about how many other users use that identical flow. Including how many of them will always use the same directory for their score file(s) as well as their DAW project source files.
For me, that at least already isn't true (then again, I usually export audio from MS to further processing, especially once MS has VST support).

> "[...workflow description...]"
Thanks for sharing it. I agree that in your flow this process makes sense and is likely also the better approach over using direct MIDI out.

> "Now, I thought that implementing this solution INSIDE the Program, it goes to the advantage of many ppl that normally are NOT familiar with coding, looking for scripts etc"
Yes, having a function natively integrated is an improvement for discoverability. Although for this function and taking into account the limit of available (default) shortcut combinations I'm fairly certain that this action would not get a default shortcut assigned if it were implemented.
It means those people would still have to be made aware of this option somehow and need to activate a shortcut for it.

To that end, having the plugin already available today (yes, having those users go and download it is yet another hurdle, but far from having them coding) is an immediate improvement you can get today without any effort from the MuseScore team. Furthermore if the plugin proves to be popular enough, it facilitates shipping it in a future version because at first MuseScore could simply ship the plugin file and make it available pre-installed (as it does now with some basic/tech plugins).

> "I got a sensation of "We can't" rather than "we can" mindset (my sensation) but as I said: it's fine."
I'm sorry you got that sensation, especially after (and repeated here) the recommendation to get your current solution out there as fast as possible by registering it in the plugin listing.
To further clarify the sensation you felt; it is one from a user/occasional contributor trying to understand a use case; coming from a different world and indeed not getting things that come almost naturally to you. It is the "scrutiny" of someone trying to evaluate whether they should invest their free time (for free) into your proposal and trying to guestimate the benefits of it. In this case in particular for me compared to the by now almost readily available solution (the plugin you came up with).
Nothing more, nothing less.

As for the path difference in scripting, you should be able to use the forward slashing path method without issue on all platforms, which for example the UltraStar Exporter plugin does

> "At this point, I should consider this use-case ignored by the manufacturer. It's a pity. We spent more time to talk than to do , but it is what it is :-)"
This might be the vibe of the "sensation" you had talking, but to clarify once more.
* This is an open source project and for a big part new features are community/volunteer driven; there is/was no manufacturer involved in this request.
* If you want to spend some time "to do" over "to talk", then please re-consider the advise to add your plugin to the plugin listing page. That way we can at least in the future refer others that might benefit from your exact workflow to a decent and helpful resource.

In reply to by jeetee

First of all thank you to have explained the position, this helped me to remove the bad sensation I had

"This is an open source project and for a big part new features are community/volunteer driven; there is/was no manufacturer involved in this request."

Well ok, So far I understood MuseScore it's not exactly Open Source since MuseScore si a BVBA hence a Company :-)
I think you are referring to the scripting perhaps? ...

In reply to by tormyvancool

The notation software itself is a public open source project.
The company (or rather the Muse Group holding) "donates" a team of programmers and designers to aid in the development of the software together with the community. The company also takes ownership of the release management.

Besides the open source desktop notation software, the company also maintains a commercial score sharing platform and closed source mobile companion player apps over at the .com domain. See also for a quick summary

In reply to by jeetee

Thank you so much for the clarification.

Back to the topic, I really hope in the future release this quick xport can be integrated directly. Really it helps to speed up,

Because one should also think: yes the code is published somewhere and can be found.
To the other side, many users:

A - They havenot even clue it' possible to do this operation, 'cause is not reported anywhere in fact,
B - They don't think it's possible via a plugin
C - Being not programmers/coders, they not even clue how to do it in case they guess "perhaps it will be possible via plugin"
D - the majority of users in Studios, are not "nerds". They want things in which they just push the button and they want to get the result (the shortest way as possible)
E - It should work on PC as well as on MAC (it's one of the major concerns, each time a Script/Plugin is proposed on any Application)
F - etc etc etc

Just: it will be nice in this way.

Yes above in the comments we were discussing about also the other exports type.
but considering what's done in a Studio, if ever I should prioritize which export needs more this way, it's the MIDI Export. It's the most used & wanted/desired :-)

Thank you Jeetee and nice week-end

EDIT please here a tutorial I have made, that explains how to use MuseScore within Reaper.
It's just the very first setup. Then things are just fluid
As you can see it's quite "nerdy" for who is not and never being a coder.
Instead having this feature integrated, just the save the field the first time, and think just to press a key (in my case: F2). 😊

In reply to by tormyvancool

I am not a naysayer at all. I'm just saying that there is more to export than just pushing a button that should be considered. I, for one have almost no use for midi export. Plus, there is often some configuration that needs to be done.
I think many users open MuseScore and think that because it is free, then it can't have much capability. So they don't look at the manual and can't figure things out on their own. That's just the nature of computers. We expect them to do everything, and as quickly as possible, so that we put in as little work in as possible. I'm a mouser. So shortcuts don't always mean anything to me. So for me, three mouse clicks to export something is not a problem. I can do it with one hand and without moving that hand. I need two hands to do most shortcuts. Of course, Shortcuts and plugins need to be there for those that can use them. But not everybody does.

In reply to by bobjp

I tell you more that adds meaning to a preconfigured function instead of macro🙄 MuseScore often is glitching with Macros.
The above macros are often working; Not always.
Many ppl (I stumbled also upno), are lamenting that the code does'nt save the file.

I solved just restarting MuseScore. Other ones, just got some not-visible character in it and the execution was not going well.

This is bad UX. Not certainly the UX needed by who's working in Studio, he/she's not nerd and needs just that it works.

As well as, the very first time you save the MIDI file (when it has to be egnerated) you need to go File > Export > MIDI.
A pre-configured feature, instead, works differently:
IF the file doesn't exist, then it asks the file name then saves it.
ELSE overwritess the file, updating it

In other words, it will be way more practical for the final user, preventing her form several issues.

In reply to by tormyvancool

All I'm saying is that a pre-configured feature is fine. But it needs to be available for all types of exports. Not just midi. The question then is do we need a button for each type of export? That takes up a lot of space. And what about configuration within each type of export?
I don't think I've ever had a problem saving a file.

In reply to by bobjp

Well it depends. For instance: When I work of course I use 2 times PDF over 20 times MIDI.
because PDF is when the work is finished, but MIDI is when I'm working to produce.

Hence, a button to export MIDI has not so much sense rather than the one exports MIDI (see the tutorial).

In the case of PDF to go to File > Export, is not time expensive like the one for MIDI (which is heavy in the long term)

In reply to by tormyvancool

I understand that for those people who use a workflow like yours where they are using MIDI export rather than simply using MIDI output or JACK to connect to their DAW, the MIDI export is going to be more common. But that might literally be you and only you - I don't think I've ever heard of any other DAW users using a similar approach. Most people running DAW software simply connect via JACK. MuseScore 4 will use a different scheme entirely that also allows for VST instruments to be played directly within MuseScore, so the issue might be moot.

Anyhow, I can see how functionality like this could be useful for you right now, so I'm glad you have the plugin. I would say, once there is evidence that there are many other people doing similar things, and that MuseScore 4 doesn't solve the problem that led to to resort to this, then the possibility of a native one-click MIDI export could certainly be considered.

In reply to by Marc Sabatella

The fact you never heard is not the reality out there.
Since to link MuseScore or Sibelius with the way you told, is the most unpractical way that doesn't even guarantee the sync.

And in many cases, where ppl is still using that solution, is because they didn't get any alternative and more practical way.

That's why I created that tutorial. To make them know that there is a possibility.
I have not clue with other daws, but certainly within Reaper, it's possible.

Already a couple of colleagues implemented this, because (as I said above) it's te "missing ring".

Other ones, using other daws OR ignoring this possibility (ppl they even don't search so much, as they should), just give up. and then "jack" or "loopbe" etc ... I di use also other tools, like LoopMIDI.

In reply to by tormyvancool

Indeed, it's certainly possible there are other users doing what you are doing and experiencing similar issues - they just haven't posted here. The people who post here about their experience with DAW software mostly use JACK, as I said, and seem happy (except when they can't get JACK to work, which does happen sometimes).

As with all feature requests, this would tend to be prioritized based on the amount of interest from other users. If we get dozens of similar requests, it would certainly be considered!

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