|
Post by mikefloutier on Mar 3, 2022 9:52:26 GMT
I removed the bits you suggested and it works like a dream; I’m like a dog with two tails. Thank you!
The only bit left that’s puzzling me is that, having set the Pedal Hold delay to 300ms, it seems to take nearly a second to take effect. I’m guessing that’s caused by the +D500 (delay) added to the Note Off send in the SelectPattern Subroutine.
To be honest it’s not an issue, in fact it works really well since, at my favourite tempo, I just need to trigger the Stop at the start of the last beat in the measure and it allows it to play the first beat of the measure again (which always includes a cymbal crash) before stopping. So natural!
|
|
|
Post by uncledave on Mar 3, 2022 10:32:36 GMT
No, the note off delay has no effect on anything. The note off message just follows the pattern select note on, to keep things balanced. Apps can get confused if they think many notes are being sustained.
But, your long press command does not happen after 300 ms. It happens when you release the pedal after holding for at least 300 ms. Maybe if you think about it that way, you could make it work; press the pedal before the end, and release it at the right time. The method I mentioned earlier, using an internal SysEx message, would fire after 300 ms, so it would be quicker, and not dependent on the release delay. I'll put that together later today. It's a fairly simple rev to what I already posted.
|
|
|
Post by uncledave on Mar 3, 2022 11:34:27 GMT
So, I couldn't resist trying this. The following handles the short click immediately on release, the hold immediately after the delay. No need to wait for release. SB label 0 shows whether click or hold was detected. I have tested this, using LK to send CC21. This will replace all the existing event handling. I've tried to make it clear. There are 3 events: press, release, and 300 ms after press. Since SB only runs when an event occurs, the delayed internal SysEx message is a handy way to trigger a run without outside intervention. Don't worry about the SysEx message being somehow "special". As used here, it's just an arbitrary message that could not have come from outside. #CC 21 code
# this code uses a timer to check for the short click, and a # delayed internal SysEx message to detect hold. This # allows us to handle the click immediately on release, while # handling the hold immediately on the delay, without waiting # for release.
# you can have multiple load blocks, no need to merge them If load Alias $300 delayTime # long press delay in ms Alias J03 clickFlag # be sure J03 not used elsewhere Ass clickFlag = 0 End
If M0 == B0 $21 # detect CC21 on MIDI channel 1 If M2 > 0 # CC value is 127 on press, 0 on release # here on press Set LB0 S_ # blank the label Ass clickFlag = 1 # press sets the flag Ass I00 = T00 # start timer Ass I00 = delayTime # cannot use alias in +D, so use variable Snd F0 7D 01 11 F7 +I +DI00 # internal msg will arrive after delay Else # here on release Ass clickFlag = 0 # release clears the flag If T00 < delayTime # check time since press UpdatePattern # short click Set LB0 SClick End End End
# this message was sent on press. It arrives after the delay. If M0 == F0 7D 01 11 # handle delayed SysEx If clickFlag == 1 # only true if still holding # long press. Do what you need. Set LB0 SHold End End
Block
Edit:Tidied labels.
|
|
|
Post by uncledave on Mar 3, 2022 15:51:02 GMT
Here is an improved version of my previous post. In the original, if a second click happened to bridge the 300 ms time, it could be taken as a long hold, although it was not. This version uses a counter to ensure that only holding the initial press can generate a hold. It also prevents a quick click then hold sequence. You have to wait until the 300 ms delayed message arrives before initiating a new hold. The tricky thing here is knowing when to reset the counter, so the game can start again. You can see how this works by watching the two labels in the middle of the bottom line of the SB screen. #CC 21 code
# this code uses a timer to check for the short click, and a # delayed internal SysEx message to detect hold. This # allows us to handle the click immediately on release, while # handling the hold immediately on the delay, without waiting # for release.
# you can have multiple load blocks, no need to merge them If load Alias $300 delayTime # long press delay in ms Alias J03 eventCount # be sure J03 not used elsewhere Ass eventCount = 0 End
If M0 == B0 $21 # detect CC21 on MIDI channel 1 If M2 > 0 # CC value is 127 on press, 0 on release # here on press Set LB0 S_ Mat eventCount = eventCount + 1 # press sets the flag Ass I00 = T00 # start timer # only send delayed message on first press. This prevents a # double-click from being taken as a long hold. If eventCount == 1 Ass I00 = delayTime # cannot use alias in +D, so use variable # internal msg will arrive after delay Snd F0 7D 01 11 eventCount F7 +I +DI00 End
Else # here on release If eventCount > 0 Mat eventCount = eventCount + 1 End If T00 < delayTime # check time since press UpdatePattern # short click Set LB0 SClick End End Set LB1 eventCount +D End
# this message was sent on press. It arrives after the delay. If M0 == F0 7D 01 11 # handle delayed SysEx # M4 was eventCount when msg sent If eventCount == M4 # only true if still holding # long press. Do what you need. Set LB0 SHold End Ass eventCount = 0 Set LB1 eventCount +D End
Block
|
|
|
Post by mikefloutier on Mar 3, 2022 15:57:54 GMT
Ok, thanks Dave, I’m not sure I understand it all at present; the business about setting a label called “s_” escaped me. What’s the purpose of the “s”?
Also I am confused about the use of Set and Assign. Is it Set for labels and Ass for numbers?
I need to go back to SB University 😂
I think I’ll stick with the current script, mainly because I think I understand it so I’ll be better placed to use/amend it.
Also, I’ve just realised that I’ve been mistakenly thinking that the script was actioning a detected pedal hold, ie. Start/Stopping the AR-909, rather than simply ignoring the press in regard to pattern switching. This, of course, explains why the delay in actioning the Start/Stop holds does not vary in line with the delay in the script. The length of delay in actioning must occur in AB3’s own internal coding.
PS this was written before your last post
|
|
|
Post by uncledave on Mar 3, 2022 16:26:33 GMT
Ok, thanks Dave, I’m not sure I understand it all at present; the business about setting a label called “s_” escaped me. What’s the purpose of the “s”? OK. The "labels" are the two black rectangles in the middle of the bottom line on the SB screen. They can display short status messages. You control them with "Set" commands, which SB uses for random internal stuff. Now, you can display a string in a label. The syntax is Set LB0 SMy_string. The S prefix indicates a string, and the underscore is displayed as "space". Setting the label to S_ clears it. Originally, I didn't have it, so multiple clicks caused no change in the display. With it, each event makes the display flicker. This is described in the manual, just look for the Set command. As I said above, Set is a special internal SB command. Ass and Mat are used when working with variables. Note that they always include an "=", which Set does not. I'd strongly encourage using my latest verion, with the delayed message and the eventCount. It will be more reliable in the long run. And you can understand it if you think about the state after each message: counter value, pending delayed message. Not sure what you mean here. My original script was waiting for the button release to detect the pedal hold. It responded immediately on release, provided the hold was longer than 300 ms. But, aside from requiring the hold to be long enough, the time had no effect on the rapidity of the hold response. How are you controlling the AB3 transport? Sending a CC to MIDI Learn and mapping it to the Play button?
|
|
|
Post by mikefloutier on Mar 3, 2022 17:56:03 GMT
Thanks for the info about the Set command Dave.
Yes, the AB3 transport is triggered by CC21s via midi-learn, set to toggle on hold.
I look forward to studying your latest script and trying it out when I grasp how it works.
|
|
|
Post by uncledave on Mar 3, 2022 18:14:39 GMT
Thanks for the info about the Set command Dave. Yes, the AB3 transport is triggered by CC21s via midi-learn, set to toggle on hold. I look forward to studying your latest script and trying it out when I grasp how it works. Just try it. With the labels, you'll quickly see how it works. Also, you can use SB's MIDI monitor (magnifier) to see the timing of messages, including the internal SysEx, which appears in input after the delay. If you want to use the monitor, you need to switch to it before running. It doesn't start logging until it's been opened, as an efficiency measure. Edit: I'll add some Log messages. They'll appear on the output side of the monitor, so you can see exactly when the various steps are occurring.
|
|
|
Post by uncledave on Mar 3, 2022 22:18:28 GMT
Here's the version with added Log messages. If you run this and watch the SB monitor, you'll see how the events evolve. Each message shows the eventCount value. #CC 21 code
# this code uses a timer to check for the short click, and a # delayed internal SysEx message to detect hold. This # allows us to handle the click immediately on release, while # handling the hold immediately on the delay, without waiting # for release.
# you can have multiple load blocks, no need to merge them If load Alias $300 delayTime # long press delay in ms Alias J03 eventCount # be sure J03 not used elsewhere Ass eventCount = 0 End
If M0 == B0 $21 # detect CC21 on MIDI channel 1 If M2 > 0 # CC value is 127 on press, 0 on release # here on press Set LB0 S_ Mat eventCount = eventCount + 1 # press sets the flag Ass I00 = T00 # start timer Log Press eventCount +D # only send delayed message on first press. This prevents a # double-click from being taken as a long hold. If eventCount == 1 Ass I00 = delayTime # cannot use alias in +D, so use variable # internal msg will arrive after delay Snd F0 7D 01 11 eventCount F7 +I +DI00 Log Message_sent eventCount +D End Else # here on release If eventCount > 0 Mat eventCount = eventCount + 1 End Log Release eventCount +D If T00 < delayTime # check time since press UpdatePattern # short click Set LB0 SClick Log Click End End Set LB1 eventCount +D End
# this message was sent on press. It arrives after the delay. If M0 == F0 7D 01 11 # handle delayed SysEx Log Delayed eventCount +D # M4 was eventCount when msg sent If eventCount == M4 # only true if still holding # long press. Do what you need. Set LB0 SHold Log Hold End Ass eventCount = 0 Set LB1 eventCount +D End
Block
|
|
|
Post by mikefloutier on Mar 4, 2022 9:35:53 GMT
Thanks Dave, so basically this does the same thing as I have at present, BUT, it’s much more re-usable as it would work if I didn’t have access to the midi-learn. In fact in any situation where I want to differentiate AND act on a single quick click and a hold.
I certainly see the beauty of this BUT I’m starting to feel like a young sprinter training alongside Usain Bolt. As usual, I’m sure I’ll be back when I catch up a bit 😂.
Thanks so much for all your help and patience!
|
|
|
Post by uncledave on Mar 4, 2022 10:51:19 GMT
Thanks Dave, so basically this does the same thing as I have at present, BUT, it’s much more re-usable as it would work if I didn’t have access to the midi-learn. In fact in any situation where I want to differentiate AND act on a single quick click and a hold. I certainly see the beauty of this BUT I’m starting to feel like a young sprinter training alongside Usain Bolt. As usual, I’m sure I’ll be back when I catch up a bit 😂. Thanks so much for all your help and patience! Yes. When you originally asked, I thought you needed something that would be able to act on both click and hold. It wasn't just a filter to ignore hold. My comment "Do what you need" meant that you should insert the hold action there. You still can, if it would simplify operstion downstream. And it will respond to hold in exactly 300 ms, which whatever you're doing now likely does not. You could just send a new CC21 message, maybe toggling between 127 and 0 on alternate presses. Or whatever.
|
|
|
Post by mikefloutier on Mar 4, 2022 18:03:20 GMT
Hi Dave, well I tried out the existing setup in practise and have discovered that, in order to work well live, it will need to be slightly more sophisticated.
Having recognised the benefits of keeping it all inside SB (subject to being able to trigger the AR-909’s transport control - either directly or via AB3’s) I would like to be able to implement the following:
1. Toggle Start/Stop the AR-909 - with a short hold, say 300-999ms, 2. Nudge the AR-909’s patterns 1&3 to patterns 2&4 then back to patterns 1&3 (at the end of the patterns 2&4) - with a long hold, say 1sec+, and 3. As “2”, but moving ON to patterns 3&1 instead of BACK to 1&3 - with a short tap.
NB:
In 2. , the nudges onwards from 1 to 2, and 3 to 4, must occur during the first half of 1&3 (to allow for the inclusion of the fills contained in the 2nd halves of 2&4) AND, the nudges back, also during the first half, in order to exclude those same fills.
In 3. , the initial nudges are the same as in 2. BUT, the second nudge (ie. from 2 to 3, and 4 to 1) must occur as close to the beginning of the measure as possible (not at the beginning) as the nature of the entire new measure is different.
——
I picked this system because it mimics the pedal presses required by my (incredibly) 30 year-old Alesis SR-16 and is therefore instinctive.
I found I could do what I wanted with carefully timed double and triple taps but, if we could possibly implement 1 to 3 above, it would be so much easier.
Not sure if this is possible, but if it was it would be pretty cool, I guess you’d need to get into the “head” of the AR-909.
|
|
|
Post by uncledave on Mar 5, 2022 11:46:54 GMT
If you load AR-909 as AUv3 in Audiobus, it will respond to the Audiobus play/pause control. And there's an event called MIDI Clock that lets a script count its way through the bars. So this is definitely feasible, assuming you set the tempo in Audiobus. I need a little more research though. When you say "patterns 1&2", do you mean pattern 1 or 2? So if it's in 1 it jumps to 3, if in 2 jump to 4? Could you write out a little story of what you expect? Something like this: That way, I can understand fully how this is supposed to work. If there are different variations to the sequence, it's probably easier to describe each one separately, instead of trying to write a "program" with many ifs and branches.
|
|
|
Post by mikefloutier on Mar 5, 2022 16:19:19 GMT
Hi Dave, thank you, sorry it was confusing, I’ll follow your plan.
Regarding the AR-909 play/pause, I’ll use AB3’s transport controls, as you suggest. I’ve been doing this with Hold as a trigger with my BlueBoard CC21 external sustain pedal.
I have been concerned that this restricts the remaining available trigger options (for navigating the drum patterns) BUT I just realised that I could simply listen for a Hold from one of the BB’s internal buttons (which are only used for presses).
Then, since I only need to detect two different pedal triggers, from the external pedal, (1. Press, and 2. Hold), it’s much easier to use in practice.
Ok, here is the “little story”:
Intro:
1. It’s all related to the manipulation of 4 of the AR-909’s patterns; play/pause covered as above, 2. The tempo will vary from preset (song) to preset, 3. Each measure is 4 beats long, with a maximum of 8 steps per beat (so 32 in total); although there is the option for simpler 16 step measures, 4. The 4 patterns will always contain the following: Pattern 1 - Main beat, Pat 2 - Main fill-in, Pat 3 - Alternate beat, Pat 4 - Alternate fill-in, 5. A typical (shortened) song’s pattern sequence might go like this: play 1,1,1,2,1,1,1,2,3,3,3,4,1,2 pause, 6. Patterns 1 and 2 are identical apart from some embellishments during the second half of the measure in the fill-in pattern. Same with patterns 3 and 4, 7. The first step of both of the fill-in patterns will always contain a cymbal crash.
The story proper:
Part 1
Chapter 1
1. Play pattern 1 2. Until I Short Click 3. Then play pattern 2, followed immediately by pattern 3
Chapter 2
1. Play pattern 3 2. Until I Short Click 3. Then play pattern 4, followed immediately by pattern 1
Part 2
Chapter 3
1. Play pattern 1 2. Until I Hold 3. Then play pattern 2, followed immediately by pattern 1
Chapter 4
1. Play pattern 3 2. Until I Hold 3. Then play pattern 4, followed immediately by pattern 3
Hope this makes sense.
|
|
|
Post by uncledave on Mar 5, 2022 16:58:39 GMT
OK. This is getting a little too complicated for external help. You're going to need to develop this yourself, to meet your exact needs. You can detect the medium length hold on release by checking the timer. And you can still use the delayed message to activate the long hold after exactly 1000 ms, so you don't need to wait for release on that.
I wonder if the sequencing ability of an app like LK might be useful here, using SB as needed to trigger it. I'm not really up on music automata, so I may be missing something obvious. This is a far cry from how can I send PC or notes from a generic pedal message.
I've found out how to access the MIDI clock in SB inside AB3, but it requires that you buy the Mozaic app. It seems like Mozaic receives an event called MetroPulse which SB hides from us. I'll put together a little demo. The clock will let you detect which bar you're on, and where you are in it, so you can schedule those pattern transitions accurately.
|
|