Automation adjustments for Tools->Structure operations

MusE is a MIDI/Audio sequencer with recording and editing capabilities, aiming to be a complete multitrack virtual studio for Linux. https://muse-sequencer.org/

Moderators: MattKingUSA, khz, spamatica

Post Reply
spamatica
Established Member
Posts: 278
Joined: Mon Feb 08, 2010 10:38 am

Automation adjustments for Tools->Structure operations

Post by spamatica »

The structure operations (Functions->Structure) are very useful but have for a very long time had various stability issues. Tim fixed that up for 3.1 I think.

Now one more improvement makes them even more useful as they should adjust automation correctly when cutting and inserting. Available in git master.

User avatar
oscillator
Established Member
Posts: 207
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Contact:

Re: Automation adjustments for Tools->Structure operations

Post by oscillator »

Wow, either I have been ignorant, or a lot of things have happened here! :)

I haven't even seen the Midi Transform! And the Structure tools will be very useful, especially the Global Split!

A month ago I looked at the Piano Roll > Plugins, as they are easily editable Python scripts. I wanted to change the tempo of selected notes. But they operate on the midi "file" data, which is confusing.

Is there an API for scripting MusE? I would love to be able to change the speed of selected midi data. This could be an interesting starting point to contributing to code for me (I have a background as a programmer).

Thank you for all these tools, will have to check them out in depth!
MusE DAW running on Debian 10 Stable/XFCE4.
https://oscillator.se/musik

Tim E. Real
Established Member
Posts: 373
Joined: Sat Sep 15, 2012 12:36 am

Re: Automation adjustments for Tools->Structure operations

Post by Tim E. Real »

See README.python about remote python scripting:
https://github.com/muse-sequencer/muse/ ... DME.python

Also in the main README there is some installation info that differentiates between the
simple 'function' scripts and the full remote scripting discussed in README.python. (They are different in nature.)

User avatar
oscillator
Established Member
Posts: 207
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Contact:

Re: Automation adjustments for Tools->Structure operations

Post by oscillator »

Tim E. Real wrote:
Mon May 25, 2020 8:12 am
See README.python about remote python scripting:
https://github.com/muse-sequencer/muse/ ... DME.python

Also in the main README there is some installation info that differentiates between the
simple 'function' scripts and the full remote scripting discussed in README.python. (They are different in nature.)
The remote scripting looks very cool and powerful, thanks!

I have been looking at the scripts here: muse/muse3/share/scripts/
and they operate on the "midi file" (.med content), right?

I was more thinking of an API to edit the midi data directly without affecting what is saved.
MusE DAW running on Debian 10 Stable/XFCE4.
https://oscillator.se/musik

spamatica
Established Member
Posts: 278
Joined: Mon Feb 08, 2010 10:38 am

Re: Automation adjustments for Tools->Structure operations

Post by spamatica »

oscillator wrote:
Mon May 25, 2020 8:36 am
Tim E. Real wrote:
Mon May 25, 2020 8:12 am
See README.python about remote python scripting:
https://github.com/muse-sequencer/muse/ ... DME.python

Also in the main README there is some installation info that differentiates between the
simple 'function' scripts and the full remote scripting discussed in README.python. (They are different in nature.)
The remote scripting looks very cool and powerful, thanks!

I have been looking at the scripts here: muse/muse3/share/scripts/
and they operate on the "midi file" (.med content), right?

I was more thinking of an API to edit the midi data directly without affecting what is saved.
Oh, I almost forgot about the python interface. It's better documented than I remember.
Apart from the README, I guess we should start referring to the wiki instead :)
https://github.com/muse-sequencer/muse/ ... te-control

--
I see you found the scripts folder, there is a README.txt file there (which I now included - and updated a bit - in the wiki too https://github.com/muse-sequencer/muse/ ... ile-format)
Not sure what you mean by "file" data in this case, these scripts are not for manipulating .med files
The protocol for manipulating midi data is sent to the plugin via a file but that is just a convenience, the format of the data should be pretty straightforward.

Here is an example of the dataformat:
TIMESIG 4 4
PART 6144 6144
BEATLEN 384
QUANTLEN 96
NOTE 1536 65 96 70
NOTE 2400 69 96 70

As for the parameters in NOTE I think they are
NOTE <position in the part (in ticks)> <pitch> <length (in ticks)> <velocity>

Not 100% sure what you mean by changing tempo of selected notes but there is the existing script DoubleSpeed that maybe can be used as a starting point.

User avatar
oscillator
Established Member
Posts: 207
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Contact:

Re: Automation adjustments for Tools->Structure operations

Post by oscillator »

spamatica wrote:
Mon May 25, 2020 10:44 am
Not sure what you mean by "file" data in this case, these scripts are not for manipulating .med files
I didn't know what I was talking about! :)

But now I now. Thanks for updating the wiki!
spamatica wrote:
Mon May 25, 2020 10:44 am
Not 100% sure what you mean by changing tempo of selected notes but there is the existing script DoubleSpeed that maybe can be used as a starting point.
This is exactly what I was looking for. I did a HalfSpeed script some months ago, but lost it, so I will recreate it.

The wiki is looking better and better all the time! Good work!
MusE DAW running on Debian 10 Stable/XFCE4.
https://oscillator.se/musik

User avatar
oscillator
Established Member
Posts: 207
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Contact:

Re: Automation adjustments for Tools->Structure operations

Post by oscillator »

The menu for "/muse3/share/scripts/" seems to be built compile time.

But I created a local folder at $HOME/.config/MusE/MusE/scripts
and this one is read when MusE is run.

For HalfSpeed I just took DoubleSpeed and changed the line

Code: Select all

newline = tag + " " + str(int(int(tick)/2)) + " " + pitch + " " + length + " " + velocity
to

Code: Select all

newline = tag + " " + str(int(int(tick)*2)) + " " + pitch + " " + length + " " + velocity
or, even better, change the length too:

Code: Select all

newline = tag + " " + str(int(int(tick)*2)) + " " + pitch + " " + str(int(length)*2) + " " + velocity
In DoubleSpeed the line should read:

Code: Select all

newline = tag + " " + str(int(int(tick)/2)) + " " + pitch + " " + str(int(length)/2) + " " + velocity
:)

Could this be my first code contribution to MusE? :)
MusE DAW running on Debian 10 Stable/XFCE4.
https://oscillator.se/musik

spamatica
Established Member
Posts: 278
Joined: Mon Feb 08, 2010 10:38 am

Re: Automation adjustments for Tools->Structure operations

Post by spamatica »

oscillator wrote:
Mon May 25, 2020 10:36 pm

Could this be my first code contribution to MusE? :)
Indeed it could :)

If you want to go the extra km (then you are all set for coming contributions), you could read up on creating a pull-request for your changes on github.

There are some hoops to jump through but it can be a good learning experience.

User avatar
oscillator
Established Member
Posts: 207
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Contact:

Re: Automation adjustments for Tools->Structure operations

Post by oscillator »

spamatica wrote:
Tue May 26, 2020 8:41 am
If you want to go the extra km (then you are all set for coming contributions), you could read up on creating a pull-request for your changes on github.

There are some hoops to jump through but it can be a good learning experience.
That's a great idea! Give me a few days to read up on it! Do I need any special permissions to do so?
MusE DAW running on Debian 10 Stable/XFCE4.
https://oscillator.se/musik

User avatar
oscillator
Established Member
Posts: 207
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Contact:

Re: Automation adjustments for Tools->Structure operations

Post by oscillator »

Following this guide: https://medium.com/javascript-in-plain- ... f777623f18

I have done steps 1-6. Forked the repos, created a branch named muse-1-python.

Then I made the following changes:

modified: muse3/share/scripts/CMakeLists.txt
deleted: muse3/share/scripts/DoubleSpeed

changed/added:
muse3/share/scripts/SpeedDouble
muse3/share/scripts/SpeedHalf

Step 7-8? Where is this file. And how do I commit the changes?

I get the messages:
On branch muse-1-python
Changes not staged for commit:
modified: muse3/share/scripts/CMakeLists.txt
deleted: muse3/share/scripts/DoubleSpeed

Untracked files:
muse3/share/scripts/SpeedDouble
muse3/share/scripts/SpeedHalf

no changes added to commit
So step 9 (push) doesn't really do anything, which means I can't do a pull request.

EDIT: Made the changes via the webb-interface for GitHub and did a pull request. First time for me, so please bear with me for making any errors.
MusE DAW running on Debian 10 Stable/XFCE4.
https://oscillator.se/musik

spamatica
Established Member
Posts: 278
Joined: Mon Feb 08, 2010 10:38 am

Re: Automation adjustments for Tools->Structure operations

Post by spamatica »

oscillator wrote:
Tue May 26, 2020 11:48 pm
Following this guide: https://medium.com/javascript-in-plain- ... f777623f18

I have done steps 1-6. Forked the repos, created a branch named muse-1-python.

Then I made the following changes:

modified: muse3/share/scripts/CMakeLists.txt
deleted: muse3/share/scripts/DoubleSpeed

changed/added:
muse3/share/scripts/SpeedDouble
muse3/share/scripts/SpeedHalf

Step 7-8? Where is this file. And how do I commit the changes?

I get the messages:
On branch muse-1-python
Changes not staged for commit:
modified: muse3/share/scripts/CMakeLists.txt
deleted: muse3/share/scripts/DoubleSpeed

Untracked files:
muse3/share/scripts/SpeedDouble
muse3/share/scripts/SpeedHalf

no changes added to commit
So step 9 (push) doesn't really do anything, which means I can't do a pull request.

EDIT: Made the changes via the webb-interface for GitHub and did a pull request. First time for me, so please bear with me for making any errors.
Oh, I wasn't even aware you could do it completely through the web. :P The actual pull request I usually do through the web interface though.

Regarding the guide you were following it looks like one step was left out.
After editing the files you need to 'add' all files you want to belong to the commit.

E.g.
git add muse3/share/scripts/CMakeLists.txt
...
and then
git commit
git push
<and then the method for doing the pull request>

...
Checking what you changed can be done with:
git status (which will show all files that have changes, and all files that are untracked (new files))
git diff <filename> (to see what your changes were)

git is a pretty complex system and it is possible to get completely lost but you can get very far with 'add,diff,status,commit,push,pull' commands.
https://xkcd.com/1597/

User avatar
oscillator
Established Member
Posts: 207
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Contact:

Re: Automation adjustments for Tools->Structure operations

Post by oscillator »

Thanks a bunch, will use the CLI next time!
MusE DAW running on Debian 10 Stable/XFCE4.
https://oscillator.se/musik

Post Reply