Java Pitch Detection and Replacement?
In Java, I'm trying to find a way to get it to detect all of the pitches in one soundfile containing only sound from one instrument. I'm thinking about FFT for that, but any suggestions are appreciated. I just want to make sure I'm using the right method before starting so that I won't have to start over again later.
After it has detected the pitches, it will replace the sound in the file with sound from other instruments of the same pitch. For example, if I played a tune that went "A, C, D, G#, A, B", it would detect those notes (as certain pitches would be tied to certain notes) and then replace the sound with sound from other files, each containing an individual note such as A, C, or Gb. In this way, I could (albeit sloppily) convert a tune from one instrument to that same tune played by a different instrument without actually playing it, but by replacing detected pitches with different individual sound files containing one pitch each.
I know this is complicated, but any help on how to do either of these things (detect pitch or replace sound) would be greatly appreciated.
Re: Java Pitch Detection and Replacement?
I suspect you may be better off asking on a music, comms or engineering forum. It sounds hard to get right (though perhaps not difficult to get something that works as a prototype) to me. A quick search turns up page upon page of people saying "it's hard":
audio - Note onset detection - Stack Overflow
java - Graphing the pitch (frequency) of a sound - Stack Overflow
FFT is what - as far as I know - everybody uses for this. There could be a magical other option, but if you're on new programming ground I would go with 'the way everybody does it': there'll be more examples and more help available. Good luck!