|
|
|
10-11-2013, 05:04 PM
|
#1
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
beyond.Reaper - simpler and unlimited ReaScript
beyond.Reaper V26
beyond.Reaper is a small API that brings both simpler and unlimited
programming to Reaper Python developers.
With beyond.Reaper, you can run full Python programs outside Reaper
and use its entire API seamlessly like running inside Reaper, but with
additional capabilities that go beyond ReaScript, a subset of Python.
This enables rapid development of sophisticated applications for
Reaper with full UIs, multi-threading, stable access to tkinter,
and all the other Python modules available. In addition, programs
can be launched externally to access Reaper only when needed,
be associated with file types, and be edited and debugged with
advanced tools.
beyond.Reaper also provides simpler and more robust access to Reaper.
Projects, Tracks, Items and all Reaper Data Chunks (Elements) have
easy to use and fast Python models. There is also a highly simplified
UI system available with multi-threading and state saving.
There is only one Reaper Action that needs to be setup:
Modules/beyond/Reaper/RemoteControl.py
When an External program accesses the Reaper API:
Code:
import beyond.Reaper
Reaper.OnPlayButton()
behind the scenes, RemoteControl.py is launched as an Action
via Reaper's OSC. RemoteControl.py instantly connects back to the
external program via TCP/IP and efficiently executes every
command needed, complete with intricate arguments, returns,
and relaying of Reaper Exceptions.
To execute a series of calls in one connection:
Code:
with Reaper as r:
A = r.GetTrack(0, r.CountTracks(0) - 1)
r.OnPlayButton()
This happens very fast. Any error exception safely closes the
connection, and even the Undo state is restored.
Of course, you can use beyond.Reaper to program at a higher level:
Code:
for T in Reaper.ProjectSelected.TracksSelected:
Say(T.Name)
T.Name += " :-)"
beyond.Reaper was designed for performance, succinctness and expressiveness.
Take a look at the source code inside Examples and Examples Reaper.
Special Thanks to
axel_ef
Lazarus
mim
reapertribal
Sasje
spk77
Viente
and all others for the encouragement
V27 Update:- Support for the new and stable RemoteControl.py CommandID trigger (OSC s/action/str)
- Faster and more complete de/serialization of Reaper Elements/Chunks
- Updated Reaper 5.2 API calls
Last edited by beyond; 02-26-2016 at 03:54 PM.
Reason: V27 Update
|
|
|
10-11-2013, 06:24 PM
|
#2
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
great news/
|
|
|
10-11-2013, 06:30 PM
|
#3
|
Human being with feelings
Join Date: Apr 2013
Location: Spain
Posts: 284
|
What wonderful surprise!!!!!!!
Beyond i am very glad to know Beyond-Python or Beyond-Reaper or Beyond´s Magical Bridge has its own Thread and is a great honor for me be the first premiere to post
As mac user i want to thank you the possibility that your program offers to us to enjoy the scripts in Reaper that have GUI,so far was an impossible dream
Sure programming lovers will be happy researching and creating codes
and sophisticated scripts that will open a new dimension to Reaper users
Beyond Reaper is a witty & enriching project without limits to the imagination
Thanks for sharing with us
|
|
|
10-11-2013, 10:42 PM
|
#4
|
Human being with feelings
Join Date: Feb 2009
Location: Dunedin, New Zealand
Posts: 205
|
Congratulations!
Quote:
Originally Posted by beyond
beyond.Reaper is a small API that brings both simpler and unlimited programming to Reaper Python developers.
|
I have been watching the beyond.Reaper developments closely and have to say that this whole concept is really cool!
I'm new to Python and have slowly been working my way through a rather thick book on the subject.
Despite my lack of experience, I've still managed to write many useful scripts already. It's much easier to learn than Perl, I must say!
I have successfully installed beyond.Reaper on my system and look forward to taking advantage of what it has to offer, especially once I get my head around creating GUIs in Python.
Keep up the good work!
|
|
|
10-13-2013, 10:31 AM
|
#5
|
Human being with feelings
Join Date: Apr 2013
Location: Spain
Posts: 284
|
Hi
Beyond i have updated my Beyond-Reaper to V26 and works fine and is very nice your settings instructions to help to the new user how to install
I wonder if in this version V26,in Examples Reaper Community folder,the Arpeggiator Test-spk77 and ReaChorder-Sasje,axel_ef scripts are the same updates that are in the V25?
because if are the same i move the V25´ folders to V26 to avoid the new changes to work dropmenus.....
Thanks for the update
|
|
|
10-14-2013, 01:08 AM
|
#6
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
:-)
In V26 ReaChorder was updated with Sasje's latest, my stability fixes, axel's UI updates, and his drum presets. V27 will have my fix for the Key shift which I posted on the ReaChorder thread.
Let's see what else will be in V27 :-)
|
|
|
10-20-2013, 02:07 AM
|
#7
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Hi,
This might be a solution for non constant Cmd IDs (Jeffos gave a tip):
1) select "Allow binding messages to REAPER actions and FX learn"
2) select "Remotecontrol.py" from the action list -> press "Add" -button
3) run a script which uses the beyond modules (f.ex. "Test.py")
4) "reaper-osc-actions.ini" should appear into \REAPER\OSC\" with a custom id string. (NOTE: it seems to overwrite the old "reaper-osc-actions.ini")
|
|
|
10-20-2013, 03:23 AM
|
#8
|
Human being with feelings
Join Date: May 2010
Location: Norway
Posts: 7,318
|
Very cool.
I'm a Phyton noob.
What practical use would you say beyond.Reaper could facilitate?
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
|
|
|
10-22-2013, 01:54 PM
|
#9
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
v4.55pre2:
+ OSC: support for calling custom actions by string identifier
|
|
|
10-24-2013, 10:14 AM
|
#10
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Here's a feature request (don't know if this is already possible):
I'm experimenting with python-osc-1.2 module and tkinter (haven't tested the OSC-server class yet) - it would be nice if there was an OSC client and server/listener (which would have an option to make it "always serve") in beyond.Reaper. It would be possible to make f.ex. custom OSC controllers in Python and (still) have an access to the ReaScript API. Sorry, I can't explain it better
OSC client (running outside REAPER):
Last edited by spk77; 10-24-2013 at 11:04 AM.
|
|
|
10-28-2013, 10:00 AM
|
#11
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
Hi guys,
I have been busy producing a show. I will respond to all these exciting developments shortly! Thank you spk77 for all the great research, and I have much to say about consolidating frequent small connections to Reaper to speed up things like relayed UI sliders.
|
|
|
12-18-2013, 08:44 PM
|
#12
|
Human being with feelings
Join Date: Jun 2009
Location: Earth
Posts: 1,340
|
help pleaseeeeee
Does anyone know if beyond.Reaper works with python 3.4?
I thought I followed all the instructions correctly but trying any of the scripts inside or outside of REAPER I get the error.., ImportError: No module named beyond.
Thank you
|
|
|
12-19-2013, 11:52 AM
|
#13
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
Quote:
Originally Posted by Anton9
Does anyone know if beyond.Reaper works with python 3.4?
I thought I followed all the instructions correctly but trying any of the scripts inside or outside of REAPER I get the error.., ImportError: No module named beyond.
Thank you
|
It's been tested with 3.4 on both Windows and OSX.
It looks like there is a simple installation problem with your "beyond.pth" file. That file must be edited and have in its first line the path to your chosen beyond Python directory, where you extracted the zip file. Then, the edited beyond.pth file needs to be copied into your "<Python Path>/Lib/site-packages". Note the correct use of path slashes \ for Windows and / for OSX.
Once you get the "Test Installation.py" to work, everything else should follow.
|
|
|
12-19-2013, 12:00 PM
|
#14
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
Python performance boost for Windows
If you have Python installed in newer Windows, it is very possible the Python installer is not giving the proper write permissions and Python is silently unable precompile its native modules.
If your Python\Lib\__pycache__ directory is empty, then this is the case.
Give your Python directory write permission for Users, and check the Python\Lib\__pycache__ directory filling up with precompiled modules after running some Python programs.
I have measured a performance boost between 20% to 300%!
|
|
|
12-19-2013, 12:30 PM
|
#15
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
Quote:
Originally Posted by G-Sun
Very cool.
I'm a Phyton noob.
What practical use would you say beyond.Reaper could facilitate?
|
We are using it for another Python app that manages a custom library of sounds and compositional patterns for Reaper. Things like vocal, guitar processing chains, snare sounds and orchestral patterns that follow a real-time chord track (another JS app). All these bits are versioned, translated, compared and exchanged between projects. It has become indispensable. Maybe we will share these other apps at some point.
Reaper is the most programmable of the major daws, and musicians are very diverse and resourceful with their instruments and ideas. These tools accelerate the programming, testing and refining of your ideas.
|
|
|
12-19-2013, 01:55 PM
|
#16
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
Quote:
Originally Posted by spk77
Here's a feature request (don't know if this is already possible):
I'm experimenting with python-osc-1.2 module and tkinter (haven't tested the OSC-server class yet) - it would be nice if there was an OSC client and server/listener (which would have an option to make it "always serve") in beyond.Reaper. It would be possible to make f.ex. custom OSC controllers in Python and (still) have an access to the ReaScript API. Sorry, I can't explain it better
OSC client (running outside REAPER):
|
Hi spk77!
I have been following your needs for smoothly relaying sliders to Reaper.
Here is a little benchmark:
Code:
import beyond.Reaper
import beyond.Reaper.Track
import beyond.Screen
@ProgramStart
def Main():
TimerStart("Combined Connections")
with Reaper as r:
for T in r.ProjectSelected.TracksSelected:
for i in range(10):
T.Selected = True
TimerEnd()
TimerStart("Seperate Connections")
for i in range(10):
with Reaper as r:
for T in r.ProjectSelected.TracksSelected:
T.Selected = True
TimerEnd()
Yields 0.14 and 1.4 seconds on this system.
A single session to Reaper takes about 0.15 seconds. That is pretty fast for an external program to open a server, send Reaper an OSC trigger to wake up RemoteControl.py and for it to connect back to the external program, for Reaper to execute the commands, all the serialization, and for Reaper to unload RemoteControl.py, and manage the undo state.
If the connection is maintained, the execution of commands are so fast that you can change that first 10 to a 1000, and it will still be under .4 seconds, including all the synchronization .Selected is doing to update Reaper and its own copy of the Track Elements.
Also, adding .Volume, .Pan or similar support to the Track object is really easy at this point, a matter of 2 liners, mostly copied and pasted from .Selected.
So the question is how to maintain a connection as you are sending slider events to Reaper.
Earlier in the development, I had explored this idea, Connection Sustain = .5 seconds. You did not need "with Reaper:" explicitly, as any access to Reaper would open an automatic connection, sustain it and close it automatically if not used again in .5 seconds or so. A parallel sat in the background waiting to close the connection for no activity. A bit more intelligence was needed for unobvious cases, and I did not have the need for it at the time, so I went for the precise and simple, "with Reaper:" method instead. The "with" syntax is still elaquent and should be kept, as it also deals with error exceptions well.
So perhaps, I will finish implementing and refining that mechanism. It could make things even simpler, and subsequent commands to Reaper (such as from a slider) would use the same connection automatically. Although, that .15 seconds at first touch could cause a bump in response. There is also the possibility of keeping the connection at all times, and letting it go only when the user needs access to Reaper. Connecting when a window is active, and releasing otherwise, seems like a good idea too. Have to think about these ideas and test them well..
The Reaper API is a superset of OSC. OSC also has many configuration variables that can complicate the installation of an app.
My OSC function in the library for triggering Reaper Actions is only 5 lines. I do like keeping things very succinct and simple, and the OSC libraries I looked at were quite the opposite even just to use them. I think I can implement the most useful OSC functions with 20-30 lines of code. I also have to update to the use of the string "Custom ID". I do wonder if the Custom ID can be pre-generated and replicated by an automatic installer.
What are your thoughts?
|
|
|
12-21-2013, 08:08 PM
|
#17
|
Human being with feelings
Join Date: Nov 2011
Posts: 8
|
Hi Beyond, just a side note -
import beyond.Reaper
Reaper.OnConnectExecute = "from sws_python import *"
with Reaper as r:
tr1 = r.RPR_GetTrack(0,0)
tr2 = r.RPR_GetTrack(0,1)
r.SNM_AddReceive(tr1, tr2, 0)
is a godsend, I can finally make routing programmatically. The combination of SWS and external API calls with your tool is part of the reason Reaper rocks!
FYI - it took me a while to realize that the sws_python* files should be in beyond/Reaper. I also didn't realize that Reaper should (or could) run 3.3. It might be self-explanatory for the experienced, but it might be worth mentioning in the heplfile...
|
|
|
12-22-2013, 06:08 PM
|
#18
|
Human being with feelings
Join Date: Jun 2009
Location: Earth
Posts: 1,340
|
Quote:
Originally Posted by beyond
It's been tested with 3.4 on both Windows and OSX.
It looks like there is a simple installation problem with your "beyond.pth" file. That file must be edited and have in its first line the path to your chosen beyond Python directory, where you extracted the zip file. Then, the edited beyond.pth file needs to be copied into your "<Python Path>/Lib/site-packages". Note the correct use of path slashes \ for Windows and / for OSX.
Once you get the "Test Installation.py" to work, everything else should follow.
|
I've extracted the package to F:\beyondPython and in the .pth file I have
<beyond Python Path>F:\beyondPython\Modules
That should be the correct path right? oh.., and yes I did copy the edited file to Lib/site-packages.
Do I maybe omit the "<beyond Python Path>" and just have F:\beyondPython\Modules on that line?
|
|
|
12-23-2013, 07:21 PM
|
#19
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
Quote:
Originally Posted by millitone
Hi Beyond, just a side note -
import beyond.Reaper
Reaper.OnConnectExecute = "from sws_python import *"
with Reaper as r:
tr1 = r.RPR_GetTrack(0,0)
tr2 = r.RPR_GetTrack(0,1)
r.SNM_AddReceive(tr1, tr2, 0)
is a godsend, I can finally make routing programmatically. The combination of SWS and external API calls with your tool is part of the reason Reaper rocks!
FYI - it took me a while to realize that the sws_python* files should be in beyond/Reaper. I also didn't realize that Reaper should (or could) run 3.3. It might be self-explanatory for the experienced, but it might be worth mentioning in the heplfile...
|
Thank you. It makes me happy to hear that this contribution is facilitating and inspiring other people.
|
|
|
12-23-2013, 07:29 PM
|
#20
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
Quote:
Originally Posted by Anton9
I've extracted the package to F:\beyondPython and in the .pth file I have
<beyond Python Path>F:\beyondPython\Modules
That should be the correct path right? oh.., and yes I did copy the edited file to Lib/site-packages.
Do I maybe omit the "<beyond Python Path>" and just have F:\beyondPython\Modules on that line?
|
Yes. "<beyond Python Path>" is to be replaced with "F:\beyondPython" where you would would like the directory to be in Windows. So try:
F:\beyondPython\Modules
|
|
|
12-26-2013, 06:56 PM
|
#21
|
Human being with feelings
Join Date: Jun 2009
Location: Earth
Posts: 1,340
|
beyond,
Thank you for your help.., I finally got it working.
|
|
|
01-04-2014, 07:08 PM
|
#22
|
Human being with feelings
Join Date: Jul 2013
Posts: 44
|
I don´t know what I´m doing but this happens to me :P
using OSX 10.6.8
python 3.4
The same happens whit Test Installation.py in beyond python folder and Arpeggiator
I can use some reascripts like BPM Converter v.1.05.py
|
|
|
01-05-2014, 04:42 AM
|
#23
|
Human being with feelings
Join Date: Jan 2007
Location: Erfurt
Posts: 784
|
Looks like you are on OSX and beyond is looking for python.exe (Windows)
Open Settings.py with an editor and look at Python Executable
change it to your Python Version
Python = r"/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3"
(I have 3.3)
and you must use RemoteControl.py as an action and write the Action ID in Settings.py
Reaper_RemoteControl_CmdID = xxxxxx
Last edited by axel_ef; 01-05-2014 at 04:47 AM.
|
|
|
01-05-2014, 03:47 PM
|
#24
|
Human being with feelings
Join Date: Jul 2013
Posts: 44
|
Thank you axel_ef for the quick answer, i do exactly what you tell me (but considering I´m using 3.4 version)
Python = r"/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4"
In the second step appears:
Reaper_RemoteControl_CmdID = 123456
Six numbers!? and my Cmd ID have only five numbers (57876)… something wrong?
The same error stills happend also changing Librería/Library name path (because my Library folder is actually called -Librería- so i was trying with both). And recheck the Cmd ID because was changed to (57875)
I was testing too with the 3.3 version and appears
ImportError: No module named 'beyond'
|
|
|
01-05-2014, 05:34 PM
|
#25
|
Human being with feelings
Join Date: Jan 2007
Location: Erfurt
Posts: 784
|
did you create an OSC Control Surface (Preferences - Control Surfaces)?
if you want use Python 3.3 you must copy beyond.pth from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/
to /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
Settings.py
# Step 1 - RemoteControl.py Action and its Cmd ID
# ================================================== =====================
Reaper_RemoteControl_CmdID = 57876 #your action ID
# Step 2 - Reaper's OSC and Addresses
# ================================================== =====================
Reaper_OSC_Address = ("localhost", 8000)
External_Program_Address = ("localhost", 8001)
# Step 3 - Python Executable
# ================================================== =====================
Python = r"/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4"
|
|
|
01-05-2014, 06:59 PM
|
#26
|
Human being with feelings
Join Date: Jan 2007
Location: Erfurt
Posts: 784
|
Reachorder Beyond as an App for OSX & Python 3.3
Download
|
|
|
01-06-2014, 05:50 PM
|
#27
|
Human being with feelings
Join Date: Jul 2013
Posts: 44
|
Wow i just have create the OSC and for first time I can see the GUI of Reachorder and Arpeggiator but they don´t work properly. When I press the ADD or any other buttom they don´t response.
|
|
|
01-06-2014, 06:58 PM
|
#28
|
Human being with feelings
Join Date: Jan 2007
Location: Erfurt
Posts: 784
|
You must open a Midi Editor Window before you can use it.
|
|
|
01-06-2014, 10:07 PM
|
#29
|
Human being with feelings
Join Date: Jul 2013
Posts: 44
|
Quote:
Originally Posted by axel_ef
You must open a Midi Editor Window before you can use it.
|
yes, i did it
GIF---> http://minus.com/i/brSoFD6IjL8et
This week i will format my mac maybe works after that, so many thanks for your help
|
|
|
01-17-2014, 09:05 PM
|
#30
|
Human being with feelings
Join Date: Jan 2007
Location: Erfurt
Posts: 784
|
Track Color
a small gimmick with beyond - set Track Colors
|
|
|
04-26-2014, 02:50 PM
|
#31
|
Human being with feelings
Join Date: Apr 2014
Posts: 55
|
Hi,
Need help with getting this to run.
== Exception ===========
File "RemoteControl.py", line 8, in <module>
with beyond.Network.Client(beyond.Reaper.Settings.Exter nal_Program_Address) as Client:
File "C:\Beyond\Modules\beyond\Network.py", line 40, in __init__
S.connect(Address)
[WinError 10061] No connection could be made because the target machine actively refused it
========================
I have windows firewall disabled, however I tried enabling it and opening 8000 and 8001 ports.
I tried creating a new, fresh hosts file in system32/Drivers/etc
I gave full permissions to all users to Reaper, Python directory and Beyond directory.
And I tried different ports within the settings.py
Nothing helps, any ideas..?
|
|
|
08-25-2014, 10:08 AM
|
#32
|
Human being with feelings
Join Date: Jun 2008
Location: Austin
Posts: 289
|
iPython Notebook
Just thought I'd post to say that this thing runs in an iPython notebook! Unfortunately playing with it is about item # pi^2 on my ToddDo list.
|
|
|
08-25-2014, 10:52 AM
|
#33
|
Human being with feelings
Join Date: May 2006
Posts: 1,030
|
Very nice project! To bad it doesn't follow basic Python styleguide rules, though. Not being able to see what is a class and what is a method/function when looking at the code adds unnecessary cognitive processing. This C style is really rarely seen in the Python world...
|
|
|
11-06-2014, 05:07 AM
|
#34
|
Human being with feelings
Join Date: Oct 2008
Location: France
Posts: 3,698
|
Quote:
Originally Posted by beyond
behind the scenes, RemoteControl.py is launched as an Action
via Reaper's OSC. RemoteControl.py instantly connects back to the
external program via TCP/IP and efficiently executes every
command needed, complete with intricate arguments, returns,
and relaying of Reaper Exceptions.
To execute a series of calls in one connection:
Code:
with Reaper as r:
A = r.GetTrack(0, r.CountTracks(0) - 1)
r.OnPlayButton()
|
I don't understand this. The sample you give look like Reaper API askings. It's not OSC ones. Is it possible to talk to Reaper in OSC using beyond.Reaper ?
My purpose is to develop a UI to control Reaper from a pad.
|
|
|
11-06-2014, 11:09 AM
|
#35
|
Human being with feelings
Join Date: Dec 2006
Posts: 668
|
Truly sorry if this is too far afield:
Can beyond.Reaper manage to sync the TEMPO of two different Project Tabs?
Have been shown a way to sync loop points between two project tabs.
http://forum.cockos.com/newreply.php...te=1&p=1425800
The ultimate and much needed is any way to have the current tab's tempo
automatically 'sent' to at least one other Project Tab that's running/starting/looping in sync ...
appreciatively*-)
|
|
|
11-19-2014, 11:27 AM
|
#36
|
Human being with feelings
Join Date: Mar 2010
Location: France
Posts: 459
|
I have this message when I try to run Remotecontrol.py :
== Exception ===========
File "RemoteControl.py", line 8, in <module>
with beyond.Network.Client(beyond.Reaper.Settings.Exter nal_Program_Address) as Client:
File "C:\Users\kenny\AppData\Roaming\REAPER\SCRIPTS\bey ond Python V26\Modules\beyond\Network.py", line 40, in __init__
S.connect(Address)
[WinError 10061] Aucune connexion n’a pu être établie car l’ordinateur cible l’a expressément refusée
What does it mean?
|
|
|
11-20-2014, 08:45 PM
|
#37
|
Human being with feelings
Join Date: Oct 2008
Posts: 708
|
Same thing happening here.
Reaper v4.75/x64
Python x64 3.4
Que pasa?
__________________
It's all just an intro until the bass starts. quote from prezbass
|
|
|
11-24-2014, 08:54 AM
|
#38
|
Human being with feelings
Join Date: Oct 2008
Posts: 708
|
Here's a fix for the "[WinError 10061] No connection could be made because the target machine actively refused it".
1. go to /beyondReaper/Modules/beyond folder and rename Network.py to something like Network-save.py
2. download the Network.zip attachment, unzip Network.py and put it into /beyondReaper/Modules/beyond folder
3. should be 'good to go'
Please let me know if it works for you.
__________________
It's all just an intro until the bass starts. quote from prezbass
|
|
|
02-07-2015, 12:22 PM
|
#39
|
Human being with feelings
Join Date: Jul 2011
Posts: 59
|
Recently I have discovered Beyond. It works really good! However I am struggling to get Sysex data from media item through Beyond with Reaper.RPR_MIDI_GetTextSysexEvt() function.
So far with no luck - everything works apart from getting Sysex data. Could someone please tell me what is wrong with the code? Or is it a bug in Beyond?
Following code is a sketch, so it has a lot of debug messages and does not do much useful stuff now.
It should be used for generating Sysex messages into MIDI items to control external synthesizer (e.g. turn off voice 2 on 4th measure, turn on drum on 6th measure and so on).
There are currently two calls to the function. Only one should be necessary, just wanted to try if other attitude works as well.
Reaper testing scenario: - Create MIDI item
- Insert Sysex on some measure in MIDI item (data from sighs variable can be used)
- Place playback cursor on measure with Sysex event
- Run the action.
Code:
import array
import beyond.Reaper
import tkinter
from tkinter import *
# TODO - add loading support
sysex = [
("Drum Track On", bytes.fromhex("42 30 00 01 05 41 00 00 0B 00 0A 00 00 00 00 01")),
("Drum Track Off", bytes.fromhex("42 30 00 01 05 41 00 00 0B 00 0A 00 00 00 00 00"))
]
class my_app(Frame):
"""Basic Frame"""
last_pos = 0
buttons = []
def __init__(self, master):
"""Init the Frame"""
Frame.__init__(self,master)
self.grid()
button = Button(self, text = "Test", anchor = W, command = lambda: self.access(index))
button.config(height = 3, width = 30)
button.grid(column = 0, row = 0, sticky = NW)
self.buttons.append(button)
self.last_pos = Reaper.RPR_GetCursorPosition()
self.update_controls()
def update_controls(self):
selectedTrack = Reaper.RPR_GetSelectedTrack(0, 0);
# TODO add caching
cursor_pos = Reaper.RPR_GetCursorPosition()
for i in range(0, Reaper.RPR_CountTrackMediaItems(selectedTrack)):
item_id = Reaper.RPR_GetTrackMediaItem(selectedTrack, i)
take = Reaper.RPR_GetActiveTake(item_id);
pos = Reaper.RPR_GetMediaItemInfo_Value(item_id, "D_POSITION");
length = Reaper.RPR_GetMediaItemInfo_Value(item_id, "D_LENGTH");
end_pos = pos + length
current_pos_ppq = Reaper.RPR_MIDI_GetPPQPosFromProjTime(take, cursor_pos);
if (cursor_pos >= pos + 0.001) and (cursor_pos <= end_pos + 0.001):
# current_pos_ppq = Reaper.RPR_MIDI_GetPPQPosFromProjTime(take, cursor_pos);
# iterate over Sysex events, get status
num_sysex = Reaper.RPR_MIDI_CountEvts(take, 0, 0, 0)[0]
print("Num sysex: " + str(num_sysex))
for j in range(0, num_sysex):
# ta_ prefix for throw away
(ta_retval, ta_take, ta_textsyxevtidx, ta_selectedOutOptional, ta_mutedOutOptional, current_evt_pos_ppq, current_evt_type, current_msg, msgOptional_sz) = Reaper.RPR_MIDI_GetTextSysexEvt(take, j, 0, 0, 0, 0, 0, 0)
current_msg = Reaper.RPR_MIDI_GetTextSysexEvt(take, j, 0, 0, 0, 0, 0, 0)[7]
if current_evt_type == -1:
print("Found Sysex with index " + str(j))
# yes, this is a sysex message
if current_pos_ppq == current_evt_pos_ppq:
print("Position match")
# yes, it is on current cursor position
# iterate over defined sysexes
for conf_id in range(0, len(sysex)):
print("Iterating configuration")
print(sysex[conf_id][1])
print(msgOptional_sz)
print(len(current_msg))
if current_msg == sysex[conf_id][1]:
print("Got it")
self.buttons[conf_id].config(relief = "sunken")
break
def access(self, b_id):
self.b_id = b_id
Reaper.RPR_ShowMessageBox("Hi", "Number " + str(b_id), 0)
@ProgramStartDirect
def Main():
root = Tk()
root.title("Tkinter Dynamics")
root.geometry("500x500")
app = my_app(root)
root.mainloop()
Configuration: Mac OS 10.10.2, Reaper 4.76 64-bit, Python 3.4 64-bit, Beyond v26
|
|
|
02-07-2015, 01:13 PM
|
#40
|
Human being with feelings
Join Date: Jun 2007
Location: Palm Beach FL
Posts: 265
|
I have been quite busy lately, but I would like to let everyone know that this project has been very active and quite a work horse in our productions. I will be posting an update soon, along with responding to your messages.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 07:15 AM.
|