Song Position Pointer / expression needed

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!

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

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!

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

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


Attachments:
1550328485438_bome-2f-01.bmtp
1550328485501_MTC-stream.txt

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

 

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?

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

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.

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.

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:
1550331650071_bome-2f-01-sjc-2019-02-16.bmtp

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?

sample outgoing midi messages attached below:


Attachments:
![](upload://hMpX4WW2cpjEycOIrdjkDNYLYMS.png)

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:
![](upload://vWI6uAn5OpW2xzDtKmE6ag9c28z.png)

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.

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.

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:
1550509826096_bome-2f-01-sjc-2019-02-18.bmtp

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.


Attachments:
![](upload://cNiSYr5ZTnIlo0AIPtZGdpl7eDp.png)

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