Hi nic. First of all thanks for creating Stream Byter. It is a very powerful midi tool! I would like to use it for one task and have already dived into your coding university but it looks that it could take me ages to master it to the point of writing the script I need.
Can you help? I guess it is quite simple thing to create. I use Stream Byter as a midi fx in Nanostudio 2 There is a midi sequence: 4 bars (16 steps in every bar) with drum hits (midi notes). I need only certain notes (at the end of 2nd and 4th bar) to play with lower probability to introduce some randomisation. How to write this in Stream Byter?
The biggest problem you are going to face is figuring out when you are in one of your 'zones' when it should start randomly dropping notes out of the sequence.
You say you are using it with NS2, so this means you need to look at the BPM and POS variables that StreamByter updates as the AU host transport rolls along. You can use those two variables to figure out which bar you are in and if you are in bar 2 or 4 then randomly drop the note.
# trap note on if MT == 90 # figure out how many ms per beat into P0 calc P0 = BPM * $100 calc P0 = P0 / $60 calc P0 = $100000 / P0
# work out which bar we are in into P1 calc P1 = POS / P0 # absolute beats calc P1 = P1 / 4 # absolute bars calc P1 = P1 % 4 # current bar 0 to 3
# if bar 2 (P0 is 1), drop 50% notes if P1 == 1 if R2 == 0 # R2 will return 0 or 1 block end end
# if bar 4 (P1 is 3), drop 25% notes if P1 == 3 # R4 will return 0, 1, 2 or 3 if R4 == 0 block end end end
I have just typed the above in off the top of my head. It may not compile and it may have errors. The point is to show you more or less one approach to solve the problem. You get to figure out the detail. ;-)