Package {rhythm.metrics}


Title: Analyse and Visualise Speech Rhythm and Timing Metrics
Version: 1.1.0
Description: Calculates and visualises speech rhythm and timing metrics. The 'rhythm.metrics' package provides a standardised workflow to compute common metrics including Delta C, Delta V, VarcoC, VarcoV, the percentage of vocalic intervals (%V), and both raw and normalised Pairwise Variability Indices (rPVI, nPVI). It includes functions for calculating and visualising these measures to facilitate cross-linguistic and developmental rhythm research. Delta C, Delta V, and %V measures are based on Ramus et al. (1999) <doi:10.1016/S0010-0277(99)00058-X>; VarcoC and VarcoV measures are based on Dellwo (2006, ISBN: 9783631554777); and rPVI-C and nPVI-V are based on Grabe & Low (2002) <doi:10.1515/9783110197105.2.515>.
License: GPL (≥ 3)
Depends: R (≥ 4.5.0)
Imports: dplyr, ggplot2, ggsci, magrittr, rlang
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Encoding: UTF-8
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-08-22 12:00:38 UTC; Cong
Author: Cong Zhang ORCID iD [aut, cre]
Maintainer: Cong Zhang <cong.zhang@newcastle.ac.uk>
Repository: CRAN
Date/Publication: 2026-09-02 11:50:02 UTC

Delta C & Delta V

Description

This function loads a dataframe as input and returns a dataframe containing the mean values and mean standard deviations of Delta C and Delta V.

Usage

delta_cv(df, cv_label, utterance_id, cv_duration)

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

the column name for whether a segment is a C(onsonant) or a V(owel)

utterance_id

the column name where each unique utterance has a unique id

cv_duration

the column name for the duration of C or V

Details

Delta C and Delta V are rhythm metrics based on Ramus, F., Nespor, M., & Mehler, J. (1999). Correlates of linguistic rhythm in the speech signal. Cognition, 73(3), 265-292.

⁠Delta C: SD of total C duration⁠ ⁠Delta V: SD of total V duration⁠

Value

a data frame containing the results of Delta C and Delta V values

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(cv_label  = c("c", "v", "c", "v","c", "v", "c", "v"),
                      utterance_id = c("utt_1", "utt_1", "utt_2", "utt_2",
                                       "utt_1", "utt_1", "utt_2", "utt_2"),
                      cv_duration = c(0.1, 0.8, 0.2, 0.5, 0.3, 0.3, 0.4, 0.7))

delta_cv(df_test, cv_label, utterance_id, cv_duration)


nPVI V

Description

This function loads a dataframe as input and returns a dataframe containing the mean values of nPVI of vowels.

Usage

npvi_v(df, cv_label, label_name, utterance_id, cv_duration)

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

column name for the segment labels (e.g., cv_label).

label_name

a string to filter the vowels, e.g. label_name = 'vowel'.

utterance_id

column name for unique utterance IDs.

cv_duration

column name for the duration of C or V.

Value

a data frame containing the mean nPVI for vowels.

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(cv_label = rep(c("consonant", "vowel"), 8),
                      utterance_id = rep(c("utt_1", "utt_2", "utt_3", "utt_4"), each = 4),
                      cv_duration = c(0.1, 0.8, 0.2, 0.5, 0.3, 0.3, 0.4, 0.7,
                                       0.3, 0.88, 0.5, 0.9, 0.3, 0.57, 0.4, 0.97))

npvi_v(df_test, cv_label = cv_label, label_name = "vowel",
       utterance_id = utterance_id, cv_duration = cv_duration)


Percentage V

Description

This function loads a dataframe as input and returns a dataframe containing the mean values and mean standard deviations of %V.

Usage

percentage_v(df, v_label, utterance_id, cv_duration, utterance_duration)

Arguments

df

a data frame containing cv_labels, utterance_id, cv_duration, and utterance_duration values.

v_label

a string to filter the vowels, e.g. v_label = 'vowel'

utterance_id

column name for unique utterance IDs

cv_duration

column name for the duration of C or V

utterance_duration

column name for the duration of entire utterances

Details

%V is a rhythm metrics based on Ramus, F., Nespor, M., & Mehler, J. (1999). Correlates of linguistic rhythm in the speech signal. Cognition, 73(3), 265-292. It calculates the percentage of an utterance occupied by vocalic material.

⁠%V: (total V duration / total utterance duration) * 100⁠

Value

a data frame containing the mean values and standard deviation of %V

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(cv_label = c("consonant", "vowel", "consonant", "vowel"),
                      utterance_id = c("utt_1", "utt_1", "utt_2", "utt_2"),
                      cv_duration = c(0.1, 0.8, 0.2, 0.5),
                      utterance_duration = c(2.4, 2.4, 2.7, 2.7))

percentage_v(df_test, v_label="vowel", utterance_id, cv_duration, utterance_duration)


Plot Delta C & Delta V

Description

This function loads a dataframe as input and returns a box plot for Delta C and Delta V values.

Usage

plot_delta_cv(
  df,
  cv_label,
  utterance_id,
  cv_duration,
  save_fig = FALSE,
  fig_path = NULL
)

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

column name for segment type (C or V).

utterance_id

column name for unique utterance IDs.

cv_duration

column name for the duration of C or V.

save_fig

default is FALSE. Change to TRUE to save the plot.

fig_path

default is NULL. Required if save_fig = TRUE.

Value

A boxplot for Delta C and Delta V values.

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(
  cv_label = rep(c("consonant", "vowel"), 8),
  utterance_id = rep(paste0("utt_", 1:4), each = 4),
  cv_duration = c(
    0.10, 0.80, 0.20, 0.50,
    0.30, 0.30, 0.40, 0.70,
    0.30, 0.88, 0.50, 0.90,
    0.30, 0.57, 0.40, 0.97
  )
)

plot_delta_cv(
  df_test, cv_label, utterance_id, cv_duration, save_fig = FALSE
)


Plot nPVI V

Description

This function loads a dataframe as input and returns a box plot for nPVI V values.

Usage

plot_npvi(
  df,
  cv_label,
  label_name,
  utterance_id,
  cv_duration,
  save_fig = FALSE,
  fig_path = NULL
)

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

column name for the segment labels (e.g., cv_label).

label_name

a string to filter the vowels, e.g. label_name = 'vowel'.

utterance_id

column name for unique utterance IDs.

cv_duration

column name for the duration of C or V.

save_fig

default is FALSE. Change to TRUE to save the plot.

fig_path

default is NULL. Required if save_fig = TRUE.

Value

A boxplot for nPVI V values.

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(
  cv_label = rep(c("consonant", "vowel"), 8),
  utterance_id = rep(paste0("utt_", 1:4), each = 4),
  cv_duration = c(
    0.10, 0.80, 0.20, 0.50,
    0.30, 0.30, 0.40, 0.70,
    0.30, 0.88, 0.50, 0.90,
    0.30, 0.57, 0.40, 0.97
  )
)

plot_npvi(
  df_test,
  cv_label = cv_label,
  label_name = "vowel",
  utterance_id = utterance_id,
  cv_duration = cv_duration
)


Plot Percentage V

Description

This function loads a dataframe as input and returns a box plot for %V values.

Usage

plot_percentage_v(
  df,
  cv_label,
  label_name,
  utterance_id,
  cv_duration,
  utterance_duration,
  save_fig = FALSE,
  fig_path = NULL
)

Arguments

df

a data frame containing cv_labels, utterance_id, cv_duration, and utterance_duration values.

cv_label

column name for the segment labels (e.g., cv_label).

label_name

a string to filter the vowels, e.g. label_name = 'vowel'.

utterance_id

column name for unique utterance IDs.

cv_duration

column name for the duration of C or V.

utterance_duration

column name for the duration of entire utterances.

save_fig

default is FALSE. Change to TRUE to save the plot.

fig_path

default is NULL. Required if save_fig = TRUE.

Value

A boxplot for %V values.

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(
  cv_label = rep(c("consonant", "vowel"), 8),
  utterance_id = rep(paste0("utt_", 1:4), each = 4),
  cv_duration = c(
    0.10, 0.80, 0.20, 0.50,
    0.30, 0.30, 0.40, 0.70,
    0.30, 0.88, 0.50, 0.90,
    0.30, 0.57, 0.40, 0.97
  ),
  utterance_duration = rep(c(2.4, 2.7, 3.4, 1.8), each = 4)
)

plot_percentage_v(
  df_test,
  cv_label = cv_label,
  label_name = "vowel",
  utterance_id = utterance_id,
  cv_duration = cv_duration,
  utterance_duration = utterance_duration
)


Plot rPVI C

Description

This function loads a dataframe as input and returns a box plot for rPVI C values.

Usage

plot_rpvi(
  df,
  cv_label,
  label_name,
  utterance_id,
  cv_duration,
  save_fig = FALSE,
  fig_path = NULL
)

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

column name for the segment labels (e.g., cv_label).

label_name

a string to filter the segments, e.g. label_name = 'consonant'.

utterance_id

column name for unique utterance IDs.

cv_duration

column name for the duration of C or V.

save_fig

default is FALSE. Change to TRUE to save the plot.

fig_path

default is NULL. Required if save_fig = TRUE.

Value

A boxplot for rPVI values.

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(
  cv_label = rep(c("consonant", "vowel"), 8),
  utterance_id = rep(paste0("utt_", 1:4), each = 4),
  cv_duration = c(
    0.10, 0.80, 0.20, 0.50,
    0.30, 0.30, 0.40, 0.70,
    0.30, 0.88, 0.50, 0.90,
    0.30, 0.57, 0.40, 0.97
  )
)

plot_rpvi(
  df_test,
  cv_label = cv_label,
  label_name = "consonant",
  utterance_id = utterance_id,
  cv_duration = cv_duration
)


Plot Varco C & Varco V

Description

This function loads a dataframe as input and returns a box plot for Varco C and Varco V values.

Usage

plot_varco_cv(
  df,
  cv_label,
  utterance_id,
  cv_duration,
  save_fig = FALSE,
  fig_path = NULL
)

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

column name for segment type (C or V).

utterance_id

column name for unique utterance IDs.

cv_duration

column name for the duration of C or V.

save_fig

default is FALSE. Change to TRUE to save the plot.

fig_path

default is NULL. Required if save_fig = TRUE.

Value

A boxplot for Varco C and Varco V values.

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(
  cv_label = rep(c("consonant", "vowel"), 8),
  utterance_id = rep(paste0("utt_", 1:4), each = 4),
  cv_duration = c(
    0.10, 0.80, 0.20, 0.50,
    0.30, 0.30, 0.40, 0.70,
    0.30, 0.88, 0.50, 0.90,
    0.30, 0.57, 0.40, 0.97
  )
)

plot_varco_cv(
  df_test, cv_label, utterance_id, cv_duration, save_fig = FALSE
)


rPVI C

Description

This function loads a dataframe as input and returns a dataframe containing the mean values of rPVI of consonants.

Usage

rpvi_c(df, cv_label, utterance_id, cv_duration, label_name = "consonant")

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

the column name that contains the labels (consonant/vowel).

utterance_id

column name for unique utterance IDs

cv_duration

column name for the duration of C or V

label_name

a string to filter the consonants, e.g. 'consonant'

Details

rPVI C is a rhythm metrics based on Grabe, E., & Low, E. L. (2002). Durational variability in speech and the rhythm class hypothesis. In Laboratory phonology 7 (pp. 515-546). De Gruyter Mouton. It calculates the sum of the absolute differences between pairs of consecutive consonantal intervals divided by the number of pairs in the speech sample.

Value

a data frame containing the mean rPVI for consonants

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(cv_label = rep(c("consonant", "vowel"), 4),
                      utterance_id = rep(c("utt_1", "utt_2"), each = 4),
                      cv_duration = c(0.1, 0.8, 0.2, 0.5, 0.3, 0.3, 0.4, 0.7))

rpvi_c(
  df_test,
  cv_label = cv_label,
  utterance_id = utterance_id,
  cv_duration = cv_duration,
  label_name = "consonant"
)


Varco C & Varco V

Description

This function loads a dataframe as input and returns a dataframe containing the mean values of Varco C and Varco V.

Usage

varco_cv(df, cv_label, utterance_id, cv_duration)

Arguments

df

a data frame containing cv_labels, utterance_id, and cv_duration values.

cv_label

column name indicating whether a segment is a C(onsonant) or a V(owel).

utterance_id

column name for unique utterance IDs.

cv_duration

column name for the duration of C or V.

Details

Varco C and Varco V are rhythm metrics based on Dellwo, Volker (2006). Rhythm and Speech Rate: A Variation Coefficient for deltaC. In: Karnowski, P; Szigeti, I. Language and language-processing. Frankfurt/Main: Peter Lang, 231-241.

⁠Varco C: Delta C / mean(C duration) * 100⁠ ⁠Varco V: Delta V / mean(V duration) * 100⁠

Value

a data frame containing the results of Varco C and Varco V values.

Author(s)

Cong Zhang, cong.zhang@newcastle.ac.uk

Examples

df_test <- data.frame(cv_label = c("c", "v", "c", "v","c", "v", "c", "v"),
                      utterance_id = c("utt_1", "utt_1", "utt_2", "utt_2",
                                       "utt_3", "utt_3", "utt_4", "utt_4"),
                      cv_duration = c(0.1, 0.8, 0.2, 0.5, 0.3, 0.3, 0.4, 0.7))

varco_cv(df_test, cv_label, utterance_id, cv_duration)