|
Post by hansson0728 on Sept 12, 2018 18:54:57 GMT
Okey so this looks cool,
i learn by doing and ask stupid questions, ive looked at some of the code here, and i wanted to try and combine the slapback delay example with the quantaization script, basicallyif i want to echo a note on 8ths in 120 bpm, what would that look like ?
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 12, 2018 19:05:51 GMT
I would recommend that you use two instances of the Stream Byter, one configured with the quantiser code and the other with the delay code and have one feed into the other in the host app.
Regards, Nic.
|
|
|
Post by hansson0728 on Sept 12, 2018 19:13:47 GMT
True but that defetas the purpose of me tying to learn this So the delay: NX = XX +D400 +C If i want to replace the 400ms with 1/4th of 120bpm In the quantize code i see: # customise these konstantas # K: 0-bpm, 1-divisions, 2-quantise length (0/1) ASS K0 = 78 16 0 SET LB0 K0 +D # calculate division interval (ms) into K3 # (or you could just set your own division in ms) MAT K3 = EA60 / K0 # ms/beat MAT K3 = K3 * 4 # ms/bar MAT K3 = K3 / K1 # ms/division So how do i combine them, # customise these konstantas # K: 0-bpm, 1-divisions, 2-quantise length (0/1) ASS K0 = 78 16 0 SET LB0 K0 +D # calculate division interval (ms) into K3 # (or you could just set your own division in ms) MAT K3 = EA60 / K0 # ms/beat MAT K3 = K3 * 4 # ms/bar MAT K3 = K3 / K1 # ms/division NX = XX +Dk3 +C Does not work
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 12, 2018 19:39:36 GMT
Hi hansson0728 , You are on the right track in that the value you want is in K3, but you cannot use variables in the pattern matching (Stream Byter 1) rules. Instead of: NX = XX +Dk3 +C # invalidThis code is the equivalent in Stream Byter II: # is this a note on/off event? IF MT < A0 # create a clone delayed by the # number of ms in variable K3 SND M0 M1 M2 +DK3 ENDRegards, Nic.
|
|
|
Post by hansson0728 on Sept 12, 2018 20:59:58 GMT
I see , iam trying to set a fixed velocity but if i change m2, it seems i never get any note off do i have to send a second note off if that is the case ?
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 13, 2018 7:18:02 GMT
Hi hansson0728 , You are probably rewriting note ons with velocity 0 which are actually note offs. The source is probably sending these. To counteract this, put an IF around it so you only rewrite if M2 is not zero. IF M2 > 0 ASS M2 = 40 ENDRegards, Nic.
|
|
|
Post by hansson0728 on Sept 13, 2018 10:51:18 GMT
Okey so now i have something like:
# customise these konstantas # K: 0-bpm, 1-divisions ASS K0 = 78 8 # Loop Count ASS K10 = 0 15 # Velocity start (will fade to 0) # calculate division interval (ms) into K3 # (or you could just set your own division in ms) MAT K3 = EA60 / K0 # ms/beat MAT K3 = K3 * 4 # ms/bar MAT K3 = K3 / K1 # ms/division ASS K4 = K3 IF MT < A0 IF M2 > 0 ASS M2 = 40 END IF K10 < K11 +L SND M0 M1 M2 +DK3 MAT K3 = K3 + K4 MAT K10 = K10 + 1 END END
this works, it breaks after sometime, i think this is already fixed in latest beta as i understand, but what if i want to lower the velocity by lets say 10 perent per literation, how would i do that ?
|
|
|
Post by hansson0728 on Sept 13, 2018 10:51:57 GMT
iam am going for a midi echo here as you can see
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 13, 2018 12:56:39 GMT
Hi hansson0728 , I have streamlined your code a little and added in the 10% velocity reduction per loop iteration. I also adjusted the start velocity and reduced the number of times you feedback as 21 times will make the velocity go negative. The update is sitting at Apple waiting for review, but if you want access to the latest version via TestFlight now, just PM me the email address I should use for TestFlight. # customise these konstantas IF LOAD # K: 0-bpm, 1-divisions ASS K0 = 78 8 # Loop Count ASS K10 = 4 # Velocity start (will fade to 0) # calculate division interval (ms) into K3 # (or you could just set your own division in ms) MAT K3 = EA60 / K0 # ms/beat MAT K3 = K3 * 4 # ms/bar MAT K3 = K3 / K1 # ms/division END
IF MT < A0 IF M2 > 0 # init loop vars # start velocity, start delay, start counter ASS I0 = 60 K3 0 IF I2 < K10 +L SND M0 M1 I0 +DI1 MAT I1 = I1 + K3 MAT I2 = I2 + 1
# reduce velocity by 10% # for next iteration MAT I0 = I0 * 5A MAT I0 = I0 / 64 END END ENDRegards, Nic.
|
|