I need help for this program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need help for this program

I want to build an algorithm that generates random (music) scales based on the fact that we have 12 semitones and only 2 possible steps (semitone, wholetone). I thought I should create a list with a variable number of indexes, the sum of them has to be 12 everytime and the only acceptable values are 1 and 2 (semitone, wholetone). However I can't figure out how to translate this logic into java code, anyone can help?

12th Apr 2018, 6:08 PM
Alfred C
Alfred C - avatar
3 Answers
+ 1
I don't understand your logic: 1) Distances between successive notes can be any length 2) Why would the sum of indexes equal 12?
12th Apr 2018, 7:31 PM
Emma
+ 1
I'll explain myself better: Im not talking about generating a "solo" of notes, I'm talking about creating the structure of a scale, lets take the typical diatonic major scale structure (x=root note, T=whole step, t=half step): x-T-T-t-T-T-T-t now lets assign T as 2, and t as 1... is it clear now? Another example: the Debussy scale, only composed by whole steps, that'd be: 2-2-2-2-2-2 This algorithm could supppsedly generate any diatonic or modal scale plus the artificial ones, like the Debussy's or the chromatic which is only made of half steps.
12th Apr 2018, 7:46 PM
Alfred C
Alfred C - avatar
+ 1
Right, that does make sense now! I'll look into this. Maybe someone else will beat me to it though.
12th Apr 2018, 7:48 PM
Emma