Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java Pitch Detection and Replacement?

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Thanked 0 Times in 0 Posts

    Default 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.

  2. #2
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Tavistock, UK
    Thanked 103 Times in 93 Posts

    Default 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!

Similar Threads

  1. Canny Edge Detection
    By tiny in forum Object Oriented Programming
    Replies: 1
    Last Post: March 6th, 2012, 01:54 PM
  2. replacement substring
    By dcshoecousa in forum What's Wrong With My Code?
    Replies: 7
    Last Post: March 9th, 2011, 04:28 PM
  3. String replacement
    By codethrupain in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 28th, 2011, 11:10 PM
  4. 2D Collision Detection
    By Cuju in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 3rd, 2010, 10:39 AM
  5. Page Replacement Algorithms
    By smokeyjoey in forum Algorithms & Recursion
    Replies: 2
    Last Post: December 7th, 2009, 10:38 PM

Tags for this Thread