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
MelBands (when fed with the output of Spectrum) seems to work fine for low numbers of bands, e.g. 24 or 40. But if we increase this number to e.g. 128 or 256, it seems to (mistakenly) always return 0 for specific band numbers.
For instance when setting numberBands = 256, regardless of which audio file I analyze I get 0 in the following bands:
update: I think the issue lies with the computation of the start/end spectral bins for each band - if the FFT size is relatively small (e.g. 1024) and the number of mel bands is large (e.g. 128) then for some bands the start and end bin will be the same bin (or adjacent bins), which consequently results in 0 energy being summed at that band.
A practical solution is to use zero padding to increase the number of FFT bins thus avoiding the problem. Nonetheless, it would probably be helpful to run a check when the mel filterbank is created to ensure there are no bands with adjacent or identical start/end bins, and if any are detected print out a warning.
Similar to #142, throw exception when spectrum resolution is
insufficient. Previous code contained a workaround for such cases
but it seems better to report this issue instead.
- Improve the check for when to throw an exception due to
insufficient resolution of the input spectrum (#142). Previously,
rounding was used to find the closet spectrum bins for the start
and the end position of each filter, but it is better to use
ceil and floor. Throw the error if all filter coefficients are
zero instead of only checking if there's enough spectrum bins to
cover a filter.
- Optimize unit sum normalization. It is faster to do it in the same
loop when computing filter coefficients for a particular band.
- Some code style improvements
MelBands (when fed with the output of Spectrum) seems to work fine for low numbers of bands, e.g. 24 or 40. But if we increase this number to e.g. 128 or 256, it seems to (mistakenly) always return 0 for specific band numbers.
For instance when setting numberBands = 256, regardless of which audio file I analyze I get 0 in the following bands:
Here are some example spectrograms (of the log-melbands, ignore the y-axis labels):
![spec3](https://camo.githubusercontent.com/2e7af2e16f5fb66774a1c513964f6b61323eda4520b2a223e94a3706c56f9b16/687474703a2f2f6935372e74696e797069632e636f6d2f32616739346b792e706e67)
![spec1](https://camo.githubusercontent.com/8355659a8d2aa4d9226a5f98cdb2a4462f3636c0623a99c200506cbbcf032e3e/687474703a2f2f6936302e74696e797069632e636f6d2f327633686c78302e706e67)
![spec2](https://camo.githubusercontent.com/f008134a9579ab85d2837487ad06e8737297680a95bc02d1f72eca73c381cec4/687474703a2f2f6935392e74696e797069632e636f6d2f6a7a776368752e706e67)
The text was updated successfully, but these errors were encountered: