This is a generic normalization procedure with which you can create your own normalization method.
norm_generic(
.data,
...,
.by = NULL,
.by_formant = FALSE,
.by_token = FALSE,
.L = 0,
.S = 1,
.pre_trans = function(x) x,
.post_trans = function(x) x,
.drop_orig = FALSE,
.keep_params = FALSE,
.names = "{.formant}_n",
.silent = opt("tidynorm.silent"),
.call = caller_env()
)A data frame of normalized formant values
A data frame containing vowel formant data
<tidy-select> One or more unquoted
expressions separated by commas. These should target the vowel formant
data columns.
<tidy-select> A selection of
columns to group by. Typically a column of speaker IDs.
Whether or not the normalization method is formant intrinsic.
Whether or not the normalization method is vowel intrinsic
An expression defining the location parameter. See Details for more information.
An expression defining the scale parameter. See Details for more information.
A function to apply to formant values before normalization.
A function to apply to formant values after normalization.
Whether or not to drop the original formant data columns.
Whether or not to keep the Location (*_.L) and Scale
(*_.S) normalization parameters
A glue::glue() expression for naming the normalized
data columns. The "{.formant}" portion corresponds to the name of the original
formant columns.
Suppress normalization information messages when running a norm_*() function. (Defaults to FALSE, overwritable using option 'tidynorm.silent' or environment variable 'R_TIDYNORM_TIDYNORM_SILENT')
Used for internal purposes.
The following norm_* procedures are built on top of norm_generic().
norm_lobanov
norm_nearey
norm_deltaF
norm_wattfab
norm_barkz
All normalization procedures built on norm_generic produce normalized formant values (\(\hat{F}\)) by subtracting a location parameter (\(L\)) and dividing by a scale parameter (\(S\)).
$$ \hat{F} = \frac{F-L}{S} $$
The expressions for calculating \(L\) and \(S\) can be
passed to .L and .S, respectively. Available values for
these expressions are
.formantThe original formant value
.formant_numThe number of the formant. (e.g. 1 for F1, 2 for F2 etc)
Along with any data columns from your original data.
To apply any transformations before or after normalization,
you can pass a function to .pre_trans and .post_trans.
If .by_formant is TRUE, normalization will be formant intrinsic.
If .by_formant is FALSE, normalization will be formant extrinsic.
If .by_token is TRUE, normalization will be token intrinsic.
If .by_token is FALSE, normalization will be token extrinsic.
library(tidynorm)
library(dplyr)
speaker_data |>
norm_generic(
F1:F3,
.by = speaker,
.by_formant = TRUE,
.L = median(.formant, na.rm = TRUE),
.S = mad(.formant, na.rm = TRUE),
.drop_orig = TRUE,
.names = "{.formant}_mad"
)
Run the code above in your browser using DataLab