Пример #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.
  */
 public Yin(float audioSampleRate,  int bufferSize)
 {
     this.sampleRate = audioSampleRate;
     this.threshold = DEFAULT_THRESHOLD;
     yinBuffer = new float[bufferSize / 2];
     result = new PitchDetectionResult();
 }
Пример #2
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 Yin(float audioSampleRate, int bufferSize, double yinThreshold)
 {
     this.sampleRate = audioSampleRate;
     this.threshold  = yinThreshold;
     yinBuffer       = new float[bufferSize / 2];
     result          = new PitchDetectionResult();
 }
Пример #3
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.
  */
 public Yin(float audioSampleRate, int bufferSize)
 {
     this.sampleRate = audioSampleRate;
     this.threshold  = DEFAULT_THRESHOLD;
     yinBuffer       = new float[bufferSize / 2];
     result          = new PitchDetectionResult();
 }
Пример #4
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 Yin( float audioSampleRate,  int bufferSize,  double yinThreshold)
 {
     this.sampleRate = audioSampleRate;
     this.threshold = yinThreshold;
     yinBuffer = new float[bufferSize / 2];
     result = new PitchDetectionResult();
 }
Пример #5
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;
 }
 /**
  * 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;
 }