Hello I'm trying to make java play predefined notes, and it does so but the notes do not sound right at all and I'm not sure what is causing it.
This is how I initialize my program
I use threads to play multiple notes at once on the same channel which is created through playNote() function but in essence this is what I do to play a single note
So far I've assumed that note number 60 corresponds to middle C on a piano, 61 to C-sharp, 62 to D and so on, I am perfectly aware that this could be a wrong assumption.
Now I've tried changing the instrument number above and the channel, I get different sounds but the music always sounds like it's played in the wrong key, so I'm hoping that someone can give me some pointers here how to map notes from java default synthesizer to the keys on a real keyboard and if there is a better way to accomplish this.
posted 8 years ago
I found out what was causing the false music, I assumed that each notenumber is an increment of 2 i.e C=60 B=62 and so on but failed to take into account the missing half notes in each octave :P