Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER for Live Use

Reply
 
Thread Tools Display Modes
Old 02-08-2021, 03:03 AM   #1
baldo
Human being with feelings
 
Join Date: May 2018
Posts: 52
Default Sync reaper region and external gear pattern with program change

Hi,

I would like reaper to send Program change to my elektron digitakt (or any other external gear I have) with a reaper action.

IS it possible to do this ?

Digitakt actually send/receive program change on pattern change and
I want to synchronise the digitakt patterns and the reaper regions.
That way, if I change region in reaper, it changes pattern on the digitakt (and vice-versa).


I made it work the other way around (that is changing reaper region when digitakt changes pattern), but now I want to do it the other way (when smooth seeking a region, it should send a program change to the digitakt)

It is easy to do it with maschine, that also has the same functionnality...but with reaper it needs a bit of script and everything :-D
baldo is offline   Reply With Quote
Old 02-08-2021, 08:38 AM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,687
Default

What about placing a Midi Item at the beginning of any write a a program change in there ?

-Michael
mschnell is online now   Reply With Quote
Old 02-08-2021, 08:46 AM   #3
baldo
Human being with feelings
 
Join Date: May 2018
Posts: 52
Default

@mschnell :

I get what you are saying, but I find it gross and a bit inconvenient,
because the midi PC has to be sent a bit before the beginning of the
region. What I mean by this, is that I want to be able to call the region in a "smooth
seek" way from a midi controller for instance, and I want the digitakt to receive
the PC to change accordingly.

I started to create a script, but I didn't try it yet.

It is supposed to send a program change (channel 10) based on region ID,
not sure if that works :

reaper.Undo_BeginBlock()

local time = reaper.GetCursorPosition()
local mark, reg = reaper.GetLastMarkerAndCurRegion(0,time)
local msg = 12 -- 12 = program change --
local ch = 10 -- channel --
local device = 16 -- 0 for vbk, 16 for midi device 0, 17 for midi device 1,... --
reaper.StuffMIDIMessage(0, msg*16 + ch, reg + 1, 0);

reaper.Undo_EndBlock("send PC to midi port according to region ID", -1)

then I am going to make a bunch of custom actions
containing each " go to region XX (smooth seek)" + that script.
I hope, it will work as planned

Last edited by baldo; 02-08-2021 at 08:54 AM.
baldo is offline   Reply With Quote
Old 02-08-2021, 09:07 AM   #4
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,687
Default

https://www.reaper.fm/sdk/reascript/...uffMIDIMessage ->
Mode : "16 for external MIDI device 0, 17 for external MIDI device 1, etc;"
Hence you need to set the first parameter appropriately rather then Zero.

-Michael
mschnell is online now   Reply With Quote
Old 02-08-2021, 09:33 AM   #5
baldo
Human being with feelings
 
Join Date: May 2018
Posts: 52
Default

oopsy,

yeah, looks like I coded this too quickly without even trying it nah ? :-D
baldo is offline   Reply With Quote
Old 02-09-2021, 01:29 AM   #6
baldo
Human being with feelings
 
Join Date: May 2018
Posts: 52
Default Well it does not work

Well it doesn't work

I gave the digitakt the ID 0, and
with stuffMIDIMessage(16, 12*16 + 10 , 0, 0 )

It is supposed to send to the digitakt a PC 0 on channel 10 right ?

Program change is 1100 cccc on the first byte
and program number on the second no ?
baldo is offline   Reply With Quote
Old 02-09-2021, 03:50 AM   #7
baldo
Human being with feelings
 
Join Date: May 2018
Posts: 52
Default Now it works

Ok, I made it work, so here is the correct code for this

local ch = 10 -- channel
local device = 0 -- device output id

-- sends a Program change on channel ch, for device, of value reg
reaper.StuffMIDIMessage(16 + device, 192 + ch - 1, reg, 0);
baldo is offline   Reply With Quote
Old 02-09-2021, 08:24 AM   #8
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,687
Default

Yep. Midi Channels 1..16 are binary 0 ... 15

-Michael
mschnell is online now   Reply With Quote
Old 02-10-2021, 02:13 AM   #9
baldo
Human being with feelings
 
Join Date: May 2018
Posts: 52
Default

yes, I am always switching from python, matlab, and a lot of languages, and sometimes I start from 0 and other time from 1 :-D.
baldo 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 11:54 AM.


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