Class ProcessAudio

  • All Implemented Interfaces:
    java.lang.Runnable

    public class ProcessAudio
    extends java.lang.Object
    implements java.lang.Runnable
    Perform real-time pitch shifting of audio signals. This only works for audio signals that have either a unique pitch or no pitch at any given time (pitched or unpitched, voiced or unvoiced). Examples include human vocal sounds and sounds from musical instruments capable of playing only one note at a times (e.g., horns, flute). The pitch shifting algorithm is based on the algorithm proposed by Keith Lent in his paper: "An efficient Method for Pitch Shifting Digitally Sampled Sounds", published in the Computer Music Journal, Vol 13, No. 4, Winter 1989. The algorithm is presented with more mathematical rigore in the paper by Robert Bristow-Johnson: "A Detailed Analysis of a Time-Domain Formant-Corrected Pitch- Shifting Algorithm", in J. Audio Eng. Soc., Vol 43, No. 5, May 1995.

    The pitch shifting algorithm uses a pitch-synchronous overlap-add (PSOLA) based algorithm, and therefore requires the pitch of the input signal. The pitch detector used in Keith Lent's algorithm consists of a bandpass filter followed by a simple negative-slop zero-crossing detector. I found such a simple pitch detector to be completely unusable for vocal and musical instrument sounds. I therefore decided to implement a more robust pitch detector. I am currently using a pitch detector that uses cepstrum analysis. The (real) cepstrum is computed, and then peak finding is performed on the high-time region of the cepstrum. This cepstral technique works well for vocal sounds but does not currently perform well for pitches above about 600 Hz.

    Note: This application requires JDK 1.3. and at least a Pentium II 400 MHz class processor (for 22050 Hz sample rate).

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Brian K. Vogel
    Pt.AcceptedRating:
    Red (vogel)
    Pt.ProposedRating:
    Red (vogel)
    • Constructor Detail

      • ProcessAudio

        public ProcessAudio()
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • updatePitchScaleFactor

        public void updatePitchScaleFactor​(double pitchScaleIn)
      • setSamplingRate

        public void setSamplingRate​(double sr)
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable