How to get started programming in MuseScore?

• May 22, 2021 - 16:10

I dont know how else to ask the question other than the way the title reads.

There is lots of stuff I would like to see MuseScore do, but - after much asking, inquiry and reflection on the way the community works - I think the only way I am going to really get the result I want is to do the programming myself.

This is easier said than done.

The MuseScore architecture is huge. I'm linked to it on GitHub, but navigating through all the code is different. Is there a way to get some guidance on where to begin working with it?


Absolutely, see the Development page under "Contribute" above - tons of useful info there, not the least being links to the Discord server for further discussion!

In reply to by Marc Sabatella

I appreciate the opportunity to collaborate, but I am still learning my way around, so please bear with me.

I managed to login and get setup on both Discord and Github.

There's a number of people I am seeing on Discord right now. Is there a more or less appropriate way to begin talking with people? Is it okay to message mods (mentors) directly while getting setup?

To set to work, I think I am going to need to download the raw code from Github, pull it into an IDE and start exploring. What do I download off of Github to familiarize myself with the structure of the program?

Once I download it, I will have to open it in an IDE, and, when I do so, I would like to see the macro you described both as it is coded and how it functions.

I also downloaded the plugin JeeTee referenced below. It sounds like fascinating stuff. But I cannot really compare these things until I look under the hood, see how it they work, etc... If you guys could direct me to the source code to find this stuff to begin working with it, then I think I will be good to go.

Thank you for your help! :)

But also, you might consider following up to your recent post about navigation and selection, to respond to the comments already made there. It seems most of what you are asking about already exists, but perhaps you'd like to clarify there. If there truly are missing features, that thread would be a good place to start brainstorming solutions before you dive into attempting to implement them!

In reply to by Marc Sabatella

Thank you. I will join up in the Discord discussions, too.

But - to note - JeeTee's response to my questions about navigation were not unhelpful. In one way, I kind of just want to learn to program C++ and Python (more deeply), and I'd like to work in terms of a nice application. I like music, and I like MuseScore, so it just seems like it would be a nice, robust learning environment. In this respect, the question really isn't just about music or MuseScore per se, although they might benefit from the work - but the focus is learning programming to develop ideas I'd like to experiment with and which may benefit music and MuseScore in turn.

That said, I would like to elaborate and build upon the Navigation post, which I will address over there in a minute.

But for a little experiment here, I'd like to do something very simple...

  1. Make a menu item in the main menubar.
  2. Make a function, which - when activated - will record all MuseScore commands until it is turned off. This would essentially be a macro generator, like Photoshop actions, where each individual command (and its parameters) would be stored in an array or some other suitable storage container. It will ultimately form some kind of flat file of the command, perhaps in a plugin form. But the idea here is to create a function that will first build the macro.
  3. Link the menu item in #1 to the script in #2.
  4. Make a second menu item in the main menubar to run the macro.


I dont think it has to be complex, or applicable to all the MuseScore commands, although it would just have to record them. Complex commands, which have too many user prescribed variable assignments, would make implementing a macro difficult. But simple commands, where the variables are known - would seem to work okay.

This brings up a unique problem I dont know how to address. Since if such macros were to be run, then they might well mess up, crash, and generate irrelevant commands to particular scripts, create unwanted effects, etc.. In other words, even if such a buggy function were to somehow make it through all the social objections and hurdles, it would be in no condition for effective public distribution.

I am not sure how to get help with such kinds of development on Github. But I'd have to be able to experiment with the app locally to get it to work right. I dont know what you would call a "pre-Beta" development version of an app, but it seems like whatever a "pre-Beta" development version of an app is called - would be a helpful term to know, so I can do a search on it to learn more.

So okay, now, I will hope over to the Navigations post to say a bit more there.

In reply to by myMelodies

There already is a bit of macro functionality built-in, not officially supported but used internally for testing / debugging purposes. You can activate it if you run MuseScore from the command line with the "-d" option (I think that does it, you might need an actual debug build as well depending on your OS). I think cleaning up that existing facility and putting a nicer UI on it would be a fine project - but I also think you are right to be concerned about the possibility of this turning into an effective own-foot-shooting device :-)

In reply to by Dylan Nicholson1

Will keep an eye out for you, too, if you like.

There's power in numbers. So I'll cover you.

I dont profess to be a great programmer, but I can get around okay.

And, when all else fails, I do what my genius boss taught me. A mathematical prodigy, he was of Scandanavian descent. Hailed from the Vandals and Visigoths, and he bestowed on me a Viking truth that allows one to pass through the gates of Valhalla.

And, that is...

When all else fails - go berserk...

That said, let us set all vandalism aside, yet constructively pursue coding in C++ with a great sense of divine madness undaunted.

In reply to by Marc Sabatella

I'll take tomorrow to get going on setting up the resources that have been suggested so far.

Chances are I wont understand much of the existing macro, and I'll probably tend toward rewriting the function the way I see it in my head... there's not much in there, so it shouldn't be too hard to find... the only problem seems to be the electricity is out, and the lights are off... so I'll be batting around in the dark...

I dont think I will be able to get my idea to work for all commands. But if I could get it to work for some commands, even if to save just a few steps, then it might be at least a bit useful for plugin creation - which is a whole other topic, I know, but if I can get the algorithms to form a basic list of commands in an array or something, then it seems like turning it into a plugin is only a question of translating the list into the proper format (or what might simply be called "file conversion")... the result could open up a whole lot of lovin' goin' on for the end users... because then people could just use the macro to build, at least on a basic level, the plugins...

The last time I asked about plugin development, like years ago, the plugin aspects of MuseScore were existent, but not well established or focused. And, then - in an unrelated incident - I went mildly insane trying to figure out another coding problem altogether. Anyway, plugin development seems to have become more advanced in more recent versions, and - after years of therapy - I am a new man... a lot better at python... that's fer sure... so, anyway, it may be possible to explore the areas of plugin development to make the macro utility more accessible to lower-level users (that is. by converting and exporting the macro's command list into a plugin somehow).

BTW, Blender (the free 3D application) has a way of doing this already, which can be seen here in 3 mins:

Given all we have been discussing, we might be able to follow a similar workflow in MuseScore... I realize comparing 3D and MIDI notation might seem like comparing apples and oranges, but there are viable connections to midi in Blender (not shown in anything mentioned here)... But the thing is, Blender is like MuseScore - it's an awesome app, a free one, and it has a huge following based upon an open source community... If I cant figure the above out by myself here, then I might ask someone over there (or even someone here who uses Blender, too) to see if they could drum up any ideas. That would be super cool both ways.

Trying not to make it too complex, though.

In reply to by myMelodies

If you're just looking at making modifications for your own personal use, you are of course free to do as you please. But if you have any thoughts about making improvements for the benefit of all - to have your changes merged into the main code - then it is very important to discuss your plans first and reach consensus on the overall approach and the design. There would have to be very good reasons to ignore the excellent and well-tested existing facility and duplicate its functionality in another.

In reply to by Dylan Nicholson1

The info in this thread (which is still taking shape) should remain pretty valuable for newbies, at least for awhile.

That is one of the things I had hoped to establish in case someone gets lost. Early phases of any project are usually the more transitional ones, so it's good to lay a solid foundation and focus. Lest potentially good people get lost and fall away.

In reply to by Dylan Nicholson1

BTW, it might seem like secondary info, but do you think it would be worth posting links to free IDE's for Python and C++?

I haven't looked into the updates for Plugin Development, but if I recall correctly, Python can be used for Plugin Development in MuseScore. I normally use Anaconda and the Jupyter notebooks for Python, but I am not 100% on how well Anaconda/Jupyter might interface with MuseScore. The process seems worth considering, even if outside the scope of MuseScore per se.

For C++ and the main architecture, I have CodeBlocks installed, along with some other Text Editors - again including the Jupyter Notebooks. I am not sure if they have a compiler for C++, but I imagine someone must have configured a good, free and reliable C++ compiler for use in Anaconda/Jupyter.

It seems worth considering whether some mention might be made of recommended IDEs/Compilers, as well as interpreters and dev apps for interpreted languages, like Python.

Thoughts and recommendations, please?

In reply to by myMelodies

For what it's worth, the handbook already mentions Visual Studio and Qt IDE in the build instructions ("Compilation" section). I'd imagine if anyone had reasons to use an alternative IDE, they'd have the skills by which to utilize their own preferences for building with CMake or what have you.

Based on, it looks as though plug-ins are based on QML/QtQuick, so Qt Creator would probably be choice. If someone wanted instead to use alternatives, again, it could be imagined that to intend to do so would be accompanied with the knowledge of alternatives. Ah, programmers and their alternatives...

In reply to by worldwideweary

(THIS TURNED OUT TO BE MORE OF A THANK YOU NOTE THAN A TECH QUESTION, but I also wrote it out just to note my thinking as a newbie...)

Actually, what you just said there ( worldwideweary • May 24, 2021 - 21:43) was what I needed to know... :) so I really appreciate it...

FWIW, I have to confess, I have a love hate relationship with manuals. Generally, what I want to do is just get to work, and hopefully the app itself will be intuitive enough to figure out without having to go to the manual. And, if I end up having to go to the manual, I will still want to check with a human first, as in this forum. But therein lies a danger, as people might be mean about the question, or it might simply go ignored. On my end, I have ADD and Aspergers, so what I seek from humans is usually some kind of more-than-obvious-cue as to where to look next; one that is almost stupidly obvious and self-evident. Finally - with respect to the manual itself - whether I love a manual or not depends on how well it is written. MuseScore's manual is generally well written, so the problem here is usually just knowing exactly where to look.

As per the IDEs, I just jumped into this, and I didnt think much about design environments and compilers, or even Discord as a support resource, so I am having to learn a lot of stuff many people take for granted.

With respect to CodeBlocks, I didnt know both MS Visual Studio and Qt IDE are FREE, as VS used to be a paid app back in the day when Moses and I parted the Red Sea.

Anyway, I really appreciate your help, or I wouldnt take time to write a long thank you note like this. I will post what I found to my link list above.

Ehhh... once I get VS and Qt installed and running... what MuseScore build do I download from Github? If I install an IDE and compiler - I'll need to have two things... something to compile, and the knowledge of how to compile it... :) I can usually get the latter off of YouTube, but what to compile is a bit different... :)

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