HzToERB: Convert Hz to ERB rate

View source: R/utilities_math.R

HzToERBR Documentation

Convert Hz to ERB rate

Description

Converts from Hz to the number of Equivalent Rectangular Bandwidths (ERBs) below input frequency. See https://www2.ling.su.se/staff/hartmut/bark.htm and https://en.wikipedia.org/wiki/Equivalent_rectangular_bandwidth

Usage

HzToERB(h, method = c("linear", "quadratic")[1])

Arguments

h

vector or matrix of frequencies (Hz)

method

approximation to use

See Also

ERBToHz HzToSemitones HzToNotes

Examples

HzToERB(c(-20, 20, 100, 440, 1000, NA))

f = 20:20000
erb_lin = HzToERB(f, 'linear')
erb_quadratic = HzToERB(f, 'quadratic')
plot(f, erb_lin, log = 'x', type = 'l')
points(f, erb_quadratic, col = 'blue', type = 'l')

# compare with the bark scale:
barks = tuneR::hz2bark(f)
points(f, barks / max(barks) * max(erb_lin),
  col = 'red', type = 'l', lty = 2)

soundgen documentation built on Aug. 14, 2022, 5:05 p.m.