dbnorm: Function to dB-normalise spectral objects

dbnormR Documentation

Function to dB-normalise spectral objects

Description

The function can be used to rescale a spectrum to a dB value at a particular frequency - for example, to rescale the spectrum so that 3000 Hz has 0 dB and all other values are shifted in relation to this.

Usage

dbnorm(specdata, f = 0, db = 0)

Arguments

specdata

An object of class 'spectral'

f

A single element vector specifying the frequency. Defaults to 0

db

A single element vector specifying the dB value to which the spectrum is to be rescaled. Defaults to zero

Value

An object of the same class with rescaled dB values. The default is to rescale the dB-values of the spectrum to 0 dB at 0 Hz.

Author(s)

Jonathan Harrington

See Also

dbtopower plot.spectral

Examples


# normalise to - 40 dB at 1500 Hz
res = dbnorm(e.dft, 1500, 0)
# compare the two
ylim = range(c(res, e.dft))
plot(e.dft, ylim=ylim, type="l")
oldpar = par(new=TRUE)
plot(res, ylim=ylim, type="l", col=2)

par(oldpar)


emuR documentation built on Nov. 4, 2023, 1:06 a.m.