I'm trying to create a basic arpeggiator which will randomly generate a tone every 250ms, from one of four octaves of specified notes.
I've managed to get as far as randomly generating any note in that range (with a random 48), but what I'd like to do is allow the user to turn on and off each note (i.e. they could turn on C, E, and G), and have the patch ONLY generate the notes which match C, E, and G.
So, for example, if the user has selected to hear C, E, and G, the [random] object would generate from 0, 1, 2, 3 (for the four octaves of C), leave out 4, 5, 6, 7 (C#), and 8, 9, 10, 11, 12, 13, 14, 15 (D and D#), but include 16, 17, 18, 19, for the four octaves of E.
Obviously, if the [random] object picks a value in what's excluded, it will just not change the value for that 250ms interval.. I'd like it to always select a valid value. The entire process is confusing me somewhat, and hopefully somebody could either suggest a better way to do this, or help figure out this way!