Sound Frequency related to Mouse Height
in
Programming Questions
•
5 months ago
Hellow!
I want to make a very easy sound programm but as a newbie there's nothing easy in its beginnings ;)
Idea_ The higher the mouse the higher the frequency. I tried following but I got this error message:
"the local variable freq may not have bee initialised".
Probably there's something wring with the order?
I want to make a very easy sound programm but as a newbie there's nothing easy in its beginnings ;)
Idea_ The higher the mouse the higher the frequency. I tried following but I got this error message:
"the local variable freq may not have bee initialised".
Probably there's something wring with the order?
- float c = 261.63;
- float cs = 277.18;
- float[] notas = {c, cs,};
- void mouseMoved() {
- int c = 262;
- int cs = 277;
- float freq;
- if (mouseY<c) {
- freq = notas [1]; }
- if (mouseY<cs) {
- freq = notas [2]; }
- sine.setFreq(freq);
- }
1