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

Convert MIDI notes to items

* bfut_MIDI notes to items (explode note rows to subtracks).lua
* 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 rate).lua


Converts MIDI notes to media items in one go. Note velocity as item volume.
New media items insert on subtrack(s), respectively. These subtrack(s) are created where you want them.

Multiple users had been requesting this over the years.

How to set up item/sample loader:
1) Select MIDI item(s) on one track.
2) Select another track with various media items.
3) Each used note row will point to one of the media items.
4) If there are not enough media items, you'll get empty items.

How to use:
1) Select MIDI item(s).
2) Select a track. (optional)
3) Run the script.


Installation
Directly from https://github.com/bfut/ReaScripts or
Copy and paste this URL in Extensions > ReaPack > Import repositories:
Code:
https://github.com/bfut/ReaScripts/raw/main/index.xml
Then install in Extensions > ReaPack > Browse packages.



Screencaptures & Pictures

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.)


Last edited by tufb; 11-18-2020 at 11:44 AM.
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,914
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,919
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,847
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: Berlin
Posts: 102
Default

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.

Last edited by tufb; 02-27-2020 at 01:00 PM.
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,451
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
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: 2,948
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 online now   Reply With Quote
Old 01-04-2018, 08:13 AM   #8
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
Default

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
The script is devoid of exclamation marks. Something may have gone wrong on your end.
Re-download recommended.

Thx for the feedback!

Last edited by tufb; 02-27-2020 at 01:02 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: 2,948
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 online now   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: 2,948
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 online now   Reply With Quote
Old 01-04-2018, 03:19 PM   #11
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
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,451
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
hopi is offline   Reply With Quote
Old 01-06-2018, 06:19 AM   #13
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
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: Berlin
Posts: 102
Default

edited

Last edited by tufb; 02-27-2020 at 01:03 PM.
tufb is offline   Reply With Quote
Old 01-07-2018, 01:54 PM   #15
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
Default

edited

Last edited by tufb; 02-27-2020 at 01:03 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: Berlin
Posts: 102
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,451
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

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: Berlin
Posts: 102
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,451
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

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: Berlin
Posts: 102
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: Berlin
Posts: 102
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: Berlin
Posts: 102
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: Berlin
Posts: 102
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,451
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

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: Berlin
Posts: 102
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,451
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

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: Berlin
Posts: 102
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: Berlin
Posts: 102
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,451
Default

great now the reapack is working fine.... thanks
__________________
...should be fixed for the next build... http://tinyurl.com/cr7o7yl
https://soundcloud.com/hopikiva
hopi is offline   Reply With Quote
Old 02-23-2020, 11:32 AM   #32
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 2,948
Default

Quote:
Originally Posted by hopi View Post
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
Why filtering, I am always downloading everything.
Thanks tufb, for all your scripts, still did not try anything yet, but those look interesting. Having direct youtube video examples would be great, with sound. This allows something like turbo arranging, nowhere else available, by 'saving your arrangement structure in midi form'. Now one needs to come up with interesting strategies how to finetune this concept further. Like midi channel could have their own meaning, certain octave ranges could have their meaning. Notes in midi channel 10 could have again their certain meaning. I actually did something similar long time ago, but all working purely with midi, the arranging concept was saved as midi, the exploded midi was also midi. Longer midi notes were replaced by some other midi patterns. This can give you a very quick mute structure arrangement. When which notes or components of the arrangement should be muted for example. When there should be a bassline, harmony or melody, or kick, or snare and the other drums... Now converting those midi structures with one hit into an almost finished arrangement would be funny. At least an interesting starting point for sure.

Forgot to write, greetings to Berlin!

Last edited by TonE; 02-23-2020 at 11:42 AM.
TonE is online now   Reply With Quote
Old 02-27-2020, 01:09 PM   #33
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
Default

Much like my entire repo: All three scripts have been updated. I've also updated the documentation in the original post.
This pack does not require any extensions. Thank you so much for your feedback.

bfut_MIDI notes to items (explode note rows to subtracks).lua
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 rate).lua
@version 1.1
@changelog
+ convert note velocity to item volume
+ obey MIDI item start/end
+ improved performance


Installation
Directly from https://github.com/bfut/ReaScripts or
Copy and paste this URL in Extensions > ReaPack > Import repositories:
Code:
https://github.com/bfut/ReaScripts/raw/main/index.xml

Last edited by tufb; 11-18-2020 at 11:45 AM.
tufb is offline   Reply With Quote
Old 05-22-2020, 05:05 AM   #34
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Posts: 476
Default

Hello tufb

Is it possible to change your script "bfut_MIDI note row controls items pitch.lua" that you can get item pitch values using a midi keyboard step by step.
For example:
You select 10 items, execute the script and change the pitch values one after the other by entering the midi keyboard.
Thanks a lot
Dragonetti
https://forum.cockos.com/showthread.php?t=236857
Dragonetti is offline   Reply With Quote
Old 05-23-2020, 01:12 PM   #35
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
Default

I replied in your thread. Thanks
tufb is offline   Reply With Quote
Old 06-30-2020, 10:19 AM   #36
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
Default

Updated:
bfut_MIDI notes to items (explode note rows to subtracks).lua
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 rate).lua
@version 1.2
@changelog
+ convert note multiples from looped items, obeying take playrate
(When a MIDI item is looped, all notes will be converted.)

This change is inspired by a recent adaption of my scripts by developer, ePi. (source). Unlike their version at this time, my script takes into account the MIDI take playrate.


New Scripts:
bfut_MIDI notes to empty items (explode note rows to subtracks).lua
bfut_MIDI notes to empty items (notes to subtrack, note pitch as item pitch).lua
bfut_MIDI notes to empty items (notes to subtrack, note pitch as item rate).lua

The item/sample loader is switched off in these.

Last edited by tufb; 06-30-2020 at 05:23 PM.
tufb is offline   Reply With Quote
Old 07-01-2020, 11:14 AM   #37
tufb
Human being with feelings
 
Join Date: Dec 2017
Location: Berlin
Posts: 102
Default

The scripts were updated again under the same version number. If you downloaded any versions 1.2 within the last 24 hours, you may want to synchronize packages in ReaPack, then reinstall the scripts. Enjoy.
tufb 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 05:18 PM.


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