Extracting Features with communication

  collapse = TRUE,
  comment = "#>"


This is an early version of a project in active development. Over the next few months, the package will be greatly extended to include additional options for featurization and a number of helper functions for model fitting. In its present version, the package contains the necessary functions to replicate the analysis conducted in "A Dynamic Model of Speech for the Social Sciences" (Knox and Lucas, forthcoming).

In this vignette, we briefly demonstrate how to do feature extraction with communication. To extract features from audio files in a list, first collect all filenames, then extract, as

## extract features
wav.fnames = list.files(file.path('PATH_TO_YOUR_DIRECTORY'),
                        pattern = 'wav$',
                        recursive = TRUE,
                        full.names = TRUE
audio <- extractAudioFeatures(wav.fnames = wav.fnames,
                              derivatives = 0

After feature extraction, you most likely want to standardize features, and can do so as follows:

## standardize full training set together
audio$data <- standardizeFeatures(
    lapply(audio$data, function(x) na.omit(x))

Lastly, you can estimate hidden Markov models with the following function, which wraps a fast C++ implementation.

mod <- hmm(audio$data,
    nstates = 2,
    control = list(verbose = TRUE)

Try the communication package in your browser

Any scripts or data that you put into this service are public.

communication documentation built on Feb. 25, 2021, 5:08 p.m.