Skip to contents

This function takes a sound file and computes f$_0$ and an estimate of pitch using the Sawtooth Waveform Inspired Pitch Estimator (SWIPE) algorithm (Camacho and Harris 2008) .

Usage

swipe(
  listOfFiles,
  beginTime = 0,
  endTime = 0,
  windowShift = 5,
  minF = 70,
  maxF = 200,
  voicing.threshold = 0.3,
  explicitExt = "swi",
  outputDirectory = NULL,
  toFile = TRUE
)

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.

voicing.threshold

Voice/unvoiced threshold. Default is 0.3.

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 pitch) that are either returned (toFile == FALSE) or stored on disk.

Details

The implementation of SWIPE in the Speech Signal Processing Toolkit (SPTK) (Group and others 2017) is used, and called via its Python interface and the retiulate R package to compute the signal track. Therefore, the user will have to make sure that a python environment is present and can be attached by the reticulate. An anaconda environment is recommended, and can set up by the user by a setup procedure that involve at least these commands:

conda create conda create --prefix -n pysuperassp python=3.8 
conda activate pysuperassp
pip install librosa
pip install pysptk

to make the functionality that this function requires available.

References

Camacho A, Harris JG (2008). “A sawtooth waveform inspired pitch estimator for speech and music.” The Journal of the Acoustical Society of America, 124(3), 1638--1652. ISSN 0001-4966, doi:10.1121/1.2951592 , http://www.ncbi.nlm.nih.gov/pubmed/19045655.

Group SW, others (2017). “Speech Signal Processing Toolkit (SPTK), 2017.” http://sp-tk.sourceforge. net.