yin.c File Reference

Implementation of pitch extraction. More...

`#include "sphinxbase/prim_type.h"`
`#include "sphinxbase/ckd_alloc.h"`
`#include "sphinxbase/fixpoint.h"`
`#include "sphinxbase/yin.h"`
`#include <stdio.h>`
`#include <string.h>`

Go to the source code of this file.

## Data Structures

struct | yin_s

## Functions

yin_t * | yin_init (int frame_size, float search_threshold, float search_range, int smooth_window)
| Initialize moving-window pitch estimation.
void | yin_free (yin_t *pe)
| Free a moving-window pitch estimator.
void | yin_start (yin_t *pe)
| Start processing an utterance.
void | yin_end (yin_t *pe)
| Mark the end of an utterance.
int | thresholded_search (int32 *diff_window, fixed32 threshold, int start, int end)
void | yin_write (yin_t *pe, int16 const *frame)
| Feed a frame of data to the pitch estimator.
int | yin_read (yin_t *pe, uint16 *out_period, uint16 *out_bestdiff)
| Read a raw estimated pitch value from the pitch estimator.

## Detailed Description

Implementation of pitch extraction.

Author
  David Huggins-Daines dhugg.nosp@m.ins@.nosp@m.cs.cm.nosp@m.u.ed.nosp@m.u

Definition in file yin.c.

## Function Documentation

## thresholded_search()

int thresholded_search | ( | int32 * | diff_window,
|  | fixed32 | threshold,
|  | int | start,
|  | int | end )

Definition at line 172 of file yin.c.

## yin_end()

void yin_end | ( | yin_t * | pe | ) |

Mark the end of an utterance.

Definition at line 166 of file yin.c.

References yin_s::endut.

## yin_free()

void yin_free | ( | yin_t * | pe | ) |

Free a moving-window pitch estimator.

Definition at line 150 of file yin.c.

References ckd_free(), ckd_free_2d(), yin_s::diff_window, and yin_s::period_window.

## yin_init()

yin_t * yin_init | ( | int | frame_size,
|  | float | search_threshold,
|  | float | search_range,
|  | int | smooth_window )

Initialize moving-window pitch estimation.

Definition at line 131 of file yin.c.

References ckd_calloc, ckd_calloc_2d, yin_s::diff_window, yin_s::period_window, yin_s::search_range, yin_s::search_threshold, and yin_s::wsize.

## yin_read()

int yin_read | ( | yin_t * | pe,
|  | uint16 * | out_period,
|  | uint16 * | out_bestdiff )

Read a raw estimated pitch value from the pitch estimator.

Parameters

  pe | Pitch estimator.
  out_period | Output: an estimate of the period (not the pitch) of the signal in samples.
  out_bestdiff | Output: the minimum normalized difference value associated with `*out_pitch`, in Q15 format (i.e. scaled by 32768). This can be interpreted as one minus the probability of voicing.

Returns
  Non-zero if enough data was avaliable to return a pitch estimate, zero otherwise.

Definition at line 222 of file yin.c.

References yin_s::diff_window, yin_s::endut, yin_s::nfr, yin_s::period_window, yin_s::search_range, yin_s::search_threshold, yin_s::wcur, yin_s::wsize, and yin_s::wstart.

## yin_start()

void yin_start | ( | yin_t * | pe | ) |

Start processing an utterance.

Definition at line 158 of file yin.c.

References yin_s::endut, yin_s::nfr, and yin_s::wstart.

## yin_write()

void yin_write | ( | yin_t * | pe,
|  | int16 const * | frame )

Feed a frame of data to the pitch estimator.

Parameters

  pe | Pitch estimator.
  frame | Frame of `frame_size` (see yin_init()) samples of audio data.

Definition at line 195 of file yin.c.

References yin_s::diff_window, yin_s::nfr, yin_s::period_window, yin_s::search_threshold, yin_s::wsize, and yin_s::wstart.