Talk to other MIDI Designer users about MIDI Designer, iOS MIDI and related topics. Or share layouts, pages, and ideas.

Also check out the Facebook Group.

Of course, if you want to send us an email, feel free.

MIDI Designer
Design your perfect MIDI controller for iPad, iPhone and iPod touch.
How can I implement a variable Count Down function? - MIDI Designer Q&A

How can I implement a variable Count Down function?

0 votes
asked Aug 14, 2020 in Advanced by don-sabourin (170 points)
Latest Layout Aug 16 for thie Count Down Function

4 Answers

+2 votes

Work around to block outbound messages during setup


Need one control:

   Name: Block outbound

   Type: Toggle

   Midi: Sysex: 58 v, one byte value, no checksum, 0 - 1

Streambyter rules:

# Use synthetic sysex msg to enable / disable outbound cc msgs

# F0 58 v F7

# 0 = filter off

# 1 = filter on

IF LOAD

  ASS I0 = 00 # Filter initialize to off

END

IF M0 == F0 58 # Filter control message

  ASS I0 = M2

  FX = XX +B # Block outbound sysex

END

IF I0 == 01 # Filter is on

  BX = XX +B # Block all outbound cc

  # Can tailor block as desired

END

answered Aug 15, 2020 by jkhiser (10,510 points)
edited Aug 15, 2020 by jkhiser
this is so far away better than my answer which is "use the Stream Byter plugin for MD"... thanks for the amazing help!
Thanks for your quick response. Since the preset can be made in real time, your approach to act only when MDP starts up won’t work. But it did make me settle on using the Stream Byter (SB) Plug In. I believe I can configure my layout by always blocking the desired msg until the Start is initiated. Only during the count down timer period do I want to pass the desired msg. I should be able to use a Knob (such as added to your example 3j to trigger the filter in Stream Byter to “open” up the stream of msgs and then close it after the last msg. I will publish my test layout with the SB code when I get it working. I still have issues with the Start button and timing to resolve.
The block function above works anytime the Block button is depressed. It is not applied during start up.
Ok. But I need to trigger it on when Start is activated and off when the time period is over. Then I will try out your code. Thanks
+2 votes

Block Midi Output During Preset Selection


Here you go.  This was better than the Sunday crossword.  Needs a slight mod to your starting architecture, but appears to work.
Downloads: 92
Demo 1.10 - 1.10 adds above examples. Will get folded into Masters Course at some point.
Downloads: 92
Images
Enable / Disable Midi Output | Block Midi During Preset Selection
Enable / Disable Midi Output | Block Midi During Preset Selection
answered Aug 16, 2020 by jkhiser (10,510 points)
I should have also noted you can tailor the BLOCK command so it only traps the cc messages you are using for the STEPPER, leaving all other controls active, so you could still access other HW controls from MDP2.
I looked at your layout and it takes a different approach than I did. I chose to filter during the sequence limited by the timer setting, which I will keep as low as possible. I will always filter the output and unfilter only while the one repeating message is being sent. You unblock each individual message. But that requires an extra control. Also, I found in your layout if I select Selections upwards, the message is output and not filtered. I have run into similar situations withundesired interactions in the past.

I have developed an approach that also uses the Stream Byter (SB). I haven’t developed any code yet, it uses strange rules I need to spend time at. I wasn’t sure what the IF LOAD did in your code, but now I see it initializes the filter variable. I am reversing the logic to start with the filter on, so the undesired message always gets filtered unless I initiated Start. All other midi msgs have to pass through at all times. I hope you can help again.

I have 2 options to identify the start and stop of the sequence when the knob counts down. Create a delayed msg in MDP that gets output when the Countdown is finished, which is what I implemented. Another option that I think I prefer is to insert a delay in SB that will turn the filter back on after a time somewhat greater than the time set in the Timer control.

The SB code I need in plain English is:

My parameters:
F0 58 01 F7 turns the filter off
F0 58 03 F7 turns the filter on
CC 7 8 XX resets the stepper in the organ by activating the “000” button (to be tested later)
CC 7 9 XX activates the Step up button in the organ (to be tested later)
CC 7 14 xx msg to be blocked or allowed to pass through
Initialize filter to ‘on’
 
For each msg received:
If SysEx F0 58 03 is received  #last msg was transmitted, turn filter back on
    Turn on filter
End

If SysEx F0 58 01 F7 is received  #turn off filter to allow CC 7 14 msgs to pass through
     Turn off filter
End
 
If filter is on  #this is the normal condition to block all CC 7 14’s
     If CC 7 14 XX is received  #CC 7 14 XX? I may use a 5 byte SysEx
          Block it
     End


I’m thinking it may be possible to block the SysEx msgs from being output as well?

Midi Monitor Output shown below when button “4” was pressed (first 2 lines) and then Start pressed. I would prefer the CC 7 9 0 at the end to be ahead of the SysEx that turns the filter off. Will need to test the organ behavior after the code is working.

16:53:59.196    From Session 1    SysEx        Unknown Manufacturer 4 bytes    F0 58 02 F7
16:53:59.199    From Session 1    Control    7    9    127
16:54:34.140    From Session 1    SysEx        Unknown Manufacturer 4 bytes    F0 58 01 F7
16:54:34.140    From Session 1    Control    7    8    127
16:54:34.145    From Session 1    Control    7    9    0
16:54:34.146    From Session 1    Control    7    9    127
16:54:34.163    From Session 1    Control    7    9    0
16:54:34.164    From Session 1    Control    7    9    127
16:54:34.184    From Session 1    Control    7    9    0
16:54:34.184    From Session 1    Control    7    9    127
16:54:34.202    From Session 1    SysEx        Unknown Manufacturer 4 bytes    F0 58 00 F7
16:54:34.202    From Session 1    Control    7    8    0
16:54:34.203    From Session 1    Control    7    9    0
16:54:34.203    From Session 1    Control    7    9    127
16:54:34.224    From Session 1    SysEx        Unknown Manufacturer 4 bytes    F0 58 03 F7
16:54:34.224    From Session 1    Control    7    9    0
How do I upload my layout? I can't find the Reply function that allows publishing images or files.
You have to go back to the top and start a new answer to your initial question.
I have not found an instance in the Demo 1.1 layout where the messages are not blocked during setup, including the synthetic sysex.  At least you know there is one solution that works, so you can try other approaches.
Also, I have not heard that the SB delays have been fixed.  https://mididesigner.com/qa/6952/streambyter-delays-not-working?show=6952#q6952  Tried a quick test, and delay had no impact on the output.
Didn't work. Can't get the window to upload an image and file. - Should I start a new question? I think you should compare it to your layout.
OK the layout is at the top of this thread
To block just channel 7, cc 14 messages:

Use
   B6 0E = XX +B # Block Ch 7 (_6h), CC 14 (0Eh)
in place of
   BX = XX +B # Block all outbound cc
0 votes

Latest Layout for Count Down Function


MIDI Target Manufacturer(s): Other/Unlisted Maker
Trying to attach the layout file
Downloads: 141
2020-08-16-HW cued stepper 0816b.mididesigner
Downloads: 141
answered Aug 16, 2020 by don-sabourin (170 points)
0 votes

Stream Byter Code that works with HW cued stepper Count Down


MIDI Target Manufacturer(s): Other/Unlisted Maker
After many attempts to have the filter block the Output msg when number buttons were selected in succession, I found blocking the SysEx message seem to set the filter off when it should have stayed on. It's like there is a memory when the SysEx is blocked, it turns the filter off. Perhaps because I am using 2 states? I may try to figure it out later.

I do have the layout working and verified it controls the organ as desired (hooray after several weeks trying). Now I need to create 3 such functions (1 for Units selection, 1 for Tens, and 1 for Hundreds). The stepper can be set to start any where from 000 to 999.

Another control I will add to complete the layout is a Units Up and Down and a General Cancel. Then I will publish the working layout and create a video to demonstrate its operation.

Below is my code. I used some SND while testing. In the final version I will remove them.

# HW cued stepper Countdown

# Use synthetic sysex msg to enable / disable specific outbound msgs  

# F0 58 01 turn filter off, allow message to pass when countdown starts  

# F0 58 03 turn filter on, block message (normal mode)   

# CC 7 9 msg to block or pass   

IF LOAD

  ASS I0 = 01 # initialize filter to on   

END

IF M0 == F0 58 03 # turn filter back on    

  ASS I0 = 01

  # SND B0 07 I0

  # FX = XX +B # Block outbound sysex   

END

IF M0 == F0 58 01 # turn filter off    

  ASS I0 = 00

  # SND B0 07 I0

  # FX = XX +B # Block outbound sysex   

END

IF I0 == 01 # Filter is on   

  B6 09 = XX +B # block CC 7 9   

  # SND B0 07 07

END

# IF M0 == F0 58 # Causes 7 9 to pass when number buttons presses

#     FX = XX +B # block any synthetic SysEx # let SysEx pass => no issue

# END
Downloads: 89
HW cued stepper Count Down 08/18
Downloads: 89
answered Aug 18, 2020 by dsabou2062 (1,860 points)
...