Yeah!
The scripting/plugin system is really simple but that is also what can make it extremely powerful.
I'm actually quite proud of that addition
As you noted, the scripts do not have to be written in python. Instead it simply executes an external program and reads back the output. (I think this was the reason it wasn't called script before. It doesn't have to be scripts. But Python is really the best language to use for writing them. Pretty easy to learn yet incredibly powerful.
As for my use case above, changing velocity of one explicit note, I took the time and wrote that little script now, checked in as ConstantVelocityForNote, complete with a little dialog to select the note.
Incidentally I found that what we call C3 is C4 in some documents I found on the internet, didn't we already go over this? Or is the world so divided that there isn't one right?
For anyone curious, here's a condensed version of the above script, without gui. It requires that you edit the script before using it but sometimes that is a better solution.
Code: Select all
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# MusE external midi processing script
import sys
fileToProcess = open(sys.argv[1],"r")
inputEvents = fileToProcess.readlines()
fileToProcess.close()
selectedNote = 60
newVelocity = 100
outputEvents=[]
#loop through events
for line in inputEvents:
if line.startswith('NOTE'):
tag,tick,note,length,velocity = line.split(' ')
if int(note) == int(selectedNote):
outputEvents.append("%s %s %s %s %d\n"%(tag,tick,note,length,newVelocity))
else:
outputEvents.append(line)
else:
outputEvents.append(line)
fileToProcess = open(sys.argv[1],"w")
fileToProcess.writelines(outputEvents)
fileToProcess.close()