Skip to contents

Robust Epoch And Pitch EstimatoR (REAPER) algorithm (Talkin 2019) uses an EpochTracker class to simultaneously estimate the location of voiced-speech "epochs" or glottal closure instants (GCI), voicing state (voiced or unvoiced) and fundamental frequency (F0 or "pitch"). The local (instantaneous) f0 is defined as the inverse of the time between successive GCI. This function returns the f0 and normalized CGI cross-correlation in each windowed windowShift (ms) portion of the signal.

Usage

reaper(
  listOfFiles,
  beginTime = 0,
  endTime = 0,
  windowShift = 5,
  minF = 40,
  maxF = 500,
  unvoiced_cost = 0.9,
  high.pass = TRUE,
  hilbert.transform = FALSE,
  explicitExt = "rp0",
  outputDirectory = NULL,
  toFile = TRUE,
  conda.env = NULL
)

Arguments

listOfFiles

A vector of file paths to wav files.

beginTime

The start time of the section of the sound file that should be processed.

endTime

The end time of the section of the sound file that should be processed.

windowShift

The measurement interval (frame duration), in seconds.

minF

Candidate f0 frequencies below this frequency will not be considered.

maxF

Candidates above this frequency will be ignored.

unvoiced_cost

Set the cost for unvoiced segments. Default is 0.9, the higher the value the more f0 estimates in noise.

high.pass

Perform high-pass filtering to remove DC and low-frequency noise?

hilbert.transform

Remove phase distortion using Hilbert transform?

explicitExt

the file extension that should be used.

outputDirectory

set an explicit directory for where the signal file will be written. If not defined, the file will be written to the same directory as the sound file.

toFile

write the output to a file? The file will be written in outputDirectory, if defined, or in the same directory as the soundfile.

conda.env

The name of the conda environment in which Python and its required packages are stored. Please make sure that you know what you are doing if you change this. Defaults to NULL, which means that the default enviroment or the environment set in the RETICULATE_PYTHON environment variable will be used.

Value

An SSFF track object containing two tracks (f0 and corr) that are either returned (toFile == FALSE) or stored on disk.

Details

DC bias and low-frequency noise are removed by high-pass filtering, and the signal is converted to floating point. If the input is known to have phase distortion that is impacting tracker performance, a Hilbert transform, optionally done at this point, may improve performance.

The function uses the python library pyreaper combined with the R package reticulate to compute the tracks, and the user therefore has to make sure that pyreaper and python is available on the machine. It is recommended to set up an anaconda ("conda") environment for the superassp library, like this:

conda create conda create --prefix -n pysuperassp python=3.8 
conda activate pysuperassp 
pip install librosa
pip install pyreaper 
#Not used by
this function but by other functions in this package 
pip install pysptk 

References

Talkin D (2019). “REAPER: Robust epoch and pitch estimator.” https://github.com/google/REAPER.