Song Position Pointer / expression needed

lordExtra

2019-02-16 13:57:52

Hello forum,

this is my first post and I'll be frank...I was hoping if someone could point out as to how to do the below. I have a rough idea on what a possible approach could look this am too silly for the logical part of it. So the story goes as follows:

Bome gets fed a MTC signal and listens for Song Position Pointer messages, that's already set up and working. 

So what I need to do now this: once the Song Position starts running, wait until it returns to its original value and then execute keystroke. 

I suppose that can be easily done via an expression, so if something jumps your mind on this one, please drop below. Your help is greatly appreciated!

Steve-Bome Forum Moderator

2019-02-16 14:23:27

comment

Hi, if you can post the project you have so far, perhaps I can help. What is the source of your MTC? When the song returns to the original position does the application resend MTC messages with the original time (start position of the song)?

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

lordExtra

2019-02-16 15:13:20

comment

Hi, thanks for your reply. How would you like the project posted, as in the Bome file?

The setup is simple, Cubase sends MTC to virtual MIDI port and Bome listens to that. According to the message stream, Cubase always transmits the current Song Position, so yes to your second question.

One thing to note: as the loop set in Cubase will obviously not always start from the same song position, the expression will have to incorporate that somehow.

Thanks man!

Steve-Bome Forum Moderator

2019-02-16 15:25:57

comment

Go ahead and post your Bome .bmtp project file as an attachment to a question in this thread.
I will have a look.

lordExtra

2019-02-16 15:48:10

here you so sir, attached the .bmtp + a sample MTC msg stream


Attachments:

bome-2f-01.bmtp
MTC-stream.txt

lordExtra

2019-02-16 15:50:59

One more thing I forgot: I always need a preroll of 1 bar, which is reflected in the MTC messages. SPP is on 5.1.1.0, jumps to 4.1.1.0 (preroll), plays through two bars and returns to 5.1.1.0

 

Steve-Bome Forum Moderator

2019-02-16 16:15:53

comment

OK, let me understand this better.

You get the first F1 50 Song position message. At this point you don’t want to do anything within MT Pro (right now you fire off a timer but you don’t have anything with timer input to do anything else.

When you get F1 50 again, you want to press a keystroke?

After that if you get F1 50 again, what do you want to happen?

lordExtra

2019-02-16 16:28:21

comment

[ You get the first F1 50 Song position message. At this point you don’t want to do anything within MT Pro (right now you fire off a timer but you don’t have anything with timer input to do anything else. ]

Correct! The only thing MT Pro need to do is identify the start position and wait until it returns, then key stroke.

[ When you get F1 50 again, you want to press a keystroke? ]

Correct.

[ After that if you get F1 50 again, what do you want to happen? ]

Nothing, as the keystroke simply sends a stop signal to Cubase this is not never going to happen. It’s as simple as that.

lordExtra

2019-02-16 16:36:10

I guess it helps to elaborate on the purpose of this translator. Cubase is lacking the functionality to “wait” or “time” events and incorporate that into macros. Hence it’s not possible to just have it record one loop and then stop natively. The preroll is needed for a MIDI hardware clock driving the equipment to be recorded.

lordExtra

2019-02-16 16:36:21

I guess it helps to elaborate on the purpose of this translator. Cubase is lacking the functionality to “wait” or “time” events and incorporate that into macros. Hence it’s not possible to just have it record one loop and then stop natively. The preroll is needed for a MIDI hardware clock driving the equipment to be recorded.

Steve-Bome Forum Moderator

2019-02-16 16:40:52

Something like the below should work.

I use a global variable ga which is guaranteed to be 0 at project start.

The first time through since ga is 0 all it does is toggle ga to a 1 for the next occurence.

The second time through since ga is now 1, it will not execute the outgoing action. In this case a keystroke “a”.

Modify as you like for your own outgoing action.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz


Attachments:

bome-2f-01-sjc-2019-02-16.bmtp

lordExtra

2019-02-18 15:07:59

comment

Thank you, much appreciated indeed! Here’s what happens: If I inject into Cubase, nothing happens. ( either Cubase doesn’t work with this feature this or I am doing sth wrong ) If I don’t inject, it tries to play ( attempt to jump back 1 bar for the preroll again ) but immediately jumps back to where to its original position ( beginning of the loop ) where it ultimately gets stuck. I assume this is because it sends an outgoing action at every frame, not just once, when the condition is met. >> see screencap Please forgive my ignorance here, but I am not yet at the stage in Bome where I’d be able to fully grasp your code. Would you please be so good and elaborate a bit further. Where’s the global variable set? F 50? Apart from the rules ( they’re three I understand ), is there any other code anywhere in your setup? I can’t seem to find anything else. Also, does this expression consider the varying start points of the loop as in song position?

lordExtra

2019-02-18 15:12:39

sample outgoing midi messages attached below:


Attachments:

MT-outg.PNG

Steve-Bome Forum Moderator

2019-02-18 18:00:28

Hi, yes, Windows ejected keystroke events can be a bit tricky and not all programs will recognize them. Without injected events, it is important to make sure Cubase if focused and the active Window when running your project file. If you have something else on top, the keystroke will go there instead.

Here is an explanation of the rules.

First rule
if ga==1 then exit rules, execute outgoing action

The above will ensure the outgoing keystroke will happen only once. The global variable “ga” and all global variables are always set to 0 at project start so on the first time through the second rule (below) will happen, after that ga will be 1 and this translator outgoing action will be executed using the first rule.

Rule 2
ga=ga^1

The above is a bitwise exclusive OR action. Upon execution, if ga=1 then ga will change to 0. If ga=0 then ga will change to 1 . (toggle function)

In this project I could have probably just put “ga=1” assuming I will never need to switch it back. A long hand version for toggle would be:

if ga==1 then pp=0
if ga==0 then pp=1
ga=pp

Rule 3

If we get here, then ga must be be 0 so the action will be skipped waiting for the next (second) occurance of the incoming F1 50 event which will execute the keystroke

As far as how Cubase reacts to the keystroke, I’m somewhat ignorant since I am not running Cubase.

In the current case of this project file, since there are no default MIDI routes, no other MIDI will get through. It is possible that you want all other MIDI messages to come through untouched. If this is the case, draw a line between the default input and output ports in the MIDI routing section of the project as shown in the attached diagram.


Attachments:

Screen Shot 2019-02-18 at 8.59.55 AM.png

Steve-Bome Forum Moderator

2019-02-18 18:02:18

comment

Oh, you might want to manual fix the outgoing keystroke as I’m working on Mac and you are working on Windows. Simply go to outgoing action and clear the existing keystroke and then re-insert it.

Steve-Bome Forum Moderator

2019-02-18 18:04:53

comment

Ah, looking at your log file, I seem to see the problem, As written, the project will skip the first F1 50 but resend keystroke on all subsequent ones. Give me a minute and I will post a fix.

Steve-Bome Forum Moderator

2019-02-18 18:10:51

Hi,

This version should work for you. I added a default route so all other MIDI messages would come through and I changed

ga=ga^1

To

ga=ga+1

if ga>2 then ga=2
if ga!=1 then exit rules, skip Outgoing Action

This way it will only execute once (when ga==1)

 


Attachments:

bome-2f-01-sjc-2019-02-18.bmtp

lordExtra

2019-02-18 19:24:51

comment

Sorry, but this forum really confuses me although it’s somehow amazing haha.

I’m slightly losing track of the chronology here. I just tried your last setup “bome-2f-01-sjc-2019-02-18.bmtp”
and it still puts out the keystroke at every frame, not sending messages when they should. I’ll attach the corresponding buffer capture…not right below but further down I guess.

lordExtra

2019-02-18 19:25:27


Attachments:

MT-outg2.PNG

lordExtra

2019-02-18 19:26:58

Regarding Cubase, I suppose it’d be just fine as it behaves as expected if one does it manually. Never say never though.

Steve-Bome Forum Moderator

2019-02-18 19:40:20

comment

OK, I’ll run up to my PC when you post the latest log and test it. So far I’ve not been testing before posting (my bad).

Yes, comments come after answers are earliest to latest under the answers.

Answers are latest to earliest (latest answers on tops) but as I said, comments to the answers under them are earliest to latest. A bit confusing but that is how it works.

Steve-Bome Forum Moderator

2019-02-18 20:00:59

OK, this one I actually tested  sending messages using Bome SendSX with  your incoming message log and it works.

I added a preset and under that put 3 translators

  1. On project open, timer “Init” is triggered.
  2. When pressing computer ESC key, timer “Init” is triggered
  3. Timer “Init” sets global variable of ga back to zero.

Primarily the above is set up so I don’t have to restart the project to test again. I often do this to ensure I have global variables set to a known state.

I then fixed the rules in the original translator.

I attached both the project file and the log file. The log file will show all of the incoming F1 50 message but only one 0 sent on output (line 2)

 

 


Attachments:

Song-Position-bome-2f-01-sjc-2019-02-18a.bmtp
Song-Position-bome-2f-01-sjc-2019-02-18a-log.txt

Steve-Bome Forum Moderator

2019-02-18 20:09:11

comment

Oh, if you want to pass through the MIDI F1 50 message when you send the keystroke “0”, you will need to turn off the option “Swallow” on the translator, Since I have midi route set, all other MIDI messages will get through.

Steve-Bome Forum Moderator

2019-02-18 20:27:10

comment

I found one more error in the rules. The “0” was sent on the first iteration instead of the second. Here are the fixed rules to replace those in the attached file.

pp=ga
ga=ga+1
if pp>2 then ga=2
if pp!=1 then exit rules, skip Outgoing Action

lordExtra

2019-02-18 23:29:56

I assume I need to activate (esc) the timer before I hit play in Cubase, correct?

Just tested it and it doesn’t work. Same as before, the cursor jumps for preroll and right back to start.

From what I’m able to surmise is that the condition is met at every frame.

Also, the incoming midi shows F1 50 at every frame, is this intentional?


Attachments:

MT-inc-01.PNG
MT-outg3.PNG
MT-rules.PNG

Steve-Bome Forum Moderator

2019-02-19 00:20:55

comment

Yes, the F1 50 (and everything else) will still go through unless you turn of the default MIDI routing.
It will only send a “0” key on the second receipt of F1 50, however.

lordExtra

2019-02-19 10:12:31

comment

OK I might have screwed sth there…can you please attach the whole project again and I’ll give that another shot

Steve-Bome Forum Moderator

2019-02-19 16:17:06

Attached is the latest with the new rules copied and pasted in. This one is not tested as I’m not at my PC so I don’t have SendSX available to me for testing right now.

 


Attachments:

Song-Position-bome-2f-01-sjc-2019-02-19.bmtp