Random! But Not You, Not You ( I mean Dotted and Triplets)
-
Hey folks
Trying to randomize A Delay Tempo Knob Based on Below Scenario:
I want a Button to switch between Only :
- 1/1, 1/2, 1/4, and so on...
and if the Button is Disabled - randIt (0,18) All Values
any help is Much appreciated
- 1/1, 1/2, 1/4, and so on...
-
@Natan Put them in array. Then, use a random number generator to choose between the indexes in the array. Let me know if you need more help on this.
-
@Natan I've found the other guy with a wacky sense of humour here!
-
@clevername27 said in Random! But Not You, Not You ( I mean Dotted and Triplets):
m in array. Then, use a random number generator to choose between the indexes in the
Thanks man, Can't get it to work :/
const var Randomizer = Content.getComponent("Randomizer"); const var NoDT = Content.getComponent("NoDT"); const var Tempo = Content.getComponent("Tempo"); const SyncValues = [0,2,5,8,11,14,17]; inline function onRandomizerControl(component, value) { if (NoDT.getValue() == 0) { if(value) { Console.print("All"); Tempo.setValue(Math.randInt(0, 18)); }} if (NoDT.getValue() == 1) { if (value) { for (i = 0; i < 6; i++) Tempo.setValue(Math.randInt(0, SyncValues.length)); }} }; Content.getComponent("Randomizer").setControlCallback(onRandomizerControl);
Snippet
HiseSnippet 1036.3ocsVEtaaaCDlx1JqRsqnEnO.B4WxndFVYooAHMXtwNYvXMoF0YACXXnfQhNlKTjBTzY0qH.6oXOX6IYuAa2IIaorZG2ZfICXax6938wOd2QMTqBYooJMwx47YILh0irGMSZlzaBkKIC5Srdr8ozTCS6kO0QyRnoorHhkU8uGmvxoAI64u+tinBpLjUNEgbghGxdCOlaJmcX2efKDmPiXmyiq38tcGDpj8TB0TfO0s6PRngWSuhcFEcqlMwZqii3FkdjgZXofOGohlMZh52j49eAOkeofgCBHifEJeZRuIbQzv460TBwpwvxcd87c9yrOkGwWLeoB7jLCdkHppAV0tOJE7EPIqJTpQNkdp8nPMOwTZA4yCsGHgCjwTPpqRkbeI0dXc6dJvCoocL8Z1IZXvBD960oSKO3qlG355B5cpw6Fp16cTYjJl+6vA8gdygeEyzSEmnjv.+sKcYa.bIzyT8OekfPi208yYfwU5el0sqPNHcL7BpXJKEv7ycZsSqWzZ+VAAsB1sUvK+EzQtTvkLuwSkgFtR5ojkTEihVI7CmGhV.IfUqo6Gccc3i87QFhjHKH9M8N7PuNMcc9HZ0uvWbDrRoJAqchliD80BARSmLB2NcN9SolIs0P3AE2GT5f8a17.GWmau00I+yJhYv7X5UMniUZOeNry6bfG26Ud6A+77m2DWm0D3RcqsfIuxLA3gaFKbcuETs0eFiqcg70iJDWBEi9KQZwypJR+YJC6sReTecbu006+ZZ73kZqXwDL8RMicJz2GPe4z3KY5JmtYNBkR2s9bqOu5yvb0ohiJ4.I271DVw3SThHrtC++mVMSJjWnttVACAWMYU0Otnp9noFiRR3vhrkMlQPx3d0NpjUgcjfGwzYX+J6rLg4fsspiX+wA8oFJ1VofI.6RXZCGEAq9raf9x4MYbr6yRu1nRffrHS.V1UR1GYWlCP9.Fw+BB3rE79OtnaJ8F1.4PMCRgvVSLIEDYrM5aXTsDmhmdpJFhDUCHspQpD5FqSmpFTaq+jjo2Kf+f0JUKgzc+0tw7nHAanJkioVkGCa2Et+KYDrcqdzDqhXXu3rUDK1HwzOT5vNcIeZ+b3lDUzTA0b2qWv6QKLfAtZOcrusDHzrpg9K3NmN26cNetT7o1C4lvIKmi0VBGwz9+G3XwM0es8wiGyBMkDrg8I+zlds7ZB+6TSMb4UP6UMGyaNaZ7H3ETBYPzkRlHEykpgYf4i6fiQEXDSFkM3efmBiA3XqBiAyMBYNgZ06Cyq0w2E3AYy.bRl8pONv6fAi8BVTja2ocGBjvxeeXHt8+FnIzxwryFf4a2.L6tAXdwFfYuM.yK2.L6euXvVYudpQEmWN.SL73rFtVVGm0qKKKj7u.uRlGrB
-
Okay! Job Done :)
Is it Dirty?
const var Randomizer = Content.getComponent("Randomizer"); const var NoDT = Content.getComponent("NoDT"); const var Tempo = Content.getComponent("Tempo"); const SyncValues = [0,2,5,8,11,14,17]; inline function onRandomizerControl(component, value) { if(!value) return; if (NoDT.getValue() == 0) { if(value) Tempo.setValue(Math.randInt(0, 18)); } if (NoDT.getValue() == 1) { if (value) for (i = 0; i < 6; i++) Tempo.setValue(SyncValues[Math.randInt(0, SyncValues.length)]); } }; Content.getComponent("Randomizer").setControlCallback(onRandomizerControl);
HiseSnippet 1026.3ocsV01aaaCDlx1LqxqqXAn+.zxmjQ8LjxRSCPVv7hcxfwZRMpxBFPQQAiDcLajHEnnxlaQ.1Os8SZ+C1NpWrjyrZFLV8GRv8xycO73cG0TovmljHjHCyKVDSQFOF6sfqlOZNgwQSFiLdB9LRhhJsxUc7hXRRBM.YXz9mzJLL6fx98W+vwjPB2mVoBgtTv7oujEwTUZmN7mYggmRBnWvhp48dCm3K3iDghTfOswNnXh+MjqomSzt0BiL15j.lRH8TDEMAYz4XQvBu4heim6+krD1UgTsfKxCBTt5SEgAZFq0hFMmEFLs7bmffnLspJzNuJ7T7Yr.1R8UUiuNyfUEh50CiVqRu1qPO25zyoF8VCkLpQoN4TZarmujEqprn4yWhmvgKmYDnrWmJ49hZsUa7HA3AWMHhbC8TIHrDg89NN8sf+z6vtc6B09Dk0sDo0qI7.QD6Cvk9QVkvulpFIhhEbPvdmJW1A.WA8bw3KZDj13pteAEL1n+YV2oF4fVS+KIgozD.yab5ua+m2+f9tt8c2qu6Kdq1QFOjwoVyR49JlfaI3UTUmEoHz1uLE8AR.QqW2O10jMy9aJjLMkTUpjCwCTaYq4slZYo1tm0QGY4.dkCpDSFYGjT50YD07ARH0P01FpxtGzq2glcMuq4X5VFSqkA0blPZYyfSqygVLqu2Ze3eO6YZK2KeUkl2b+TWYZPHkesZdu2VRk6Nr6Ce+pSRQoaDIL7JXnzdMkU3dpVU+bgh9JtcVos6ccstuoYyVqshXERkq0rdgg7SAzlmFcEUV+hU6HLEs5nIt4Qy5aN7yKN0bTvmvYpWES4MsOAUTQgw3VErBbUkMD+jhg3iSUJAGwfY0sv5VATFequLE0DVuPV.Ulg8KvYcAKAu01k6c+kIiIJhdSRAa.FFSkJl9vaLldKrVNeuhIdLM4FkHFRzxF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Ccp22T.zwQRTYRdtXWOM407y3AuNtGcjqOX0GMfJwXXbuzRqNCql0SBrDR4dPpN3fNcND3ycq2mAk9zcgSclJjtdTfz9G5Rceo69veO6YZM2KdUugu69gtRUOFgesZVm2WRk6Nr8CWj0AoHKO.yXWASldqnB.EqZEnyEJxa3d4Ug6Z6deUSmtRcE9hQjqTsdqg7SAzimEeEQtTO.XHLJs77o85mOqu9HLO4TyPAeDmpdSBgutkJnhLJLK2nfUfoJyj7SJljONSoDbDEFX2xV2JfL7s9FUz5vNgQiHRC1uv1zEr.7VaWt78mFMDqv50IErAXXBQpn5Wdqgjagcy4KWbrGRRuQIRf.snA.b8ZI7isqJ8neaAk6+K8mu3vebY+T7sjQ7wRBz8nWKQ3XHAqWg9ZBVx0hnomIhgngk.RqFnZgu0CkuVSf+yq5W2MO5AScqwOvgXZTDiLVjR0sXUklc5C2IlLAd8qWthEQD8NYiW0SbnXbkuQ61G8u2qC2nHhxXX0xWynuasPgNv02sq2eyABMudn+e6tm+qT7o1iopvYqliMVAG0iBeF3XwM1eo8ISmRBUUDrk8o+7mmqmQuUjon7qgcrRJTesOOKdB7QKgDH5bNgo2s.sxZnly95y5LvDBOxb3ugmBkA5yVEJCJUBcNgRwGBym+0eSviLR.NwMeNjC7cYvY2fxAeaa+d9Hngk9gvP8q+2BKlVMlc2.Le2FfYuM.yy2.L6uAXdwFf4fOIF8ZsuOSIhyGG.AiOwr.1x5DydOSWH5e.7rzg3I
-
@Natan said in Random! But Not You, Not You ( I mean Dotted and Triplets):
whats this doing in there?
for (i = 0; i < 6; i++)
try this:
const SyncValues = [0,2,5,8,11,14,17]; inline function onRandomizerControl(component, value) { if(!value) return; if (NoDT.getValue() == 0) { Tempo.setValue(Math.randInt(0, 18)); } if (NoDT.getValue() == 1) { Tempo.setValue(SyncValues[Math.randInt(0, SyncValues.length)]); } }; Content.getComponent("Randomizer").setControlCallback(onRandomizerControl);
and please start indenting your code...its really hard to read...
-
@Natan I love it when you talk to me like that.
-
@clevername27 God Bless Buddy
-
@Lindon Thanks a lot man, Actually I do Clean up after I Reach my Idea, and It was a dirty sketch
Cheers Mate