Old 09-22-2020, 10:21 AM   #1
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 150
Default Export/import midi programmatically?

Hi,

How do I export and import midi tracks (.mid) in reascript? Is there a conventional way of doing this in reascript?
I would like to export midi from track A and then import the midi into track B later.
My end goal is to achieve something similar to the Vim editors register functionality where
one can store data to different registers and then recall the data with a keypress later.

I have seen that one could store data to ExState and that looks interesting but I am
a bit unsure yet of what I am "allowed" to save there. I am going to do more research
into this on my own. Up until now I have been thinking about creating something like
a temp_midi.mid file where I would store my midi.

// cheers!!

Last edited by dimtok; 09-22-2020 at 01:32 PM.
dimtok is offline   Reply With Quote
Old 09-22-2020, 01:00 PM   #2
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
Default

Export, import, this sounds like copying from track a to track b.
Other than that you could use linked midi files, see Reaper options. And there are actions which can convert items between both types (internal midi vs. linked midi, do not remember their official names now). Linked midi files are my favourite technique when dealing with midi files, as you can go offline in Reaper, which means Reaper will release those files, so in theory and practice you can process those midi files with any other midi processing tool, then go online back in Reaper and Reaper would update its state to those new processed midi files. This is especially useful if you would process many .midi files, and hoop Reaper would reflect those updates. For experimentation very useful or certain processing tasks.
TonE is offline   Reply With Quote
Old 09-22-2020, 01:06 PM   #3
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 150
Default

Quote:
Originally Posted by TonE View Post
Export, import, this sounds like copying from track a to track b.
Yes on the surface it totally looks like that but I have another problem that I am
trying to solve that would require copying programmatically. I haven't figured it
out how to solve the real problem with clipboard copy paste as of now.

Actually what I am trying to do pretty much is creating something similar to registers
in the vim editor if you are familiar with it?

Last edited by dimtok; 09-22-2020 at 01:30 PM.
dimtok is offline   Reply With Quote
Old 09-22-2020, 01:07 PM   #4
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 150
Default

Quote:
Originally Posted by TonE View Post
Export, import, this sounds like copying from track a to track b.
Other than that you could use linked midi files, see Reaper options. And there are actions which can convert items between both types (internal midi vs. linked midi, do not remember their official names now). Linked midi files are my favourite technique when dealing with midi files, as you can go offline in Reaper, which means Reaper will release those files, so in theory and practice you can process those midi files with any other midi processing tool, then go online back in Reaper and Reaper would update its state to those new processed midi files. This is especially useful if you would process many .midi files, and hoop Reaper would reflect those updates. For experimentation very useful or certain processing tasks.
Interesting, I will look into linked midi and see if it is something I could work with!
dimtok is offline   Reply With Quote
Old 09-22-2020, 04:14 PM   #5
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
Default

Quote:
Originally Posted by dimtok View Post
Yes on the surface it totally looks like that but I have another problem that I am
trying to solve that would require copying programmatically. I haven't figured it
out how to solve the real problem with clipboard copy paste as of now.

Actually what I am trying to do pretty much is creating something similar to registers
in the vim editor if you are familiar with it?
I know buffers in emacs. Is register same as buffer in emacs?

Just looked it up:
You could add the selected text to the register r by doing "ry. By doing y you are copying (yanking) the selected text, and then adding it to the register "r. To paste the content of this register, the logic is the same: "rp. You are pasting the data that is in this register.

What I am using in emacs is an extension called yankpad, for stuff (text templates) which I need more frequently, some latex or org-mode settings for example.

Anyway whatever you try, it sounds interesting, I hope you will make a short Youtube video when finished so we can see how it can be useful for musical tasks.

You could check for example how saike solved a similar problem, I guess, in hackey trackey, there he copies the item to a very late position in arrange, using those as "patterns" we can reuse. Maybe something similar you could try?
TonE is offline   Reply With Quote
Old 09-24-2020, 02:27 AM   #6
dimtok
Human being with feelings
 
Join Date: Dec 2019
Location: sthlm, swe
Posts: 150
Default

Yeah man! I looked into it now a bit and it doesn't seem that difficult to
extract and store midi items in registers. I'll try to get back here if I
succeed in making something that seems useful.

Thanks for replying to my post TonE
dimtok 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 06:10 PM.


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