how to generate parts, setting volume and export the parts by using a batch file (or plugin)?
I would like to automatically
- open a MuseScore file (if using a batch file / using the active score in MuseScore if using a plugin)
- generate parts for all voices within this file
- then: for each part / voice in that file:
- - set the volume for this voice to eg 75%
- - set the volume for all other voices to eg 25%
- - generate a mp3 export for this voice
- and finally close the file without saving it
This is for a choir, and all the MuseScore files I use have only voices as "instruments".
Is there a way to accomplish this using a batch file / shell script? Or by using a plugin?
(I've read of the batch convert plugin, but guessing from the description is does not seem to be able to generate parts or set the volume automatically.)
I could try to create my own plugin, if someone could point me into the right direction (and if the methods needed to accomplish this are available).
Any help appreciated. Thanks.
Comments
Far easier to teach the choir members to use the score itself in MuseScore and operate thee mixer, then play.
Give a man a fish and he won't starve today. Teach him to fish and he'll never starve ;-)
In reply to Far easier to teach the… by Jojo-Schmitz
Yes, I know, and I have tried, but... there are too many choir members for which it is already difficult enough to open a mp3 file from my website :-)
In reply to Yes, I know, and I have… by msmb
Well, I know, it ain't easy to evangelize...
I don't thing the plugin framework has access to the synthesizer settings
Ok, I have found the plugin creator and its documentation, but I don't know where to start (besides creating a plugin skeleton)...
Rethinking my algorithm I need to
- iterate over all instruments/voices in the opened score
- - set the volume for the current voice to eg. 75%
- - set the volume for the other voices to eg. 25%
- - export as mp3
(So no need to create parts. So sad: I'd already found a property Part.volume...)
Is there some sample plugin or some other plugin which I can look into?
In reply to Ok, I have found the plugin… by msmb
I have just in the past week done what you want by hand for my church's choir with our music for the Christmas praise service. I am don't know anything about the plugin framework, but I am willing to start learning it with you and help you do this, because it would be a very handy plugin for me to have, too. ;-)
You can contact me via my personal contact form in by clicking on my username above this comment, then clicking on the Contact button. Looking forward to hear from you.
In reply to I have just in the past week… by Louis Cloete
Thanks for the message you sent me via my contact form. I can't, however, reply to you, because you didn't enable your contact form or sent me your email address in your message to me. I would need either to be able to reply to you personally. In the meantime, I am going to post the reply I wanted to send to you here, because @jeetee would also have interest in it. So here it is:
Hi ***!
I am starting to suspect you are trying to tackle this problem in a way MuseScore isn't designed to handle. I don't think the Mixer is the route you should follow. Fortunately, there is a better way. I will describe my manual method to you. I think (from my limited programming knowledge and what I have seen thus far by digging into the MuseScore source and Plugin documentation) that a plugin is indeed possible that would do what I did manually, automatically.
My procedure is as follows:
*For example alto:
I think we should try using velocity properties of each voice rather than trying to use the Mixer. MuseScore's Mixer does not yet have the functionality we need, even if it were exposed through the plugin framework.
Louis
In reply to Thanks for the message you… by Louis Cloete
This is a procedure for Close Score SATB, where S and A share one staff and T and B another.
Another method for this would be to use the attached template and 2 staff texts (one for each staff, attached to the very first chord or rest), switching voice 1 to Soprano respectively Tenor and voice 2 to Alto respective Bass via staff text properties and then use the 4 mixer channels.
Still won't help the OP though, as this doesn't work in any kind of batch mode
In reply to Thanks for the message you… by Louis Cloete
Thanks for your reply and your suggestion. I'm not sure whether we're trying to reach the same goal. I'm currently taking the following manual approach:
1) opening a score, which has each voice in a separate staff (Soprano, Alto, Tenor, Bass etc.)
2) opening the mixer, setting volume to 100% for Soprano, to 50% for all other voices
3) export score to mp3
4) repeat steps 2 and 3 for all other voices, adjusting volume accordingly
By this I get one mp3 file for each staff, having the current voice at full volume and the other voices at a lower volume to have some orientation.
I'm looking for an automated approach to this - and, after some research during the last couple of days and with lots of help from this forum, am close to have one. (I'll post current state in a separate entry.) The last piece I'm missing is getting the current score's path - MuseScore 1.x had a property for it, MuseScore 2.x does not seem to have this anymore. So I'll make it a config item in the plugin for now.
P. S.: Contact form should be enabled as per my account settings (green check for "personal contact form").
In reply to Thanks for your reply and… by msmb
We are doing kind of the same thing. I just started from SATB closed score and changed each note's MIDI velocity to make one voice louder than the other instead of using SATB open score and using the mixer. There are other enhancements I have in mind for the process, like to write code dealing with splitting voices (e.g. Tenor I and Tenor II), first exporting Tenor I's notes louder and all other, incl. Tenor II's, notes softer, then exporting Tenor I softer and Tenor II louder.
That is not a dealbreaker if the plugin can't do that right now, however. You can just get it working for yourself doing what you want, and then I would probably be able to extend it to do the extra stuff I want as I get more fluent in QML and JavaScript.
In reply to We are doing kind of the… by Louis Cloete
What's the meaning of "closed score" and "open score"?
In reply to What's the meaning of … by msmb
Closed score
Open score
In reply to Closed score Open score by Louis Cloete
Ah, thanks. I'm always learning something new ;-)
I'm still not used to many of the specific terms of music, especially in a foreign language, it's sort of double translation for me ;-)
In reply to Ah, thanks. I'm always… by msmb
Don't worry, before being involved with MuseScore I didn't know this either
In reply to Ok, I have found the plugin… by msmb
Current state is: I finally got a plugin skeleton to show up in the plugin manager AND to make the plugin manager show description and version information (the latter two did not show up at first, even after refreshing plugins or restarting MuseScore).
Now I need to
- retrieve the name of the current score => curScore.name?
- iterate over all staves => 0 .. curScore.nstaves-1?
- access and change the volume settings for each stave individually => how to?
- export current score as mp3 => writescore(curScore, "test", "mp3")?
The text after the "=>" is my guess. Are those guesses correct?
Where to find further documentation on creating a plugin?
How can I output some text or other information visible to the user? I've seen console.log() commands in some plugins. But where is this debug message printed to? Do I need additional software to make those debug messages visible?
In reply to Current state is: I finally… by msmb
I installed sysinternals DebugView, which seems capable of capturing MuseScore's debug output.
Reloading plugins lead to a couple of debug messages, closing plugin manager as well.
But when running my basic plugin (which mainly consists of a console.log() statement, besides the skeleton) it only outputs:
[6236] QQmlComponent: Component is not ready
[6236] line -1: File not found
???
current plugin code is:
In reply to I installed sysinternals… by msmb
console.log()
writes to the console window below the code editor of MuseScore's Plugin Creator itself.Save your efforts; the mixer isn't exposed to the plugin framework currently.
If you're any good in other scripting languages, you could save your scores as mscx and have script generate derived mscx files in which the volume levels have been adjusted, then batch-convert these to mp3's. But all of that needs to happen outside of MuseScore currently.
In reply to Save your efforts; the mixer… by jeetee
Thanks for your reply, I've filed a feature request already... :-)
As for the way you've suggested:
- I recognize that mscz files are ordinary zip files
- root file is named in file META-INF/container.xml <rootfile> tag
- and normally points to the mscx file in the root path of the mscz file, which is in xml format
- I'm fine with scripting xml & zip file manipulation
But: How can I influence the mixer volume settings in the mscx file - what are the attributes needed for this (or where can I find some documentation for the mscx xml-format)?
current state is the following plugin code:
In reply to current state is the… by msmb
See also the comments in the Feature Request forum: https://musescore.org/en/comment/871386
To finish this old thread:
I've switched to direct manipulation of the score's xml (as proposed by @jeetee a while ago). That's proved to be much easier (for me) than trying to do the same with MuseScore's plugin interface.
By this I'm now able to:
- create different versions of the orginal score, like "training", "Karaoke" and "Solo" versions (= different combinations of volume per voice, eg: "training for Alto" => "Alto @100%, Soprano, Tenor, Basso @50%")
- replacing instruments (some would like to have "Grand Piano" as instrument instead of "Choir Aah"
and generating all the different variants in a few minutes with just a single program call per MuseScore file.
If someone's interested in this PHP script I can either post it here or send it via PM.
In reply to To finish this old thread: I… by msmb
I ended up with quite similar solution. Through, my script is implemented with powershell. It exports mp3 audio files for different parts with proper volume settings, previews (plays) them during the export process, and finally uploads the audio files to our choir's Dropbox score bank.
Today I also finished a MuseScore plugin that implements a simple GUI for the script. It starts the script with selected options and is capable of interacting with the script in run-time.
What a nice powershell, xml, rest api, oauth, qml, and musescore plugin api excercise.
In reply to I ended up with quite… by terssi
I searched a lot to find a plugin like that. Could you please share yours?
In reply to To finish this old thread: I… by msmb
Hi, since I don't have any experience with manipulating scores with a script I would appreciate it if you could post your PHP script here. I promise I won't complain that it doesn't fit my precise use case, just to give me and others who create training scores for their choir a starting point. Thanks in advance.
In reply to To finish this old thread: I… by msmb
@Matritz - I would love to have that, please! Pasted here or in a PM, either way works for me.
In reply to To finish this old thread: I… by msmb
Hey, I would love to use your script on my choir pieces to create rehearsal mp3s. Could you send it to me?
In reply to Hey, I would love to use… by Martin_Lorenz
I'm currently on vacation, can't send the script right now. Will look into it in a couple of days (and if I should forget it, kindly send me a reminder here).
But one prerequisite should be stated: To be able to run my script, you'll need to have a local PHP installation on your computer - does that work for you?
In reply to Hey, I would love to use… by Martin_Lorenz
Sorry, took me some time to set up a GitHub repo and polish the script a bit.
You can find it now here: https://github.com/moving-bits/msexport
If any question arises about how to use the script, feel free to ask either on GitHub (discussion) or here in the forum.
In reply to To finish this old thread: I… by msmb
Dear All, @M.Thum helped me out with a powershell script long time ago. I used that as a base for a python script which I'm happy to share as-is (sorry I cannot provide any support; you'll have to figure it out on your own). It works with Musescore 3.6 only at this point.
You will need a python installation and terminal skills, and obviously some python skills to get it working.
Basically you give it the musescore file and it exports MP3s including MP3 tags (and also other formats like mscx with continuous view and colored parts to prepare for a video recording). The instruments and volumes are somewhat hardcoded but customizable. Set instruments to white color in the mixer if you want the script to leave them as they are. I'm running it on a Mac; to run it on Windows you will have to play around a little.
Hope this helps. I'm also very interested in any solutions you might have...