roughness_wang: Wang et al.'s (2013) roughness model

roughness_wangR Documentation

Wang et al.'s (2013) roughness model

Description

Gets the roughness of a sonority according to the model of Wang et al. (2013).

Usage

roughness_wang(
  x,
  detail = FALSE,
  include_phase_impact_factors = FALSE,
  unit_amplitude_in_dB = 60,
  msg = function(n, N, msg) if (interactive()) message(n, "/", N, ": ", msg),
  ...
)

## Default S3 method:
roughness_wang(
  x,
  detail = FALSE,
  include_phase_impact_factors = FALSE,
  unit_amplitude_in_dB = 60,
  msg = function(n, N, msg) if (interactive()) message(n, "/", N, ": ", msg),
  ...
)

## S3 method for class 'sparse_fr_spectrum'
roughness_wang(
  x,
  detail = FALSE,
  include_phase_impact_factors = FALSE,
  unit_amplitude_in_dB = 60,
  msg = function(n, N, msg) if (interactive()) message(n, "/", N, ": ", msg),
  ...
)

Arguments

x

Object to analyse, which will be coerced to an object of class sparse_fr_spectrum. Various input types are possible:

  • Numeric vectors will be treated as vectors of MIDI note numbers, which will be expanded into their implied harmonics.

  • A two-element list can be used to define a harmonic spectrum. The first element should be a vector of frequencies in Hz, the second a vector of amplitudes.

  • The function also accepts classes from the hrep package, such as produced by pi_chord() and sparse_fr_spectrum().

detail

(Logical scalar) Whether to return detailed output information.

include_phase_impact_factors

(Logical scalar) Whether to include phase impact factors in roughness computation. Set to TRUE to recover the original specifications of Wang et al. (2013). However, disabling this feature (by leaving the parameter at FALSE) seems to result in better estimation of perceptual consonance.

unit_amplitude_in_dB

(Numeric scalar) Determines the decibel level of a partial with amplitude 1. When the input is a musical chord, this will correspond to the decibel level of the fundamental frequencies of each chord tone.

msg

Function to be called to give progress updates. This function should accept three arguments: n, an integer identifying the current position in the pipeline, N, an integer identifying the length of the pipeline, and msg, a string providing a longer-format description of the current position in the pipeline. Pass NULL to disable progress updates.

...

Additional parameters to pass to sparse_fr_spectrum.

  • num_harmonics: Number of harmonics to use when expanding chord tones into their implied harmonics.

  • roll_off: Rate of amplitude roll-off for the harmonics.

Value

If detail == FALSE, a numeric vector of roughnesses, otherwise a list containing detailed algorithm output.

Note

This implementation is designed for sparse input spectra, that is, spectra containing only a few (< 100) components.

References

\insertRef

Wang2013incon


pmcharrison/incon documentation built on Feb. 12, 2024, 3:18 a.m.