| Title: | Analyse and Visualise Speech Rhythm and Timing Metrics |
|---|---|
| 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>. |
| Authors: | Cong Zhang [aut, cre] (ORCID: <https://orcid.org/0000-0002-2561-2113>) |
| Maintainer: | Cong Zhang <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.1.0 |
| Built: | 2026-10-13 13:06:01 UTC |
| Source: | https://github.com/congzhang365/rhythm.metrics |
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.
delta_cv(df, cv_label, utterance_id, cv_duration)delta_cv(df, cv_label, utterance_id, cv_duration)
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 |
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
a data frame containing the results of Delta C and Delta V values
Cong Zhang, [email protected]
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)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)
This function loads a dataframe as input and returns a dataframe containing the mean values of nPVI of vowels.
npvi_v(df, cv_label, label_name, utterance_id, cv_duration)npvi_v(df, cv_label, label_name, utterance_id, cv_duration)
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. |
utterance_id |
column name for unique utterance IDs. |
cv_duration |
column name for the duration of C or V. |
a data frame containing the mean nPVI for vowels.
Cong Zhang, [email protected]
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)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)
This function loads a dataframe as input and returns a dataframe containing the mean values and mean standard deviations of %V.
percentage_v(df, v_label, utterance_id, cv_duration, utterance_duration)percentage_v(df, v_label, utterance_id, cv_duration, utterance_duration)
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. |
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 |
%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
a data frame containing the mean values and standard deviation of %V
Cong Zhang, [email protected]
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)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)
This function loads a dataframe as input and returns a box plot for Delta C and Delta V values.
plot_delta_cv( df, cv_label, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )plot_delta_cv( df, cv_label, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )
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 |
fig_path |
default is |
A boxplot for Delta C and Delta V values.
Cong Zhang, [email protected]
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 )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 )
This function loads a dataframe as input and returns a box plot for nPVI V values.
plot_npvi( df, cv_label, label_name, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )plot_npvi( df, cv_label, label_name, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )
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. |
utterance_id |
column name for unique utterance IDs. |
cv_duration |
column name for the duration of C or V. |
save_fig |
default is |
fig_path |
default is |
A boxplot for nPVI V values.
Cong Zhang, [email protected]
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 )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 )
This function loads a dataframe as input and returns a box plot for %V values.
plot_percentage_v( df, cv_label, label_name, utterance_id, cv_duration, utterance_duration, save_fig = FALSE, fig_path = NULL )plot_percentage_v( df, cv_label, label_name, utterance_id, cv_duration, utterance_duration, save_fig = FALSE, fig_path = NULL )
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. |
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 |
fig_path |
default is |
A boxplot for %V values.
Cong Zhang, [email protected]
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 )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 )
This function loads a dataframe as input and returns a box plot for rPVI C values.
plot_rpvi( df, cv_label, label_name, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )plot_rpvi( df, cv_label, label_name, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )
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. |
utterance_id |
column name for unique utterance IDs. |
cv_duration |
column name for the duration of C or V. |
save_fig |
default is |
fig_path |
default is |
A boxplot for rPVI values.
Cong Zhang, [email protected]
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 )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 )
This function loads a dataframe as input and returns a box plot for Varco C and Varco V values.
plot_varco_cv( df, cv_label, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )plot_varco_cv( df, cv_label, utterance_id, cv_duration, save_fig = FALSE, fig_path = NULL )
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 |
fig_path |
default is |
A boxplot for Varco C and Varco V values.
Cong Zhang, [email protected]
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 )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 )
This function loads a dataframe as input and returns a dataframe containing the mean values of rPVI of consonants.
rpvi_c(df, cv_label, utterance_id, cv_duration, label_name = "consonant")rpvi_c(df, cv_label, utterance_id, cv_duration, label_name = "consonant")
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' |
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.
a data frame containing the mean rPVI for consonants
Cong Zhang, [email protected]
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" )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" )
This function loads a dataframe as input and returns a dataframe containing the mean values of Varco C and Varco V.
varco_cv(df, cv_label, utterance_id, cv_duration)varco_cv(df, cv_label, utterance_id, cv_duration)
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. |
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
a data frame containing the results of Varco C and Varco V values.
Cong Zhang, [email protected]
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)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)