(n00b) multiple ifs, general programming mishaps, and learning to program

PaulS:
I don't understand this bit:

  int LDRVal = analogRead(LDR);

int musicValue = LDRVal % 10;



Suppose that there are minor changes in the light level, and on three successive iterations of loop, LDRVal is 349, 351, and 348. The values in musicValue will be 9, 1, and 8. I don't see any good correlation between the tone played and the level of light.

I suspect that the modulo function is not what you want to be using. I suspect that you want to divide the range of the sensor output into 10 parts, and play different tones as the light level changes significantly, not as it jitters.

My intention was not to have the analog input be used as a whole; more as a random number generator.

the last number of the value will be one of 10 options, regardless of how bright or dark it may be; it will still only be using those 10 values.

Also, its simply a different way of doing it; i haven't seen someone use the analog data like that yet, so I figured it may yield interesting patterns without being a garbled mess like some simpler opto-theremins using LDRs turn out to be. Experiment!