vibrato.h File Reference
#include <stdio.h>
#include "hs.h"
Include dependency graph for vibrato.h:

Go to the source code of this file.

Data Structures

struct  TVo
 

Functions

double QIE (double *y)
 
double QIE (double *y, double &x)
 
void DeFM (double *f2, double *f1, double *AA, int npfr, int *peakfr, int Fr, double &fct, int &fcount, double *&frs, double *&f, bool furthersmoothing=false)
 
void DeFM (double *f2, double *f1, double *AA, int npfr, double *lp, int Fr, double &fct, int &fcount, double *&frs, double *&f, bool furthersmoothing=false)
 
void DeAM (double *A2, double *A1, int npfr, int *peakfr, int Fr)
 
void DeAM (double *A2, double *A1, int npfr, double *lp, int Fr)
 
double S_F (int afres, double *LogAF, double *LogAS, int Fr, int M, atom **Partials, double *A0C, double *lp, int P, double F0Overall)
 
double S_F_SV (int afres, double *LogAF, double *LogAS, int Fr, int M, atom **Partials, double *A0C, double *lp, int P, double F=0.005, int FScaleMode=0, double theta=0.5, double sps=44100)
 
void AnalyzeV (THS &HS, TVo &V, double *&peaky, double *&cyclefrs, double *&cyclefs, double sps, double h, int *cyclefrcount=0, int SFMode=0, double SFF=0.01, int SFFScale=0, double SFtheta=0)
 
void RegularizeV (THS &HS, TVo &V, double sps, double h)
 
void SynthesizeV (THS *HS, TVo *V, double sps, int UseK=0)
 
TVoInterpolateV (double newP, double rate, TVo &V)
 
void FindPeaks (int *peakfr, int &npfr, double *F0, int Fr, double periodinframe, double *&peaky)
 
void FS_QR (int &K, double *FXR, double *data, int Fr, double period, double shift, double *FRES)
 
void RateAndReg (double &rate, double &regularity, double *data, int frst, int fren, int padrate, double sps, double offst)
 

Detailed Description

  • vibrato analysis and synthesis using harmonic sinusoids

Further reading: Wen X. and M. Sandler, "Analysis and synthesis of audio vibrato using harmonic sinusoids," in Proc. AES 124th Convention, Amsterdam, 2008.

Function Documentation

void AnalyzeV ( THS HS,
TVo V,
double *&  peaky,
double *&  cyclefrs,
double *&  cyclefs,
double  sps,
double  h,
int *  cyclefrcount,
int  SFMode,
double  SFF,
int  SFFScale,
double  SFtheta 
)

function AnalyzeV: calculates all basic and non-basic descriptors of a vibrato from a harmonic sinusoid

In: HS: harmonic sinusoid to compute vibrato representation from sps: sampling rate h: hop size SFMode: specifies source-filter estimation criterion, 0=FB (filter bank), 1=SV (slow variation) SFF: filter response sampling interval SFScale: set if filter sampling uses mel scale SFtheta: balancing factor of amplitude and frequency variations, needed for SV approach Out: V: a TVo object hosting vibrato descriptors (vibrato representation) of HS cyclefrcount: number of cycles between cycle boundaries, equals V.P-1. cyclefrs[cyclefrcount], cyclefs[cyclefrcount]: time (in frames) and F0 centroid of cycles. These are knots from which V.F0C[] is interpolated. peaky[V.P]: shape score of cycle peaks

No return value.

void DeAM ( double *  A2,
double *  A1,
int  npfr,
int *  peakfr,
int  Fr 
)

function DeAM: amplitude demodulation based on given segmentation into cycles

In: A1[Fr]: original amplitude peakfr[npfr]: cycle boundaries (literally, "frame indices of frequency modulation peaks") Out: A2[Fr]: demodulated amplitude

No return value.

void DeAM ( double *  A2,
double *  A1,
int  npfr,
double *  lp,
int  Fr 
)

function DeAM: wrapper function using floating-point cycle boundaries

In: A1[Fr]: original amplitude lp[npfr]: cycle boundaries Out: A2[Fr]: demodulated amplitude

No return value.

void DeFM ( double *  f2,
double *  f1,
double *  AA,
int  npfr,
int *  peakfr,
int  Fr,
double &  fct,
int &  fcount,
double *&  frs,
double *&  f,
bool  furthersmoothing 
)

function DeFM: frequency demodulation based on given segmentation into cycles

In: f1[Fr], AA[Fr]: original frequency and partial-independent amplitude peakfr[npfr]: cycle boundaries (literally, "frame indices of frequency modulation peaks") furthursmoothing: specifies if a second round demodulation is to be performed for more smooth carrier Out: f2[Fr]: demodulated frequency f[fcount], frs[fcount]: frequency and time (in frames) of carrier knots, optional fct: frequency centroid

No return value.

void DeFM ( double *  f2,
double *  f1,
double *  AA,
int  npfr,
double *  lp,
int  Fr,
double &  fct,
int &  fcount,
double *&  frs,
double *&  f,
bool  furthersmoothing 
)

function DeFM: wrapper function using floating-point cycle boundaries

In: f1[Fr], AA[Fr]: original frequency and partial-independent amplitude lp[npfr]: cycle boundaries furthursmoothing: specifies if a second round demodulation is to be performed for more smooth carrier Out: f2[Fr]: demodulated frequency f[fcount], frs[fcount]: frequency and time (in frames) of carrier knots, optional fct: frequency centroid

No return value.

void FindPeaks ( int *  peakfr,
int &  npfr,
double *  F0,
int  Fr,
double  periodinframe,
double *&  peaky 
)

function FindPeaks: find modulation peaks of signal F0[] roughly periodical at $periodinframe

In: F0[Fr]: modulated signal periodinframe: reference modulation period Out: npfr, peakfr[npfr]: modulation peaks peaky[npfr]: shape score for the peaks measuring their similarity to cosine peak, optional

No return value.

void FS_QR ( int &  K,
double *  FXR,
double *  data,
int  Fr,
double  period,
double  shift,
double *  FRES 
)

function FS_QR: Fourier series decomposition with QR orthogonalization. Since the Fourier series is applied on finite-length discrate signal, the Fourier components are no longer orthogonal to each other. A decreasing residue can be guaranteed by applying QR (or any other) orthogonalization process to the Fourier components before decomposition.

In: data[0:Fr]: signal to decompose period: period of Fourier series decomposition shift: amount of original shift of Fourier components (from 0 to -shift) K: number of Fourier components requested Out: K: number of Fourier components returned FXR[2K-1]: Fourier series coefficients, in the order of 0r, 1i, 1r, 2i, 2r, .... FRES[K]: decomposition residues, optional

No return value.

TVo* InterpolateV ( double  newP,
double  rate,
TVo V 
)

function InterpolateV: adjusts modulation rate to $rate times the current value. Since TVo is based on individual cycles, this operation involves finding new cycle boundaries and recomputing other single- cycle descriptors by interpolation. This is used for time stretching and cycle rate adjustment.

In: V: a TVo object to adjust newP: number of total cycles after adjustment. rate: amount of adjustment. Out: another TVo object with new cycle boundaries and single-cycle descriptors interpoated from V

Returns pointer to the output TVo. This function does not affect the content in V.

double QIE ( double *  y)

function QIE: computes extremum using quadratic interpolation

In: y[-1:1]: three points to interpolate from. It is assumed y[0] is larger (or smaller) than both y[-1] and y[1].

Returns the extremum of y.

double QIE ( double *  y,
double &  x 
)

function QIE: computes extremum using quadratic interpolation

In: y[-1:1]: three points to interpolate from. It is assumed y[0] is larger (or smaller) than both y[-1] and y[1]. Out: x: the argument value that yields extremum of y(x)

Returns the extremum of y.

void RateAndReg ( double &  rate,
double &  regularity,
double *  data,
int  frst,
int  fren,
int  padrate,
double  sps,
double  offst 
)

function RateAndReg: evaluates modulation rate and regularity

In: data[frst:fren]: modulated signal, time measured in frames padrate: padding rate used for inverse FFT sps: sampling frequency offst: hop size Out: rate, regularity: rate and regularity

No return value.

void RegularizeV ( THS HS,
TVo V,
double  sps,
double  h 
)

function RegularizeV: synthesize a regular vibrato from the basic descriptors.

In: V: a TVo object hosting vibrato descriptors sps: sampling rate h: hop size Out: HS: a harmonic sinusoid

No return value.

double S_F ( int  afres,
double *  LogAF,
double *  LogAS,
int  Fr,
int  M,
atom **  Partials,
double *  A0C,
double *  lp,
int  P,
double  F0Overall 
)

function S_F: original source-filter estimation used in AES124.

In: afres: filter response resolution Partials[M][Fr]: HS partials A0C[Fr]: partial-independent amplitude carrier lp[P]: cycle boundaries F0Overall: average fundamental frequency Out: LogAF[afres/2]: filter response LogAS[M]: source amplitudes

Returns 0.

double S_F_SV ( int  afres,
double *  LogAF,
double *  LogAS,
int  Fr,
int  M,
atom **  Partials,
double *  A0C,
double *  lp,
int  P,
double  F,
int  FScaleMode,
double  theta,
double  Fs 
)

function S_F_SV: slow-variation source-filter estimation used in AES126, adapted from TSF to TVo.

In: afres: filter response resolution Partials[M][Fr]: HS partials A0C[Fr]: partial-independent amplitude carrier lp[P]: cycle boundaries F: filter response sampling interval FScaleMode: set if filter sampling uses mel scale theta: balancing factor of amplitude and frequency variations, needed for SV approach Out: LogAF[afres/2]: filter response LogAS[M]: source amplitudes

Returns 0.

void SynthesizeV ( THS HS,
TVo V,
double  sps,
int  UseK 
)

function SynthesizeV: synthesizes a harmonic sinusoid from vibrato descriptors

In: V: a TVo object hosting vibrato descriptors sps: sampling rate UseK: maximal number of Fourier series components to use to construct frequency modulator Out: HS: a harmonic sinusoid

No return value.