bins or bins_per_octave - inconsistent scale behavior
sevagh opened this issue · 1 comments
sevagh commented
Hello,
I'm wondering about the design choice that bins can be bins per octave:
- OctScale(x, y, 12) will create an arbitrary amount of bins (computed by the limits of fmin and fmax). For one example on my input signals, OctScale(32.7, 22050, 12) creates 123 frequency bins
- Non-oct scale (log, mel) will use the input as the exact number of output bins - bins=12 input means 12 bins output
So, ultimately OctScale(32.7, 22050, 12)
and MelScale(32.7, 22050, 12)
end up with 123 and 12 frequency bins respectively.
Is there a way we can have the OctScale use the bins as the actual n_bins output, and not bins_per_octave?
sevagh commented
It looks like, actually, LogScale
is equivalent to the oct scale with more direct bin control:
>>> fmin = 32.7
>>> fmax = 22050
>>>
>>> import nsgt
>>> o = nsgt.OctScale(fmin, fmax, 12)
>>> print(len(o()[0]))
114
>>>
>>> l = nsgt.LogScale(fmin, fmax, 114)
>>> print(len(l()[0]))
114
>>>
>>> import numpy
>>> numpy.allclose(l()[0], o()[0])
True
>>>
>>> numpy.allclose(l()[1], o()[1])
True
Same Q and frequency bands.