You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document that octavefilter uses time-domain fractional-octave bands rather than FFT bins, and add a Welch example for mapping narrowband bins to band edges.
10.[🧪 Testing and Quality](#-development-and-verification)
49
+
-[🧪 Development and Verification](#-development-and-verification)
42
50
-[Test Categories](#test-categories)
43
51
-[Commands](#commands)
52
+
-[Author](#author)
44
53
45
54
---
46
55
@@ -84,7 +93,7 @@ All core functionality can be imported directly from the `pyoctaveband` package.
84
93
|`time_weighting`|`function`|**Energy capture.**<br>• `x`: Raw signal array (squared internally)<br>• `fs`: Sample rate [Hz]<br>• `mode`: 'fast', 'slow', or 'impulse' |`env = time_weighting(x, fs, mode='fast')`<br><br>• `env`: 1D array of energy envelope (Mean Square) |
85
94
|`linkwitz_riley`|`function`|**Audio crossover.**<br>• `x`: Signal array<br>• `fs`: Sample rate [Hz]<br>• `freq`: Crossover frequency [Hz]<br>• `order`: Any even number (Default: 4) |`lo, hi = linkwitz_riley(x, fs, freq=1000, order=4)`<br><br>• `lo`: Low-pass filtered signal<br>• `hi`: High-pass filtered signal |
|`getansifrequencies`|`function`|**ANSI Frequency generator.**<br>• `fraction`: 1, 3, etc. (Required)<br>• `limits`: [f_min, f_max] (Default: [12, 20000]) |`f_cen, f_low, f_high= getansifrequencies(fraction=3)`<br><br>• `f_cen`: List of center frequencies [Hz]<br>• `f_low`: List of lower edges [Hz]<br>• `f_high`: List of upper edges [Hz]|
96
+
|`getansifrequencies`|`function`|**ANSI Frequency generator.**<br>• `fraction`: 1, 3, etc. (Required)<br>• `limits`: [f_min, f_max] (Default: [12, 20000]) |`f_cen, f_low, f_high, labels = getansifrequencies(fraction=3)`<br><br>• `f_cen`: List of center frequencies [Hz]<br>• `f_low`: List of lower edges [Hz]<br>• `f_high`: List of upper edges [Hz]<br>• `labels`: IEC nominal frequency labels|
88
97
|`normalizedfreq`|`function`|**Standard IEC Frequencies.**<br>• `fraction`: 1 or 3 |`freqs = normalizedfreq(fraction=3)`<br><br>• `freqs`: List of standard center frequencies [Hz]|
`octavefilter` is a **time-domain fractional-octave filter bank**, not an FFT or Welch spectrum estimator. Therefore, its result does not have a frequency resolution in the `fs / nfft` sense.
437
+
438
+
For `fraction=3`, the output contains one scalar level per third-octave band. The relevant frequency granularity is the standardized band definition: center frequency, lower edge, and upper edge. Because fractional-octave bands are logarithmically spaced, their absolute bandwidth in Hz grows with frequency while their relative bandwidth remains approximately constant.
439
+
440
+
For example, with `fraction=3` and `limits=[12, 20000]`, the exact third-octave band around 1 kHz is approximately:
441
+
442
+
| Nominal band | Lower edge | Center | Upper edge | Bandwidth |
print("Welch bin spacing:", freq_bins[1] - freq_bins[0], "Hz")
494
+
for f, pxx inzip(freq_bins[in_band], psd[in_band]):
495
+
print(f, pxx)
496
+
```
497
+
498
+
This keeps the two concepts separate: PyOctaveBand gives standardized fractional-octave levels, while Welch gives narrowband FFT bins. With `fs=100000` and `nperseg=2**15`, the Welch bin spacing is about `3.05 Hz`. Window choice and overlap affect leakage and averaging variance, but they do not change the bin spacing of each FFT segment.
499
+
500
+
When `sigbands=True`, `octavefilter` can also return the time-domain waveform filtered by each band. Applying Welch/FFT to one selected filtered waveform can be useful as a diagnostic view of the content inside that filtered band, but it does not recover FFT bins from the scalar band levels.
501
+
425
502
### Magnitude Responses |H(jw)|
426
503
The library implements standard classical filter prototypes:
0 commit comments