API Reference

AcousticMetrics.AbstractNarrowbandSpectrumType
AbstractNarrowbandSpectrum{IsEven,Tel} <: AbstractVector{Tel}

Supertype for a generic narrowband acoustic metric which will behave as an immutable AbstractVector of element type Tel.

The IsEven parameter is a Bool indicating if the length of the spectrum is even or not, affecting how the Nyquist frequency is calculated.

source
AcousticMetrics.AbstractPressureTimeHistoryType
AbstractPressureTimeHistory{IsEven}

Supertype for a pressure time history, i.e., pressure as a function of time defined on evenly-spaced time samples.

The IsEven parameter is a Bool indicating if the length of the pressure time history is even or not.

source
AcousticMetrics.AbstractProportionalBandsType
AbstractProportionalBands{NO,LCU,TF} <: AbstractVector{TF}

Abstract type representing the exact proportional frequency bands with band fraction NO and eltype TF.

The LCU parameter can take one of three values:

  • :lower: The struct returns the lower edges of each frequency band.
  • :center: The struct returns the center of each frequency band.
  • :upper: The struct returns the upper edges of each frequency band.
source
AcousticMetrics.ApproximateOctaveBandsType
ApproximateOctaveBands{LCU,TF} <: AbstractProportionalBands{3,LCU,TF}

Representation of the approximate octave proportional frequency bands with eltype TF.

The LCU parameter can take one of three values:

  • :lower: The struct returns the lower edges of each frequency band.
  • :center: The struct returns the center of each frequency band.
  • :upper: The struct returns the upper edges of each frequency band.
source
AcousticMetrics.ApproximateOctaveBandsMethod
ApproximateOctaveBands{LCU,TF}(bstart::Int, bend::Int)

Construct an ApproximateOctaveBands with eltype TF encomposing band numbers from bstart to bend.

TF defaults to Float64.

source
AcousticMetrics.ApproximateOctaveBandsMethod
ApproximateOctaveBands{LCU}(fstart::TF, fend::TF)

Construct an ApproximateOctaveBands with eltype TF encomposing the bands needed to completly extend over minimum frequency fstart and maximum frequency fend.

source
AcousticMetrics.ApproximateThirdOctaveBandsType
ApproximateThirdOctaveBands{LCU,TF} <: AbstractProportionalBands{3,LCU,TF}

Representation of the approximate third-octave proportional frequency bands with eltype TF.

The LCU parameter can take one of three values:

  • :lower: The struct returns the lower edges of each frequency band.
  • :center: The struct returns the center of each frequency band.
  • :upper: The struct returns the upper edges of each frequency band.
source
AcousticMetrics.ApproximateThirdOctaveBandsMethod
ApproximateThirdOctaveBands{LCU}(fstart::TF, fend::TF)

Construct an ApproximateThirdOctaveBands with eltype TF encomposing the bands needed to completly extend over minimum frequency fstart and maximum frequency fend.

source
AcousticMetrics.ExactProportionalBandsMethod
ExactProportionalBands{NO,LCU}(fstart::TF, fend::TF)

Construct an ExactProportionalBands with eltype TF encomposing the bands needed to completly extend over minimum frequency fstart and maximum frequency fend.

source
AcousticMetrics.MSPSpectrumAmplitudeType
MSPSpectrumAmplitude(pth::AbstractPressureTimeHistory, hc=similar(pressure(pth)))

Construct a narrowband spectrum of the mean-squared pressure amplitude from a pressure time history.

The optional argument hc will be used to store the discrete Fourier transform of the pressure time history, and should have length of inputlength(pth).

source
AcousticMetrics.MSPSpectrumAmplitudeType
MSPSpectrumAmplitude(hc, dt, t0=zero(dt))

Construct a narrowband spectrum of the mean-squared pressure amplitude from the discrete Fourier transform in half-complex format hc, time step size dt, and initial time t0.

source
AcousticMetrics.MSPSpectrumAmplitudeType
MSPSpectrumAmplitude{IsEven,Tel} <: AbstractNarrowbandSpectrum{IsEven,Tel}

Representation of mean-squared pressure amplitude as a function of narrowband frequency.

The IsEven parameter is a Bool indicating if the length of the spectrum is even or not, affecting how the Nyquist frequency is calculated.

source
AcousticMetrics.PowerSpectralDensityAmplitudeType
PressureSpectrumAmplitude(pth::AbstractPressureTimeHistory, hc=similar(pressure(pth)))

Construct a narrowband spectrum of the power spectral density amplitude from a pressure time history.

The optional argument hc will be used to store the discrete Fourier transform of the pressure time history, and should have length of inputlength(pth).

source
AcousticMetrics.PowerSpectralDensityAmplitudeType
PowerSpectralDensityAmplitude(hc, dt, t0=zero(dt))

Construct a narrowband spectrum of the power spectral density amplitude from the discrete Fourier transform in half-complex format hc, time step size dt, and initial time t0.

source
AcousticMetrics.PowerSpectralDensityAmplitudeType
PowerSpectralDensityAmplitude{IsEven,Tel} <: AbstractNarrowbandSpectrum{IsEven,Tel}

Representation of acoustic power spectral density amplitude as a function of narrowband frequency.

The IsEven parameter is a Bool indicating if the length of the spectrum is even or not, affecting how the Nyquist frequency is calculated.

source
AcousticMetrics.PressureSpectrumAmplitudeType
PressureSpectrumAmplitude(pth::AbstractPressureTimeHistory, hc=similar(pressure(pth)))

Construct a narrowband spectrum of the pressure amplitude from a pressure time history.

The optional argument hc will be used to store the discrete Fourier transform of the pressure time history, and should have length of inputlength(pth).

source
AcousticMetrics.PressureSpectrumAmplitudeType
PressureSpectrumAmplitude(hc, dt, t0=zero(dt))

Construct a narrowband spectrum of the pressure amplitude from the discrete Fourier transform in half-complex format hc, time step size dt, and initial time t0.

source
AcousticMetrics.PressureSpectrumAmplitudeType
PressureSpectrumAmplitude{IsEven,Tel} <: AbstractNarrowbandSpectrum{IsEven,Tel}

Representation of acoustic pressure amplitude as a function of narrowband frequency.

The IsEven parameter is a Bool indicating if the length of the spectrum is even or not, affecting how the Nyquist frequency is calculated.

source
AcousticMetrics.PressureSpectrumPhaseType
PressureSpectrumPhase(pth::AbstractPressureTimeHistory, hc=similar(pressure(pth)))

Construct a narrowband spectrum of the pressure phase from a pressure time history.

The optional argument hc will be used to store the discrete Fourier transform of the pressure time history, and should have length of inputlength(pth).

source
AcousticMetrics.PressureSpectrumPhaseType
PressureSpectrumPhase(hc, dt, t0=zero(dt))

Construct a narrowband spectrum of the pressure phase from the discrete Fourier transform in half-complex format hc, time step size dt, and initial time t0.

source
AcousticMetrics.PressureSpectrumPhaseType
PressureSpectrumPhase{IsEven,Tel} <: AbstractNarrowbandSpectrum{IsEven,Tel}

Representation of acoustic pressure phase as a function of narrowband frequency.

The IsEven parameter is a Bool indicating if the length of the spectrum is even or not, affecting how the Nyquist frequency is calculated.

source
AcousticMetrics.PressureTimeHistoryType
PressureTimeHistory(sm::AbstractNarrowbandSpectrum, p=similar(halfcomplex(sm)))

Construct a pressure time history from a narrowband spectrum sm.

The optional p argument will be used to store the pressure vector of the pressure time history, and should have length inputlength(sm).

source
AcousticMetrics.PressureTimeHistoryType
PressureTimeHistory{IsEven} <: AbstractPressureTimeHistory{IsEven}

Pressure as a function of time defined on evenly-spaced time samples.

The IsEven parameter is a Bool indicating if the length of the pressure time history is even or not.

source
AcousticMetrics.ProportionalBandSpectrumMethod
ProportionalBandSpectrum(TBands::Type{<:AbstractProportionalBands}, sm::AbstractNarrowbandSpectrum)

Construct a ProportionalBandSpectrum using a proportional band TBands and narrowband spectrum sm.

source
AcousticMetrics.OASPLMethod
OASPL(ap::AbstractNarrowbandSpectrum)

Return the overall sound pressure level of a narrowband spectrum.

source
AcousticMetrics.OASPLMethod
OASPL(ap::AbstractPressureTimeHistory)

Return the overall sound pressure level of a pressure time history.

source
AcousticMetrics.W_AMethod
W_A(f::AbstractFloat)

Calculate the A-weighting factor for a frequency f in Hertz.

Taken from the ANOPP2 Acoustics Analysis API Reference Manual.

source
AcousticMetrics.dft_hc2rMethod
dft_hc2r(x::AbstractVector)

Calculate the inverse discrete Fourier transform of a real-input DFT.

This is the inverse of dft_r2hc, except for a factor of N, where N is the length of the input (and output), since FFTW computes an "unnormalized" FFT.

See http://www.fftw.org/fftw3doc/The-1d-Real002ddata-DFT.html#The-1d-Real002ddata-DFT and http://www.fftw.org/fftw3doc/The-Halfcomplex_002dformat-DFT.html for details.

Only use this for checking the derivatives of the FFT routines (should work fine, just slow).

source
AcousticMetrics.dft_r2hcMethod
dft_r2hc(x::AbstractVector)

Calculate the real-input discrete Fourier transform, returning the result in the "half-complex" format.

See http://www.fftw.org/fftw3doc/The-1d-Real002ddata-DFT.html#The-1d-Real002ddata-DFT and http://www.fftw.org/fftw3doc/The-Halfcomplex_002dformat-DFT.html for details.

Only use this for checking the derivatives of the FFT routines (should work fine, just slow).

source
AcousticMetrics.frequencyMethod
frequency(sm::AbstractNarrowbandSpectrum)

Return a vector of frequencies associated with the narrowband spectrum.

The frequencies are calculated using the rfftfreq function in the FFTW.jl package.

source
AcousticMetrics.inputlengthMethod
inputlength(sm::AbstractNarrowbandSpectrum)

Return a number of pressure time samples associated with a narrowband spectrum.

This is also the length of the discrete Fourier transform associated with the spectrum in half-complex format.

source
AcousticMetrics.inputlengthMethod
inputlength(pth::AbstractPressureTimeHistory)

Return a number of pressure samples associated with a pressure time history.

source
AcousticMetrics.irfft!Function
irfft!(y, x, cache=nothing)

Calculate the inverse FFT of `x` and store the result in in `y`, where `x` is in the half-complex format.

Just a wrapper of `FFTW.r2r!(y, FFTW.HC2R)`. The `cache` argument is
optional and not used, and is included to keep the function signiture the
same as the method that takes `Vector`s of `Dual`s.
source
AcousticMetrics.pressureMethod
pressure(pth::AbstractPressureTimeHistory)

Return a vector of pressures associated with a pressure time history.

source
AcousticMetrics.rfft!Function
rfft!(y, x, cache=nothing)

Calculate the real-input FFT of `x` and store the result in half-complex format in `y`.

Just a wrapper of `FFTW.r2r!(y, FFTW.R2HC)`. The `cache` argument is
optional and not used, and is included to keep the function signiture the
same as the method that takes `Vector`s of `Dual`s.
source
AcousticMetrics.samplerateMethod
samplerate(sm::AbstractNarrowbandSpectrum)

Return the sample rate (aka the inverse of the time step size) associated with a narrowband spectrum.

source
AcousticMetrics.timeMethod
time(pth::AbstractPressureTimeHistory)

Return a vector of times associated with a pressure time history.

source
AcousticMetrics.timestepMethod
timestep(pth::AbstractPressureTimeHistory)

Return the time step size dt associated with a pressure time history.

source
Base.getindexMethod
Base.getindex(bands::ApproximateOctaveBands{LCU}, i::Int) where {LCU}

Return the lower, center, or upper frequency (depending on the value of LCU) associated with the i-th proportional band frequency covered by bands.

source
Base.getindexMethod
Base.getindex(bands::ApproximateThirdOctaveBands{LCU}, i::Int) where {LCU}

Return the lower, center, or upper frequency (depending on the value of LCU) associated with the i-th proportional band frequency covered by bands.

source
Base.getindexMethod
Base.getindex(bands::ExactProportionalBands{NO,LCU}, i::Int) where {NO,LCU}

Return the lower, center, or upper frequency (depending on the value of LCU) associated with the i-th proportional band frequency covered by bands.

source
Base.getindexMethod
Base.getindex(pbs::ProportionalBandSpectrum, i::Int)

Return the proportional band spectrum amplitude for the ith non-zero band in pbs.

source