This week's book giveaway is in the Open Source forum.
We're giving away four copies of Programmers Guide to Apache Thrift and have Randy Abernethy on-line!
See this thread for details.
Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

java midi synthesizing  RSS feed

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thank you
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!