octave_spectrum — ACOUSTICS level op

資料種類:signaltable

呼叫:import acoustics; acoustics.octave_spectrum(x, rate, fraction=3, f_min=22.0, f_max=None, ref=1.0, weighting='Z', floor_db=-200.0)(或 opsacoustics.get("octave_spectrum"))

用法

按 Parseval 在 1/N 倍頻程帶內求和的 dB 帶級。

> 以下的詳細說明為原文 —— 摘要與標題已翻譯。

Energy is accumulated from the single-sided periodogram into the bands

:func:octave_bands defines, so the band powers sum to the signal's

mean-square exactly (up to the bins outside the requested range). That

identity is the test: measured on 16384 samples of white noise at 16 kHz

over 22 Hz - 8 kHz at 1/3 octave, the band powers sum to 0.996367 of

`mean(x**2) while total_power` (which counts every FFT bin) comes to

1.000000 of it. The 0.36 % difference is exactly the bins outside the

requested range, and returning both numbers is what makes that visible

instead of leaving a reader to wonder where the energy went.

The reference is explicit and there is no implicit 20 uPa. `ref` is an

amplitude in the same units as the signal, and the default 1.0 means "dB

relative to one unit of whatever you passed in". This library never sees a

microphone calibration, so a number labelled dB SPL would be a fabrication;

pass `ref=20e-6` when the signal really is pascals and the result really is

dB SPL.

`weighting applies :func:apply_weighting first ("Z"` = none).

Returns a dict: `centers, nominal, lower, upper, levels`

(dB), `powers (mean-square), total_level, total_power`,

`clamped (bool mask of bands floored at floor_db), ref`,

`weighting, fraction, resolution_hz, narrow_bands` (how many

FFT bins landed in each band — a band with 0 or 1 is under-resolved and the

level is not trustworthy), and `truncated`.

`truncated` is a bool mask of bands whose upper edge is above Nyquist,

which means only the part of the band below Nyquist was measured and the

level is the level of that part, not of the band. This is not an exotic

case: `f_max` bounds band *centres*, so the top band's edge always

overhangs it by half a band width, and the **default `f_max = 22050`

against the canonical rate of 44100** puts the top third-octave band at

17782.79-22387.21 Hz over a Nyquist of 22050. Measured on 1 s of white

noise at 44100: that band collects 4268 of the 4604 bins it spans

(7.3 % missing) and reported a level with nothing in the old return value

saying it was partial. Nothing raises — the missing bins simply do not

exist. Drop the flagged bands, or lower `f_max` until

`upper[-1] <= rate/2`.

Measured exactness: a 1 kHz sine of amplitude 0.7 at 16 kHz over exactly

1000 periods, `ref=1.0`, gives the 1 kHz band level

-6.1083391564 dB against the closed form

`10*log10(0.7**2/2) = -6.1083391564` dB — the difference is

0.000e+00. 25 of the 26 bands are at the floor, and `total_level`

equals the band level to the digit shown, because there is nothing else in

the record.

Raises `ValueError: everything :func:_as_signal` and

:func:octave_bands refuse, `ref <= 0` (a dB with a zero or negative

reference is not a number), an unknown `weighting, and an f_max` above

Nyquist.

詳細使用指南

acoustic_condition_monitoring 族使用指南

參考(範例資料・文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

• 演算法的正典(作者・年份)與用途見上面的族使用指南

可執行的範例(實際呼叫該運算子並已驗證的樣例)

acoustic_condition_monitoringpy -3.11 examples/acoustic_condition_monitoring.py

型別可銜接的下一個運算子(可接受 table 作為輸入)

istft

同類別(level)

octave_bands · weighting_response · apply_weighting · equivalent_level · percentile_level


*Provenance: acoustics.py — ACOUSTICS 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.