Class: Yin

Yin

Yin fundamental frequency estimator, based on algorithm described in YIN, a fundamental frequency estimator for speech and music by Cheveigne and Kawahara. On each frame, this operator propagate a vector containing the following values: frequency, probability.

For good results the input frame size should be large (1024 or 2048).

support standalone usage

Constructor

new Yin(options)

Parameters:
Name Type Description
options Object

Override default parameters.

Properties
Name Type Attributes Default Description
threshold Number <optional>
0.1

Absolute threshold to test the normalized difference (see paper for more informations).

downSamplingExp Number <optional>
2

Down sample the input frame by a factor of 2 at the power of downSamplingExp (min=0 and max=3) for performance improvements.

minFreq Number <optional>
60

Minimum frequency the operator can search for. This parameter defines the size of the autocorrelation performed on the signal, the input frame size should be around 2 time this size for good results (i.e. inputFrameSize ≈ 2 * (samplingRate / minFreq)).

Source:
Example
import * as lfo from 'waves-lfo/client';

// assuming some AudioBuffer
const source = new lfo.source.AudioInBuffer({
  audioBuffer: audioBuffer,
});

const slicer = new lfo.operator.Slicer({
  frameSize: 2048,
});

const yin = new lfo.operator.Yin();
const logger = new lfo.sink.Logger({ data: true });

source.connect(slicer);
slicer.connect(yin);
yin.connect(logger);

source.start();

Methods

inputSignal(input) → {Array}

Use the Yin operator in standalone mode (i.e. outside of a graph).

Parameters:
Name Type Description
input Array | Float32Array

The signal fragment to process.

Source:
Returns:
  • Array containing the frequency, energy, periodicity and AC1
Type
Array
Example
import * as lfo from 'waves-lfo/client';

const yin = new lfo.operator.Yin();
yin.initStream({
  frameSize: 2048,
  frameType: 'signal',
  sourceSampleRate: 44100
});

const results = yin.inputSignal(signal);