MyNixOS website logo
Description

Retime and Analyse Speech Signals.

Retime speech signals with a native Waveform Similarity Overlap-Add (WSOLA) implementation translated from the 'TSM toolbox' by Driedger & Müller (2014) <https://www.audiolabs-erlangen.de/content/resources/MIR/TSMtoolbox/2014_DriedgerMueller_TSM-Toolbox_DAFX.pdf>. Design retimings and pitch (f0) transformations with tidy data and apply them via 'Praat' interface. Produce spectrograms, spectra, and amplitude envelopes. Includes implementation of vocalic speech envelope analysis (fft_spectrum) technique and example data (mm1) from Tilsen, S., & Johnson, K. (2008) <doi:10.1121/1.2947626>.

retimer

The retimer package provides tools for retiming and analysis of speech.

Installation

You can install the development version of retimer from GitHub:

remotes::install_github("abeith/retimer")

Usage

WSOLA

The WSOLA (Wave Similarity Overlap-Add) algorithm for performing retimings is implemented as a native R function.

For example, to create a random retiming of the included mm1 Wave object:


library(retimer)

## Load example data
data(mm1)

## Find the length (in samples) of the object
dur <- length(mm1@left)

## Set the number of anchors to use
n <- 10

## Sample some random interval durations
x <- runif(n)

## Make a list of input output anchors
anchors <- list(anc_in = c(0, dur*seq_len(n)/n),
                anc_out = c(0, dur*cumsum(x)/sum(x)))

## Run the retiming
sig <- wsola(mm1@left, anchors)

## Create a new Wave object with the retimed signal
wav <- tuneR::Wave(sig, samp.rate = [email protected], bit = mm1@bit)

## Listen to the retimed audio
tuneR::play(wav, 'play')

Praat OLA

The praatRetime function is used to perform a retiming in Praat with the overlap-add method. To use this function and other Praat functions in the retimer package, you must have Praat installed and available in your PATH. Running the praatSys function with no arguments should output the Version number of your Praat installation.


praatSys()

To create a similar retiming to the above wsola example, it is necessary to create a nested tibble that can be converted to a TextGrid with the first tier indicating the existing timing and the second tier indicating the desired timing.


library(retimer)
library(tidyverse)

## Load example data
data(mm1)

## Find the length (in seconds) of the object
dur <- length(mm1)/[email protected]

## Set the number of anchors to use
x <- runif(10)

## Define the ends of the intervals for the output tier
t2_out <- dur*cumsum(x)/sum(x)
## Define the starts of the intervals for the output tier
t1_out <- c(0, t2_out[-length(t2_out)])
## Define the ends of the intervals for the input tier
t2_in <- dur*seq_len(10)/10
## Define the starts of the intervals for the input tier
t1_in <- c(0, t2_in[-length(t2_in)])

## Create a TextGrid tibble
tg <- tibble(
    name = rep(c("old", "new"), each = 10),
    type = "interval",
    t1 = c(t1_in, t1_out),
    t2 = c(t2_in, t2_out),
    label = rep(letters[1:10], times = 2)) |>
    nest(data = c(t1, t2, label))

## Run the retiming
wav_retimed <- praatRetime(mm1, tg)

## Listen to the retimed audio
tuneR::play(wav_retimed, 'play')
Metadata

Version

0.1.3

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows