Old 01-02-2018, 07:51 PM   #1
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default LuaScripts: Convert MIDI notes to items

Multiple users had been requesting this over the years. Lets you convert MIDI notes to media items in one go.
Both scripts can be used for any number of MIDI items that are are on the same track.
New media items insert on subtrack(s), respectively. These subtrack(s) are created where you want them.

As usual, available from: https://github.com/bfut/ReaScripts


HOW TO USE:
1) Select MIDI item(s), all on the same track.
2) Select a track. (optional)
3) Run the script.


HOW TO USE ITEM LOADER:
1) For K newly, by the script, created subtracks, the first K media items from the initially selected track are inherited.
2) If the initially selected track contains fewer than K media items, fall back to empty takes.


HOW TO TOGGLE ITEM LOADER:
1) In the code, set script_config["item loader"] to either true or false.


bfut_MIDI notes to items (explode note rows to subtracks).lua
videoclip: https://streamable.com/5blt0 (900 KB)

Note row mode: New subtrack for every used note row. Note row names become subtrack names.




bfut_MIDI notes to items (notes to subtrack, note pitch as item pitch).lua

Note pitch mode: Creates one subtrack. Note pitch is translated to item pitch. (Default reference pitch is 60 (C4); can be changed easily in the script.)




bfut_MIDI notes to items (notes to subtrack, note pitch as item rate).lua
videoclip: https://streamable.com/y7cz4 (600 KB)

Note pitch mode: Creates one subtrack. Note pitch is translated to item playrate. (Default reference pitch is 60 (C4); can be changed easily in the script.)





News:
25 Jan 2018: New script: bfut_MIDI notes to items (notes to subtrack, note pitch as item pitch).lua
13 Jan 2018: New item loader.
07 Jan 2018: Remove dependency: MIDI property dump requires SWS package; script now again works without SWS.
07 Jan 2018: Fixing possible bug. MIDI note properties now dumped in CSV format.

04 Jan 2018: Dump MIDI note attributes to corresponding item notes.
03 Jan 2018: Scripts updated for possible bug when working off a brand new REAPER.ini.

Last edited by tufb; 01-25-2018 at 09:23 PM.
tufb is offline   Reply With Quote
Old 01-02-2018, 08:30 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

Intersting concept, thanks ! Just curious, do you plan to have an Implode version of the first script ?
X-Raym is offline   Reply With Quote
Old 01-02-2018, 10:06 PM   #3
semiquaver
Human being with feelings
 
Join Date: Jun 2008
Posts: 4,913
Default

usefull! thx
semiquaver is offline   Reply With Quote
Old 01-03-2018, 06:00 AM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,530
Default

Empty items? How to use them further?
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 01-03-2018, 02:46 PM   #5
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

News:

3Jan18: Scripts updated for possible bug when working off a brand new REAPER.ini.


Quote:
Originally Posted by mpl View Post
Empty items? How to use them further?
They are MediaItems containing empty takes. Either define a "Take media source" via item properties, or paste additional takes into them, respectively.
There's certainly a possibilty to implement some kind of item loader within the script.


Quote:
Originally Posted by X-Raym View Post
Intersting concept, thanks ! Just curious, do you plan to have an Implode version of the first script ?
Please explain.

Quote:
Originally Posted by semiquaver View Post
usefull! thx
You're welcome.
tufb is offline   Reply With Quote
Old 01-03-2018, 06:07 PM   #6
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

not on a new reaper ini... but when run I get this error:

Quote:
...MIDI notes to items (explode note rows to subtracks).lua:7: unexpected symbol near '<'
I see there is one ! there, but even if I edit that away I get the same error
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Old 01-04-2018, 05:13 AM   #7
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 1,866
Default

Did not test yet, but can be useful, thanks. I had a similar request somewhere in this forum. The idea was having a 1:1 conversion technique from midi notes to items, and the way back from midi items to midi notes.

Then you could apply techniques from midi editor to arrange view for example. Or just as a flexible arrangement organization tool. My suggestion was using midi note pitch values as take names, example a note 36, should get a midi item with item/take name '36'. Then conversion in both directions should be possible.

Having a ghost copy version would be useful. So all '36' takes would be ghost items.
TonE is offline   Reply With Quote
Old 01-04-2018, 08:13 AM   #8
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

News:

04 Jan 2018: Dump MIDI note attributes to corresponding item notes.

Quote:
Originally Posted by TonE View Post
Did not test yet, but can be useful, thanks. I had a similar request somewhere in this forum. The idea was having a 1:1 conversion technique from midi notes to items, and the way back from midi items to midi notes.

Then you could apply techniques from midi editor to arrange view for example. Or just as a flexible arrangement organization tool. My suggestion was using midi note pitch values as take names, example a note 36, should get a midi item with item/take name '36'. Then conversion in both directions should be possible.

Having a ghost copy version would be useful. So all '36' takes would be ghost items.
What's a ghost item? Anyway, good idea. MIDI note attributes, channel, pitch, muted, velocity, and
reference pitch (where applicable), are now dumped to corresponding item notes.


Quote:
Originally Posted by hopi View Post
not on a new reaper ini... but when run I get this error:

Quote:
...MIDI notes to items (explode note rows to subtracks).lua:7: unexpected symbol near '<'
I see there is one ! there, but even if I edit that away I get the same error
Very unusual, as line:7 always compares two numbers. The script is devoid of exclamation marks,
however, this particular line contains LUAs '#' operator. Something may have gone wrong on your end.
Re-download recommended: https://raw.githubusercontent.com/bf...subtracks).lua
Thx for the feedback.

Last edited by tufb; 01-04-2018 at 02:56 PM.
tufb is offline   Reply With Quote
Old 01-04-2018, 08:53 AM   #9
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 1,866
Default

Ghost copy is the term old cubase was using, what was it again in Reaper? It means, if you change one copy all other copies change in same form. Thus it is enough to edit just one, even if you have 1000 copies.

Ok, ghost copy is called pooled copy in Reaper.
TonE is offline   Reply With Quote
Old 01-04-2018, 09:00 AM   #10
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 1,866
Default

Quote:
Originally Posted by tufb View Post
MIDI note attributes, channel, pitch, muted, velocity, and
reference pitch (where applicable), are now dumped to corresponding item notes.
Not sure yet what to do with the other parameters, except pitch.

One more simple use case idea: Take any step sequencer, e.g. with 16 steps, using 1bar for each step, for creating some arrangement block which you can fill up step by step.

Having replacement actions would allow infinite quick arrangement experiments by changing patterns.
TonE is offline   Reply With Quote
Old 01-04-2018, 03:19 PM   #11
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

Quote:
Originally Posted by TonE View Post
Ghost copy is the term old cubase was using, what was it again in Reaper? It means, if you change one copy all other copies change in same form. Thus it is enough to edit just one, even if you have 1000 copies.

Ok, ghost copy is called pooled copy in Reaper.
Do you mean item groups? "Pooling" is a concept in MIDI items, whereas this scripts deals with media items.

Quote:
Originally Posted by TonE View Post
One more simple use case idea: Take any step sequencer, e.g. with 16 steps, using 1bar for each step, for creating some arrangement block which you can fill up step by step.

Having replacement actions would allow infinite quick arrangement experiments by changing patterns.
Not sure if I follow. Editing MIDI takes is not really any of the scripts business.

As far as converting MIDI takes as you edit them goes (is this what you're saying?), that's a whole new script. That would mean implementing a step sequencer
much like in FL Studio. Nothing I could handle in my spare time - and to be honest, I'd only involve myself in such a project, once Reaper dev's confirm that they won't
ever implement such a module themselves.


Here, the whole idea is to use Reaper's excellent MIDI piano roll as interface, in order to arrange media items, thus eliminating the need
for instrument plugins (which is relevant for a certain OS). Or at least that's one thinkable application of the script.
tufb is offline   Reply With Quote
Old 01-05-2018, 10:02 AM   #12
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

please see post #6 and tell me what to do about that error... thanks
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Old 01-06-2018, 06:19 AM   #13
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

My recommendation is to re-download the script, don't edit anything. Thx for your feedback.
My code is devoid of exclamation marks.

Quote:
Originally Posted by hopi View Post
I see there is one ! there, but even if I edit that away I get the same error
tufb is offline   Reply With Quote
Old 01-07-2018, 11:19 AM   #14
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

News:
07 Jan 2018: Fixing possible bug. MIDI note properties now dumped in CSV format.
tufb is offline   Reply With Quote
Old 01-07-2018, 01:54 PM   #15
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

News:
07 Jan 2018: Remove dependency: MIDI property dump requires SWS package; script now again works without SWS.

i.e. if you have SWS, item notes will be added. if you don't have SWS, the script runs as expected, but you don't get the item notes.

Last edited by tufb; 01-07-2018 at 05:25 PM.
tufb is offline   Reply With Quote
Old 01-09-2018, 04:35 PM   #16
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

Quote:
Originally Posted by TonE View Post
The idea was having a 1:1 conversion technique from midi notes to items, and the way back from midi items to midi notes.

Then you could apply techniques from midi editor to arrange view for example. Or just as a flexible arrangement organization tool. My suggestion was using midi note pitch values as take names, example a note 36, should get a midi item with item/take name '36'. Then conversion in both directions should be possible.
I've given this some more thought. The main problem I see is, that Media Items
are objects with an unique ID, MIDI notes are not. MIDI notes are only
distinguished by their properties. Making certain mouse modifiers from the MIDI
editor, available for Reapers main timeline might be an easier approach.
tufb is offline   Reply With Quote
Old 01-10-2018, 11:07 AM   #17
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

thanks for your help... I did get it to run without errors... but I must not understand something:

what I was expecting to be able to do is this:

have a drum midi track loaded from the beats of Addictive Drums
set the note map in reaper to be correct for that so kick notes are named kick, snare named snare, etc.

then run this script and get the exploded notes as items on new tracks, each track with only the notes
for each drum hit...

what I get when exploded is each of the note rows, correctly named as in note map [that is good!!]
but the items do not contain any notes....

Am I doing something wrong or do I not understand the lua's intent correctly???
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain

Last edited by hopi; 01-10-2018 at 11:53 AM.
hopi is offline   Reply With Quote
Old 01-10-2018, 04:24 PM   #18
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

Quote:
Originally Posted by hopi View Post
thanks for your help... I did get it to run without errors... but I must not understand something:

what I was expecting to be able to do is this:

have a drum midi track loaded from the beats of Addictive Drums
set the note map in reaper to be correct for that so kick notes are named kick, snare named snare, etc.

then run this script and get the exploded notes as items on new tracks, each track with only the notes
for each drum hit...

what I get when exploded is each of the note rows, correctly named as in note map [that is good!!]
but the items do not contain any notes....

Am I doing something wrong or do I not understand the lua's intent correctly???
What you are describing there, is basically exploding one MIDI item to new MIDI items,
where each contains one note row from the original item. There is already a
default action for that (search for "MIDI explode" in the action list menu).

These scripts will "convert" each MIDI note to a new Media Item, containing an empty take.
These new items can hold whatever you want them to.

Actually, I thought about implementing a take/sample loader within this script,
not sure if there's enough interest?
tufb is offline   Reply With Quote
Old 01-12-2018, 11:11 AM   #19
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

Ah thank you ... you are so correct about their being that existing action...
and now I better understand your script as well, but I'd be curious to know
what YOU do with these new media items after you run the script...?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain

Last edited by hopi; 01-12-2018 at 11:30 AM.
hopi is offline   Reply With Quote
Old 01-12-2018, 11:42 AM   #20
Arnar
Human being with feelings
 
Arnar's Avatar
 
Join Date: Jan 2007
Location: Smokie Bay.
Posts: 796
Default

I would love to use something like this if I could start with a Midi file and an audio file below , and then lock the pitch of of the audio file to the midi , as in jumping to the same pitch values , assuming base value is either C which could be offset on audio file or being able to set the base pitch in a dialog.

Or something like audio to midi which after analyzing the audio is locked to the created midi file , changing midi note changes audio item pitch.

Take this a bit further and have a ADSR and even polyphony.

Just an idea , thought I would throw it out there.
__________________
In Music We Trust.
http://soundcloud.com/hazar
http://soundcloud.com/ifthenrun
Arnar is offline   Reply With Quote
Old 01-12-2018, 04:10 PM   #21
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

Quote:
Originally Posted by hopi View Post
Ah thank you ... you are so correct about their being that existing action...
and now I better understand your script as well, but I'd be curious to know
what YOU do with these new media items after you run the script...?
Quote:
Originally Posted by Arnar View Post
I would love to use something like this if I could start with a Midi file and an audio file below , and then lock the pitch of of the audio file to the midi , as in jumping to the same pitch values , assuming base value is either C which could be offset on audio file or being able to set the base pitch in a dialog.
I've been working on an item loader somewhat like this. So far, without GUI, and config options within the script (I prefer hitting
a hotkey combo and be done with it). Will drop once some more bug-fixing is done. I shall look at GUIs onwards.

Last edited by tufb; 01-12-2018 at 04:19 PM.
tufb is offline   Reply With Quote
Old 01-13-2018, 02:19 PM   #22
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

News:

13 Jan 2018: New item loader.


HOW TO USE:
1) Select MIDI item(s), all on the same track.
2) Select a track. (optional)
3) Run the script.


HOW TO USE ITEM LOADER:
1) For K newly, by the script, created subtracks, the first K media items from the initially selected track are inherited.
2) If the initially selected track contains fewer than K media items, fall back to empty takes.


HOW TO TOGGLE ITEM LOADER:
1) In the code, set script_config["item loader"] to either true or false.



New screenshots in OP.

Last edited by tufb; 01-13-2018 at 02:27 PM.
tufb is offline   Reply With Quote
Old 01-15-2018, 05:52 PM   #23
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

[edit:redundant]

Last edited by tufb; 01-19-2018 at 12:16 AM.
tufb is offline   Reply With Quote
Old 01-15-2018, 08:06 PM   #24
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

Quote:
Originally Posted by Arnar View Post
I would love to use something like this if I could start with a Midi file and an audio file below , and then lock the pitch of of the audio file to the midi , as in jumping to the same pitch values , assuming base value is either C which could be offset on audio file or being able to set the base pitch in a dialog.
bfut_MIDI note row controls items pitch.lua now available on my github.
videoclip: https://streamable.com/hjpx8 (~1 MB / 1080p)

reference_pitch (AKA base value, AKA base pitch) is set in the script code.

HOW TO USE:
1) Open MIDI editor.
2) Select media item(s).
3) Click any note row. (click around on the piano keys to the left, that is)
4) Run the script.

Last edited by tufb; 01-22-2018 at 06:02 PM.
tufb is offline   Reply With Quote
Old 01-16-2018, 12:32 PM   #25
Arnar
Human being with feelings
 
Arnar's Avatar
 
Join Date: Jan 2007
Location: Smokie Bay.
Posts: 796
Default

This looks great , will test !
__________________
In Music We Trust.
http://soundcloud.com/hazar
http://soundcloud.com/ifthenrun
Arnar is offline   Reply With Quote
Old 01-20-2018, 01:38 PM   #26
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

wow... now THAT is amazing! gotta wait for some blu ray copy to finish before I go get it and try it, but I am excited!

thanks for all you do!!!

PS...ok just tested and it is really kewl ...

do you have a way to add your stuff to reapack? so we can get it with reapack?
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain

Last edited by hopi; 01-20-2018 at 02:32 PM.
hopi is offline   Reply With Quote
Old 01-22-2018, 06:01 PM   #27
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

Quote:
Originally Posted by hopi View Post
do you have a way to add your stuff to reapack? so we can get it with reapack?
... I've certainly been meaning to offer this.

You're welcome.
tufb is offline   Reply With Quote
Old 01-23-2018, 08:49 PM   #28
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

oh good... it is such a nicer way than github...
and it looks like you are heading toward quite a few interesting scripts so it would be nice for users to just filter to your name in reapack and keep up with your work.... nice for updated and special case versions too
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain

Last edited by hopi; 01-23-2018 at 10:18 PM.
hopi is offline   Reply With Quote
Old 01-24-2018, 07:12 PM   #29
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

News:
25 Jan 2018: New script: bfut_MIDI notes to items (notes to subtrack, note pitch as item pitch).lua



bfut_MIDI notes to items (notes to subtrack, note pitch as item pitch).lua

Note pitch mode: Creates one subtrack. Note pitch is translated to item pitch. (Default reference pitch is 60 (C4); can be changed easily in the script.)

tufb is offline   Reply With Quote
Old 01-25-2018, 03:52 PM   #30
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Germany
Posts: 49
Default

ReaPack support: XML available NOW on github.

Last edited by tufb; 01-25-2018 at 04:04 PM.
tufb is offline   Reply With Quote
Old 01-28-2018, 09:44 PM   #31
hopi
Human being with feelings
 
hopi's Avatar
 
Join Date: Oct 2008
Location: Right Hear
Posts: 15,088
Default

great now the reapack is working fine.... thanks
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva/angel-rain
hopi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.