Beispiel #1
0
 /**
  * Create a new pitch detector for a stream with the defined sample rate.
  * Processes the audio in blocks of the defined size.
  *
  * @param audioSampleRate
  *            The sample rate of the audio stream. E.g. 44.1 kHz.
  * @param bufferSize
  *            The size of a buffer. E.g. 1024.
  * @param yinThreshold
  *            The parameter that defines which peaks are kept as possible
  *            pitch candidates. See the YIN paper for more details.
  */
 public FastYin(float audioSampleRate, int bufferSize, double yinThreshold)
 {
     this.sampleRate = audioSampleRate;
     this.threshold  = yinThreshold;
     yinBuffer       = new float[bufferSize / 2];
     //Initializations for FFT difference step
     audioBufferFFT = new float[2 * bufferSize];
     kernel         = new float[2 * bufferSize];
     yinStyleACF    = new float[2 * bufferSize];
     fft            = new FloatFFT(bufferSize);
     result         = new PitchDetectionResult();
 }
Beispiel #2
0
 public DetectedPitchInfo(Note note, double noteError, PitchDetectionResult pitch)
 {
     Note        = note;
     NoteError   = noteError;
     PitchResult = pitch;
 }
Beispiel #3
0
 /**
  * A copy constructor. Since PitchDetectionResult objects are reused for performance reasons, creating a copy can be practical.
  * @param other
  */
 public PitchDetectionResult(PitchDetectionResult other)
 {
     this.pitch       = other.pitch;
     this.probability = other.probability;
     this.pitched     = other.pitched;
 }