Octave¶
Module for working with octaves.
The following is an example on how to use acoustics.octave.Octave
.
-
acoustics.octave.
exact_center_frequency
(frequency=None, fraction=1, n=None, ref=1000.0)[source]¶ Exact center frequency.
Parameters: - frequency – Frequency within the band.
- fraction – Band designator.
- n – Index of band.
- ref – Reference frequency.
Returns: Exact center frequency for the given frequency or band index.
-
acoustics.octave.
nominal_center_frequency
(frequency=None, fraction=1, n=None)[source]¶ Nominal center frequency.
Parameters: - frequency – Frequency within the band.
- fraction – Band designator.
- n – Index of band.
Returns: The nominal center frequency for the given frequency or band index.
Note
Contrary to the other functions this function silently assumes 1000 Hz reference frequency.
-
acoustics.octave.
lower_frequency
(frequency=None, fraction=1, n=None, ref=1000.0)[source]¶ Lower band-edge frequency.
Parameters: - frequency – Frequency within the band.
- fraction – Band designator.
- n – Index of band.
- ref – Reference frequency.
Returns: Lower band-edge frequency for the given frequency or band index.
-
acoustics.octave.
upper_frequency
(frequency=None, fraction=1, n=None, ref=1000.0)[source]¶ Upper band-edge frequency.
Parameters: - frequency – Frequency within the band.
- fraction – Band designator.
- n – Index of band.
- ref – Reference frequency.
Returns: Upper band-edge frequency for the given frequency or band index.
-
acoustics.octave.
index_of_frequency
(frequency, fraction=1, ref=1000.0, G=1.9952623149688795)[source]¶ Determine the band index x from a given frequency.
Parameters: - frequency – Frequencies \(f\).
- fraction – Bandwidth designator \(b\).
- ref – Reference frequency.
- G – Octave frequency ratio \(G\).
The index of the center frequency is given by
\[x = round{b \frac{\log{f/f_{ref} }}{\log{G} }}\]Note
This equation is not part of the standard. However, it follows from
exact_center_frequency()
.
-
class
acoustics.octave.
Octave
(fraction=1, interval=None, fmin=None, fmax=None, unique=False, reference=1000.0)[source]¶ Class to calculate octave center frequencies.
-
__init__
(fraction=1, interval=None, fmin=None, fmax=None, unique=False, reference=1000.0)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
bandwidth
¶ Bandwidth of bands.
\[B = f_u - f_l\]
-
center
¶ Return center frequencies \(f_c\).
\[f_c = f_{ref} \cdot 2^{n/N} \cdot 10^{\frac{3}{10N}}\]
-
fmax
¶ Maximum frequency of an interval.
-
fmin
¶ Minimum frequency of an interval.
-
fraction
= None¶ Fraction of octave.
-
interval
¶ Interval.
-
lower
¶ Lower frequency limits of bands.
\[f_l = f_c \cdot 2^{\frac{-1}{2N}}\]See also
lower_frequency()
.
-
n
¶ Return band
n
for a given frequency.
-
reference
= None¶ Reference center frequency \(f_{c,0}\).
-
unique
= None¶ Whether or not to calculate the requested values for every value of
interval
.
-
upper
¶ Upper frequency limits of bands.
\[f_u = f_c \cdot 2^{\frac{+1}{2N}}\]See also
upper_frequency()
.
-
-
acoustics.octave.
frequency_of_band
(x, fraction=1, ref=1000.0, G=1.9952623149688795)¶ Center frequencies \(f_m\) for band indices \(x\). See equation 2 and 3.
Parameters: - x – Band index \(x\).
- ref – Reference center frequency \(f_r\).
- fraction – Bandwidth designator :math`b`. For example, for 1/3-octave filter b=3.
- G – Octave frequency ratio \(G\).
The center frequencies are given by
\[f_m = f_r G^{x/b}\]In case the bandwidth designator \(b\) is an even number, the center frequencies are given by
\[f_m = f_r G^{(2x+1)/2b}\]See equation 2 and 3 of the standard.
-
acoustics.octave.
band_of_frequency
(frequency, fraction=1, ref=1000.0, G=1.9952623149688795)¶ Determine the band index x from a given frequency.
Parameters: - frequency – Frequencies \(f\).
- fraction – Bandwidth designator \(b\).
- ref – Reference frequency.
- G – Octave frequency ratio \(G\).
The index of the center frequency is given by
\[x = round{b \frac{\log{f/f_{ref} }}{\log{G} }}\]Note
This equation is not part of the standard. However, it follows from
exact_center_frequency()
.