Learn R Programming

soundgen (version 2.7.4)

getSurprisal_matrix: Get surprisal per matrix

Description

Internal soundgen function called by getSurprisal.

Usage

getSurprisal_matrix(
  x,
  win,
  method = c("acf", "np")[1],
  sameLagAllFreqs = TRUE,
  weightByAmpl = TRUE,
  rescale = FALSE
)

Arguments

x

input matrix such as a spectrogram (columns = time, rows = frequency)

win

length of analysis window

method

acf = change in maximum autocorrelation after adding the final point, np = nonlinear prediction (see nonlinPred - works but is VERY slow)

sameLagAllFreqs

(only for method = 'acf') if TRUE, the best_lag is calculated by averaging the ACFs of all channels, and the same best_lag is used to calculate the surprisal in each frequency channel (we expect the same "rhythm" for all frequencies); if FALSE, the best_lag is calculated separately for each frequency channel (we can track different "rhythms" at different frequencies)

weightByAmpl

if TRUE, ACFs and surprisal are weighted by max amplitude per frequency channel

rescale

if TRUE, surprisal is normalized from (-Inf, Inf) to [-1, 1]