Navigation
API > API/Plugins > API/Plugins/AudioSynesthesiaCore
Pitch detector based on the YIN algorithm (de Cheveigné & Kawahara, 2002).
YIN computes a cumulative mean normalized difference function (CMND) over each analysis window and finds the first lag below a voiced/unvoiced threshold. Compared to plain autocorrelation (FAutoCorrelationPitchDetector), YIN strongly suppresses sub-harmonic octave errors and provides a natural voiced/unvoiced decision via the threshold.
Strength is reported as (1 - CMND(τ)), where τ is the chosen lag. A value near 1.0 indicates high periodicity; values near 0.0 indicate noise or an unvoiced frame.
Only one pitch is emitted per analysis window (the fundamental), making this suitable for monophonic sources such as a singing voice in a karaoke context.
| Name | FYINPitchDetector |
| Type | class |
| Header File | /Engine/Plugins/Runtime/AudioSynesthesia/Source/AudioSynesthesiaCore/Public/YINPitchDetector.h |
| Include Path | #include "YINPitchDetector.h" |
Syntax
class FYINPitchDetector : public Audio::IPitchDetector
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FYINPitchDetector
(
const FYINPitchDetectorSettings& InSettings, |
Create a YIN pitch detector with the given settings and sample rate. | YINPitchDetector.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FYINPitchDetector() |
YINPitchDetector.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AutoCorrBuffer | FAlignedFloatBuffer | Cross-correlation output buffer. Positive lags r(τ) are in [0..HalfWindowNumSamples]. | YINPitchDetector.h | |
| Correlator | TUniquePtr< FBlockCorrelator > | FFT-based cross-correlator. Input size = WindowNumSamples, no window, no normalization. | YINPitchDetector.h | |
| DiffBuffer | TArray< float > | Difference function buffer d(τ), length == HalfWindowNumSamples + 1. | YINPitchDetector.h | |
| FirstHalfBuffer | FAlignedFloatBuffer | First half of the analysis window zero-padded to WindowNumSamples, reused each frame. | YINPitchDetector.h | |
| HalfWindowNumSamples | int32 | YINPitchDetector.h | ||
| MaxLagBin | int32 | YINPitchDetector.h | ||
| MinLagBin | int32 | YINPitchDetector.h | ||
| SampleRate | float | YINPitchDetector.h | ||
| Settings | FYINPitchDetectorSettings | YINPitchDetector.h | ||
| SlidingBuffer | TSlidingBuffer< float > | YINPitchDetector.h | ||
| WindowBuffer | FAlignedFloatBuffer | YINPitchDetector.h | ||
| WindowCounter | int64 | YINPitchDetector.h | ||
| WindowNumSamples | int32 | YINPitchDetector.h |
Functions
Public
Public Virtual
Overridden from IPitchDetector
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void DetectPitches
(
const FAlignedFloatBuffer& InMonoAudio, |
Detect pitches in the audio. May be called repeatedly with consecutive buffers. | YINPitchDetector.h | |
virtual void Finalize
(
TArray< FPitchInfo >& OutPitches |
Resets internal buffers. No additional pitches are emitted on Finalize. | YINPitchDetector.h |