|
Post by mikefloutier on Feb 16, 2022 10:41:04 GMT
Hi Guys,
Just to introduce myself, I’m a 68 year old Muso, jack of many trades...
Currently I’m getting lots of opportunities to play acoustic guitar, either solo or in a duo or small band. To supplement this, having discovered Midi Guitar 2, I added AudioKit’s Synth One to add pads or strings to the natural guitar sound. I’m now looking at adding some rhythm and currently trying out AudioKit’s A-909.
Initially I simply started each App as a standalone, but recently I’ve seen the advantages of using some of them within a host and have purchased Audiobus 3 to enable this.
Now as you can imagine, playing guitar, unlike keyboard, doesn’t give much opportunity for tapping GUIs etc and so I invested in an IK Multimedia iRig BlueBoard Bluetooth Midi pedal board to help with this.
To be honest the BlueBoard is at its best and easiest when used in conjunction with midi-learn (some apps seem to offer quite sophisticated scripts triggered in this way). However my Apps don’t offer all I need in this department, hence my appearance here for help in crafting a StreamByter script in order to make good use of BlueBoard’s 4 available pedals.
Ok, sorry for the lengthy intro. I’ve read all the brilliant stuff on the StreamByter page, this forum, including the University material, MidiBridge tutorial and Steambyter manual so I thought I’d have a try at some simple re-mapping of my BlueBoard output.
I know I’ll have many questions as I work through things but at this stage I’ll content myself with one issue which nearly put me off completely.
My first task was to learn how to save my script as a preset. Simple, I thought, either in SB or the host AB3. But each time I tried, it didn’t work. Once or twice it seemed to, but mostly it didn’t. My only thought is that maybe, having entered a script, one needs to tap the “Install Rules” button BEFORE saving.
Is this correct or am I missing something else?
|
|
|
Post by uncledave on Feb 16, 2022 11:19:17 GMT
Hi Mike, Yes, you must Install Rules before saving. The file SB saves is the installed copy. The text editor just edits a temporary copy. Install Rules saves it. Note that the Local storage for SB stand-alone and AUv3 is different due to sandboxing rules. You pretty well have to use iCloud Drive for convenience. SB is the only app for which I have enabled iCloud Drive. Also, when you save a host preset in Audiobus or other AUv3 host, SB saves the script state at that time. It does not reload the script file that you may have editied.
If you can write a clear spec for what should happen when each button is pressed, I could provide a starter script. If you're a bit of a programmer, you'll be able to adapt it (and debug it) from there. The trickiest thing is that all the variables are global arrays; it's like a programmable calculator. So you need to have a clear mental map of which data is where.
In your spec, don't worry about what needs to happen in the code, just what MIDI messages the script should send when a particular note is received. Remember that we can implement double tap and tap/hold as well as just single tap. You can actually go higher (double tap then hold, triple tap), but I doubt the dancing toes could handle it. For example, we could make button A tap for PC down and hold to reset to 0, button B for PC up. Or you could put everything on button A: tap to step, hold to reverse, double tap to reset. Depends on how you want the UI to work: single operation or modal.
Cheers, Dave
|
|
|
Post by mikefloutier on Feb 16, 2022 13:19:55 GMT
Many thanks Dave, I will take you up on your kind offer and put together a spec asap.
|
|
|
Post by mikefloutier on Feb 16, 2022 16:21:07 GMT
Hi Dave, here is my Spec, as requested. Hopefully it makes some sense 😂
Many thanks! Mike ————
StreamByter (SB) script spec request - BlueBoard (BB) > AR-909
Purpose:
To scroll, up and down, through the AR-909s first 4 patterns, using BB’s buttons A & B
Info:
BB buttons A & B trigger notes C3 & D3 on Ch 1 (confirmed with SB)
AR-909 patterns 1-4 are triggered by notes C-1 to Eb-1 on any channel or Omni (confirmed with SB)
Tasks:
1. Script to load automatically on startup, if possible 2. Initialise AR-909 to pattern 1 3. BB Button A is to increment pattern number on AR-909, unless already on pattern 4 4. BB Button B is to decrement pattern number on AR-909, unless already on pattern 1
End
|
|
|
Post by uncledave on Feb 16, 2022 18:44:16 GMT
OK. The script will load when the Audiobus preset containing it is loaded. It can be a little tricky initializing other apps on script startup, since the other app may not yet be loaded and connected. I suggest that your first tap will reset AR-909. Basically, you send a Down tap, the app is reset and nothing else happens because it's already on the first pattern.
I assume your note numbers are relative to C3 middle C, MIDI note 60, the convention used by SB. Nic likes this because 3C is hex for 60, an amusing coincidence. Some apps and users use C4 for middle C, and everyone assumes that they're right and everyone else is mistaken.
|
|
|
Post by uncledave on Feb 16, 2022 19:35:03 GMT
Try this and see how it works for you. I've tested it with AR-909 in Audiobus and it works, but only using the screen keyboard for notes. I hope it's easy to understand. I use aliases to name "variables" even though we know they're just array elements. And don't forget the $ for decimal numbers. You need to copy this and paste it in into SB. If you need to post some code, put it between code tags, like HTML. Another little catch is that most of the varialbes are unsigned so negative values appear as large positive values. That's why I only subtract when the value is greater than zero. I should mention that we're sending on MIDI channel 1 (0 in the script). We could be cleverer about that if necessary.
#SelectPattern
If load Set name selpat Alias $12 patternBase # first note number for patterns Alias 3 maxPattern # patterns numbered 0..3 Alias $60 noteUp Alias $62 noteDown # using the J array for saved values, I for temp values Alias J00 needInit Alias J01 currentPattern Ass J00 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Alias I10 temp0
# this sends both note on and note off (delayed) for the selection # apps tend to work better when notes are not left hanging Sub SelectPattern thePattern # get note number for the pattern Mat temp0 = patternBase + thePattern Snd 90 temp0 3F Snd 80 temp0 0 +D500 End
# theDir is 1 for up, 0 for down Sub UpdatePattern theDir If theDir == 0 If currentPattern > 0 Mat currentPattern = currentPattern - 1 End Else If currentPattern < maxPattern Mat currentPattern = currentPattern + 1 End End # this will send a note on every button press # could move it inside the ifs, so it only happens when # pattern changes SelectPattern currentPattern End
Ass needInit = 1 End # Initialization ———————————————————————————
If needInit == 1 Ass needInit = 0 UpdatePattern 0 End
# handle Note On # all notes are blocked, so only the pattern notes get through If MT == 90 If M1 == noteUp # received note is in M1 UpdatePattern 1 End If M1 == noteDown UpdatePattern 0 End Block End
# ignore Note Off If MT == 80 Block End
|
|
|
Post by mikefloutier on Feb 16, 2022 22:45:03 GMT
Many thanks Dave, makes me glad I didn’t try by myself 😂
Will give it a whirl in the morning.
|
|
|
Post by mikefloutier on Feb 17, 2022 8:54:54 GMT
Woo Hoo Dave, thanks so much, it worked like a dream, straight out of the box!
I guess what I’ll do now is:
1. Study it to understand how it works, and 2. Try to adapt it to do the same for buttons C&D on the BlueBoard, but in relation to AR909 presets.
That would give me the ability to choose the relevant preset for each song and, within each song, to select its main drum pattern, alternate pattern, plus their related fills.
Wonderful, thank you so much! 🙏🥁🍾
Ps btw the BlueBoard has two sockets for expression pedals/switches. I can use one to start and stop the AR909 (midi learn) and the other for my volume pedal to control AR909 and/or Synth One volume (again midi-learn)
|
|
|
Post by uncledave on Feb 17, 2022 10:53:41 GMT
Great. If you've ever done any programming, you can see how I organize things. The "main" body of the script is the event (note) handlers, with minimal logic. The finicky detailed stuff is packed away in subroutines (Sub) that do specific jobs. That keeps the main part clean and makes the sub logic easier to verify (and understand, I hope). The key thing to remember about SB is that it runs once for each MIDI message received. The message bytes are presented in the M array, specifically M0, M1, M2. You can modify those bytes and the message will be sent on out, or you can Block it. Here, I Block it and send a new message because we may not always send if the counter is already at the limit.
But, unless you already know better, I don't believe you can change presets in AR-909 with MIDI. I have an SB script that lets me send arbitrary PC (and Bank Select) messages. I used it to verify that SynthOne responded to PC (and ignored Bank Select). I tried it with AR-909, and it does not respond to these messages at all. If this is a problem for you, there might be a solution in AUM. AUM has an interesting system where it stores an AUv3 preset in its own file system and can recall it. (Basically, it requests the state from the app and stores it, just like when it saves a session.) AUM can be enabled to restore these presets on MIDI command. If you're interested, I can try this out, so you would know before buying AUM.
Edit: I just tried this in AUM. Saved a couple of presets to AUM files. Configured PC 0 and 1 to select them; worked perfectly. You can actually configure any MIDI event to make these changes, but PC is not a bad choice. This works because it's entirely implemented in AUM; the AUv3 is not involved at all. If you go this route, I can provide more detailed guidance, since it requires a little familiarity with AUM.
|
|
|
Post by mikefloutier on Feb 17, 2022 16:06:23 GMT
Thanks Dave, I’ve currently got a request in course with AudioKit (AR-909’s publishers). I was previously asking for details of how to implement Start/Stop and Pattern Switching by Midi within the App.
I’ve updated this so that I’m now asking for details as to how to switch presets. I’ll probably wait for their reply, or the next App update before deciding on AUM.
With regard to the AR-909 App development, I noticed, from their Version History, that 1.4.2, released 4 weeks ago, mentions that “This update adds iOS 15 AUv3 support for...AudioBus 3...” . They are clearly still actively developing it so hopefully Preset Switching will feature in the next update.
In the meantime, however, it occurred to me that, having just updated my iPhone to iOS 15.3.1, I’d quite like to try your “PC preset switching” script just to see if it works on an iOS 15 phone. It would also aid my learning process. (I’m just about to printout your Pattern Switcher btw so be prepared for newbie questions)
Thanks again for your patient help with this, it’s much appreciated!
|
|
tap
Converser

Posts: 35
|
Post by tap on Feb 17, 2022 16:37:28 GMT
One thing I would add: Blueboard actually supports 128 steps, not just 4. There are two choices with Blueboard: Scroll up/down with the A/B buttons, or bring up 4 "banks" of buttons A-D at a time and then choose among them. I use the latter option because I rarely need more than 4 configuration changes in one song.
|
|
|
Post by uncledave on Feb 17, 2022 17:53:07 GMT
Here's my PC test driver. Use the GUI slider to send a PC # message. You can see it in the SB monitor display. But it won't work for AR-909, since it doesn't work for me using iPadOS 15.3.1. I'm usually close to current on my iPad 6; only the old iPad Air is stuck on 12.5.5. Since you don't have my MIDI controller, you won't be able to use the Note and CC features of the script, but it's plenty to test sending PC messages. Sorry about the tabs BTW, they make the script look awful. #PC_test # test driver for Program Change and Bank Select messages # sliders send message on change # use Knob 5 (3 positions) to select value to control. # hold Patch> and use note above middle C to select a value
If load
Alias I10 user0 Alias I11 user1 Alias I12 user2 Alias I20 dlib0 Alias Q4 currMode Alias L1 setValue
Ass L0 = 0 0 Ass Q0 = 0 0 0 0 0 0 0 0 +P
Sub Send_PC value Send C0 value End Sub Send_Bank value Send B0 00 value End Sub Send_Hi_Bank value # sends the wide bank select message Mat user0 = value / 80 Mat user1 = value & 7F Send B0 00 user0 Send B0 20 user1 End
# sends the updated control value in the correct message Sub Update_control index Ass I12 = index Ass user2 = QI12 If index == 0 Send_PC user2 End If index == 1 Send_Bank user2 End If index == 2 Send_Hi_Bank user2 End End
# convert CC value [0,127] to result [0,count-1] with equal bands, # half bands at ends (end band centers are 0 and 127) # example: Knob_select I0 M2 5 # convert CC value to 5 bands [0,4], returning in I0 Sub Knob_select result cc_value count # use local 16-bit reg in case result is a byte Mat dlib0 = count - 1 Mat dlib0 = dlib0 * cc_value Mat dlib0 = dlib0 + $64 Mat result = dlib0 / $128 End
Set Q0 Program 0 1F # Program Change Set Q1 Bank 0 1F # Bank Select, one byte Set Q2 BankHi 0 1F # Bank Select, two bytes Set Q3 +Hide Set Q4 Mode 0 2 +Menu Set Q5 +Hide Set Q6 +Hide Set Q7 +Hide Set SLIDER_DISPLAY 1 End # Initialization ———————————————————————————
If MT < A0 If setValue > 0 If MT == 90 # handle note on If M1 >= $60 Ass I0 = currMode Mat QI0 = M1 - $60 # values count up from middle C Update_control currMode End End Block End End
If MT == B0 If M1 == $116 # Mode select, Knob 5 onLX61+ # modes 0..2 select the 3 controls. Knob_select currMode M2 3 Block End End
If M0 == BF 70 # Patch> on LX61+ Ass setValue = M2 # value is 7F set, 0 release Block End
If M0 == F0 7D 01 # handle control change Update_control M3 End
|
|
|
Post by mikefloutier on Feb 18, 2022 8:41:32 GMT
Many thanks Dave, I’m sure I’ll find that useful although, since you’ve tried it on iOS 15.3.1 I’ll take your word for it - I’m assuming you have the most recent update for the AR-909.
Getting back to your script for scrolling the AR-909 patterns, to help with my learning SB, I was puzzled as to what “thePattern” is an Alias to.
|
|
|
Post by uncledave on Feb 18, 2022 10:56:57 GMT
Many thanks Dave, I’m sure I’ll find that useful although, since you’ve tried it on iOS 15.3.1 I’ll take your word for it - I’m assuming you have the most recent update for the AR-909. Getting back to your script for scrolling the AR-909 patterns, to help with my learning SB, I was puzzled as to what “thePattern” is an Alias to. It's not an alias. In SB, subroutines (Sub) take named parameters. So thePattern references whichever variable is used in the subroutine call, SelectPattern currentPattern, so the parameter is the currentPattern. I use the prefix "the" for parameters, so they stand out. The somewhat interesting feature of SB is that all parameters are passed "by reference", like traditional Fortran. You can cause real trouble if you modify a parameter unintentionally since it will alter the passed variable. This feature does allow a subroutine to return a value by updating a parameter. By the way, SB is actually case-insensitive. I use this "camel case" style just to make multi-word names more readable. Edit: If you let me know the extent of your programming experience, I could adapt my comments accordingly.
|
|
|
Post by mikefloutier on Feb 18, 2022 18:01:21 GMT
Thanks Dave, my programming experience is very Basic. I dabbled with a Sinclair ZX81 and later a Spectrum in the early 80s. I even managed a little Z80 assembly language. My only program, apart from some Basic, was to get my ZX81 to tell a tone generator add-on how to play the first movement of Beethoven’s Moonlight Sonata. After this I took up golf and spent all my spare time practising my swing 😂.
In short, the StreamByter University didn’t seem too alien, but 40 years is quite a while so I may need a bit of practice and help.
|
|