Arp plays in key?
-
@MikeB said in Arp plays in key?:
How do I get my random function for the arp to randomise only within allowed notes?
Based on the above answers I don't think it's possible without modifying the built in arp.
-
@d-healey
Sir David - so you mean that it is not possible to tell a slider in a sliderpack to randomise only between the values -10 ,-8, -7, -5 ,-3 -2, 0, 2, 3, 5, 7, 8, 10 for example?
...and that 5 hours before the turn of the year :-) -
@MikeB Ah that's different, I thought you wanted the arp to do something it wasn't meant to. What you want to do is within your GUI script, correct? You can use the
Math.random
orMath.randInt
function to generate a random number which you assign to your slider pack slider. -
//Random Note Button----------------------------------------------------------------------- inline function onbtnRandomNote_S1Control(component, value) { if(value) { for (i = 0; i < 16; i++){ local r = Math.randInt(-12, 12); myPads_S1[i].setValue(r); SliderPack1_S1.setSliderAtIndex(i, r); } } }; Content.getComponent("btnRandomNote_S1").setControlCallback(onbtnRandomNote_S1Control); //----------------------------------------------------------------------------------
I already have that - but with Math.random and/or Math.randInt, only between whole numbers are selected, for example between -12 and 12 - in this case, however, certain numbers within -12 / 12 are not to be selected (because they do not occur in the selected key, for example 5).
So I need a random function that only selects between the numbers 1 2 3 4 6 7 8 9 10 11 12 and leaves out 5. As an example.
-
@MikeB Make an array that has the numbers you want. Use the random function to generate an index that you can use to get the value of an element in the array.
-
@d-healey Do you have a small example that I can look at and understand?
-
const valuesIWant = [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12]; Console.print(valuesIWant[Math.randInt(0, valuesIWant.length)]);
-
@d-healey
Super thanks Sir David. I got it - now even better with your example.I thank you for your great support this year and wish you a happy and successful new year.
-
@MikeB You're most welcome. Happy New Year!
-
@Lindon said in Arp plays in key?:
Write your own Arp.
It was easier in this case - Happy and prosperous New Year to you.
-
@Christoph-Hart
Thanks to David, I found an easier solution. A happy and successful new year to you.After two years of peace and quiet here in Berlin, we'll have a lot of noise in front of the house again in a few hours. :-)
-
@d-healey just trying this - the console prints correct values but the sliderpack continues to set random values, rather than values in the specified array. Am I doing something stupid?!
HiseSnippet 1225.3ocsW8+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8.s7eUQ2WQ2USu4QZOTOFyZftVLPeYBPgZiyE6ItVCSKyo0S2FinZneqcSELg2TkD+PNYDMTxTodilzqfMEhesWdylznKkhQvoMq1CY7zGQJ55YG8eeZsIo3nYsOy7jCQFlF0LPngT1ECkJp+ADFPRMCscMXqmQ8X+Ic58XJRdRLRdQBR1arTJ3ZT7LyYM.Yv.52yhAVMJm.0UpsJNfRB4pWdGQth1l2MjBcUJ5Ebb2WJO87vgyed5.yDbJPHoAQpkchAokdDpU+V85aAalcmMPfceDdi8Ix4WHRs4Wh.nSatsPTaZviXxIY2L7QrkT4ktkzCEhuxrKS5NbwXL2BvnpY7q.FS1s74lsFLf5JSA35l6+wUcQx643OVLVx3W.uVHjot26LNnGrRsKENcNm5GopExolCESWVQqx.8nbOMw+AOIBcTzFIBclJDZUbCEexMdnfZ60mp4.XhqWVOO7eM.z3YCqLMKaWFE.k7ex0UE9u0AgVrMUVAa1bEro5JXy6WAa1ZEr4CqfMauTaTSapOVJBhaG.FcaoGHaXzRONRWEh9esZ6tKA
EDIT: Actually the console values are random even with the test array which is just a bunch of '2's
-
the sliderpack continues to set random values
That's because you are setting random values... what size t-shirt do you want?
SliderPack1.setSliderAtIndex(i, Math.randInt(0, minor.length));
-
@d-healey XXXL please
-
@d-healey What would be the right approach here?
-
@MikeB To what?
-
@d-healey So that DanH's snippet above works!
-
@MikeB It does work, it does exactly what he told it to do.
-
@d-healey You already said that above.
But it should do the following.Randomise the random area of the slider pack or the individual sliders exactly between the values defined in an array.
So if the array contains [0, 2, 3, 5, 7, 8, 10, 12 ], no slider in the slider pack may have the value 4 or 6 or 9 etc. when the Random button is clicked.
Instead, only a random within the defined values.
This way you can make the Arp randomise within a defined key.
-
But it should do the following.
He isn't pulling values from the array he's just assigning random values.