Random timer daisy chain

Hi Steve,

Ok I have another question:

Here is what I want to do:

When I press a button, BMT starts a random timer (florian’s method) that waits for however long the value it selects is (max 20 sec), then randomly picks another value(0-127) (using Florian’s timer method) to put into a sysex message it outputs.
Basically I am daisy chaining 2 of Florian’s timers to randomly select a delay value to start a timer that selects a value for a single sysex message.

I have sucessfully made a single instance of Florians timer solution to create a random note (or number) but my daisy chain method is not outputting random values. Can you have a look and let me know what I am missing?

Also:

  1. I see that Florian’s timer continuously runs in the background. Eventually the line numbers will get pretty large if left unattended. Is this bad?
  2. I am concerned that if the timer(s) runs it will possibly interfere with other midi messages going through BMT (when moving several faders, for example), though I haven’t really experienced any problems yet. How many continuous timers would be appropriate in order not to bog down BMT (if this is even possible)?

Here is where I am so far:

Translator 1: Start random number timer
Options: stop=false
Incoming: Project Opened
Outgoing: Periodic timer “Update Random Number”: 5 ms (initial delay: 100 ms)

Translator 2: Make new Random number gr
Options: stop=false
Incoming: On timer “Update Random Number”
Rules:
gr=gr+1
if gr>=20 then gr=gr-20
//20 seconds max value
Outgoing: Periodic timer “Update Random Number”: 5 ms (initial delay: 100 ms)

Translator 3: On Note On, play random note
Options: stop=false
Incoming: MIDI 90 pp qq
Rules:
if qq==0 then exit rules, skip Outgoing Action
pp=ga
if pp!=0 then exit rules, execute Outgoing Action
pp=gr
ga=pp
Outgoing: Timer “START NOTE TIMERS” : pp (initial delay: 100 ms)

Translator 4: Start random number timer for SPX sysex
Options: stop=false
Incoming: Project Opened
Outgoing: Periodic timer “Update Random Number”: 5 ms (initial delay: 100 ms)

Translator 5: Make new Random number gr
Options: stop=false
Incoming: On timer “Update Random Number”
Rules:
gr=gr+17
if gr>=127 then gr=gr-127
//127 max value
Outgoing: Periodic timer “Update Random Number”: 5 ms (initial delay: 100 ms)

Translator 6: On Note On, play random note
Options: stop=false
Incoming: Timer “START NOTE TIMERS”
Rules:
if qq==0 then exit rules, skip Outgoing Action
pp=ga
if pp!=0 then exit rules, execute Outgoing Action
pp=gr
ga=pp
Outgoing: F0 43 11 1E 09 10 04 01 pp 00 00 F7

To answer your questions.

  1. I see that Florian’s timer continuously runs in the background. Eventually the line numbers will get pretty large if left unattended. Is this bad? Not a problem, however probably best not to have the log window open when running in production. The log window itself will consume some time.
  2. I am concerned that if the timer(s) runs it will possibly interfere with other midi messages going through BMT (when moving several faders, for example), though I haven’t really experienced any problems yet. How many continuous timers would be appropriate in order not to bog down BMT (if this is even possible)? This really depends on the overall MIDI traffic and perhaps if it it transmitted over MIDI DIN (slower) or USB (faster).

Other notes;
I’m not sure what you are using ga for. I see a few places where you have ga=pp (which overrides the incoming message) and pp=ga.

Translator 1 and Translator 4 both start at project open but since they are the same outgoing timer and delay, you are really only running 1 timer.

Translators 2 and translator 5 are both trying to update gr but with different increments and range. I’m not sure why you are doing this. My guess is you should only use translator 5 as it generates a wider range of notes (0-127 instead of 0-20). With translator 2 in place, you will likely get less “randomness”.

In general, it is probably best to.

  1. Start a random number generator at startup. (I would go with translator 5 instead of 1)
  2. Use incoming notes (or any other unpredictable input) to re-seed the value of gr. If the re-seeding of the random number of generator is in sync with the song, then it will make it less random.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Hi Steve,

Translator 2 is the amount of time I want to delay the sysex message (translator 6) from sending. I figured I don’t want the delay time to be longer than 20 seconds, hence the 0-20 value.

Translator 5 is to select the random value for the sysex.

Since this will be a single button press with a single Midi message, I am depending on BMT to cycle through and randomly select the values by itself. The button presses will not be in sync with the song.

Ok I will play around with it and start the second timer after the first one. Good point about ga. Let me play around with it.

Thanks!

Hi,

I modified a past project to make it random SysEx. This might be close to what you want. I believe the randomness is probably more robust than either of the past ones.

See rules in translator 5

Random SysEX.bmtp (2.7 KB)

Edit: You should probably change translator 3 outgoing action to NONE.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Hi Steve,

I tried your preset but it doesn’t seem to output anything when I press my button.

For reference, I assigned my button as (9F) 20H.

The timer doesn’t seem to be scrolling like Florian’s either. Is this correct?

Check your aliases, inputs and output ports. If there is not a defined port, you won’t see any movement. I was using a FaderFOX EC4 for sending notes and chances are you don’t have one so you will need to change the input to something else.
Random Timer should start when project starts or when pressing computer ESC key.
Timer stops if you press Caps Lock. You can disable these translators if you would like.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Ok now it is outputting sysex.

I see that your preset only outputs a random number as soon as I press the button. I need it to output after a random delay. So now I am currently trying to combine two timers in serial (button press -> random delay timer -> random number sysex timer).

I modified your file a little bit to do this. The first timer is fine and it goes all the way to output sysex, however, now the sysex only outputs increments of 1 rather than a random number. I think it is translator 6 that needs to be changed but I am stumped. I tried several other solutions and got some crazy results. In this file I kept your ‘repeating timer’ rules as it currently works for me.

Fyi, I changed the global variables to h- and j- because I am using g- elsewhere in my program.

Can you please take a look? Thanks!

210110 RANDOM SYSEX WITH TIMER.bmtp (3.3 KB)

Hi,

On translator 4 your are capturing pp and qq which are local variables so translator 5 will not have these variables visible. Instead you will need to put pp and qq in different (global) variables if you want translator 5 to process them correctly. Local variables are not shared between translators (unless they have the EXACT SAME INCOMING TRIGGER) and unless set explicitly, their values are UNDEFINED.

So inn translator 4, copy the values of pp and qq into global variables with rules. Then in translator 5, use those same global variables.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Ok. Im totally lost. I made pp and qq into global variables and updated translator 5 and 6 with the changes but am still only getting a single increment. I think its because my incoming note is the same all the time? I dunno im totally stumped.

I also tried different variable and number combinations in the repeating timer translator but that didn’t give me a true random output (ie. mostly variations gave me patterns such as 17,19, 21, 87, 89, 91, 23, 25, and so on). Other variations resulted in a similar pattern with different spacing.

Another thing is that the SPX2K only goes up to 99 user memory so I have to set the rule “// now lets set it somewhere between 1-127
tt=tt&95

to 95 instead of 127 otherwise when I press a button nothing happens. I think because the value is beyond 99 so it ignores the sysex.

I have a few questions in your translator

  1. In my file in translator 5, what is je=23? I don’ t see anywhere else.
  2. In my file translator 7, what is the significance of 2480 in this rule?
    “if ja>2480 then ja=32”

210111 RANDOM SYSEX WITH TIMER.bmtp (3.3 KB)

Thanks!

Hi Terrence,

I re-wrote this and tried to simplify as well.

The random timer for SysEX delay is derived and calculated from the original random value.

All of the randomness happens in the rules of translator 1.2

I set the maximum delay for the outgoing SysEX to 3 seconds by this rule

he=he%3000

I have input set as DM1000 and output as My Destination.

All used global variables are in rules of translator 0.2

Random-SysEX-2021-01-11.bmtp (3.0 KB)

I’ve requested an enhancement from @florian to add a “random” function instead of having to figure out the randomness ourselves. Hopefully this will come in a later release.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

feature request is recorded, and having a few built-in functions (like random and clock) would be great indeed.

1 Like

Thanks, Florian! I knew you were working on this.

That’s great I can’t wait for the next version!

Ok so the randomness works ok. It seems to pick an equal amount of even and odd numbers. But now most of the times I press the button, it fires sysex two times, each with different values. Sometimes it fires it once. Is there a way to stop that firing after it has fired once?

Thanks!

Yes, every time you push a note it will fire with a different delay. If you want it to only fire once, then there will need to be a way added so that you can tell the incoming message you are waiting for the delay and the last note fired.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

This version uses the global variable “hi” as a busy flag.
If hi==1 then we disable other keystrokes.
The output sets another timer with delay of up to 3 seconds. When the timer fires, it sends the SysEX message and then sets the busy flag (hi) back to 0, ready for the next note-in.

Random-SysEX-2021-01-11a.bmtp (3.6 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Thats the one.

Thanks Steve!