-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Q-factor too high for frequencies #18
Comments
Hi Ivan, high Q factors (high spectral resolution) need large frame sizes Am 31.07.2016 um 19:42 schrieb Ivan Cheung notifications@github.com: Hi, Many thanks for this great package. I'm using it for musical note analysis My code is thus: numBins = int(np.ceil(108 - 21)) I'm getting the following warning:
Thanks — |
Hi Thomas, Thanks for responding. I understand the need for more samples to support
qneeded = f_(Ls/(8._sr)) Where does the 8 come from? Is it kind of arbitrary right now? Thanks On Sun, Jul 31, 2016 at 3:47 PM, Thomas Grill notifications@github.com
|
@grrrr what do you think of adding the following code to the nsgt Scale class - I can submit the PR class Scale:
dbnd = 1.e-8
def __init__(self, bnds):
self.bnds = bnds
def __len__(self):
return self.bnds
def Q(self, bnd=None):
# numerical differentiation (if self.Q not defined by sub-class)
if bnd is None:
bnd = np.arange(self.bnds)
return self.F(bnd)*self.dbnd/(self.F(bnd+self.dbnd)-self.F(bnd-self.dbnd))
def __call__(self):
f = np.array([self.F(b) for b in range(self.bnds)],dtype=float)
q = np.array([self.Q(b) for b in range(self.bnds)],dtype=float)
return f,q
def suggested_sllen(self, sr):
f,q = self()
Ls = int(np.ceil(max((q*8.*sr)/f)))
# make sure its divisible by 4
Ls = Ls + -Ls % 4
return Ls The way to use it is to get the suggested sllen that supports your desired frequencies and Q factors (from which you can get trlen for slicq) - the same should apply for the length argument to the non-sliced transform: scl = LogScale(fmin, fs/2, fbins)
# use slice length required to support desired frequency scale/q factors
sllen = scl.suggested_sllen(fs)
# optional trlen for sliced-q, otherwise Ls=sllen
trlen = sllen//4
trlen = trlen + -trlen % 2 # make trlen divisible by 2 |
Hi,
Many thanks for this great package. I'm using it for musical note analysis and thus I'm putting in the minimum frequency as midi2hz(21) and the maximum as midi2hz(108). 21 and 108 are the lowest and highest notes on a piano respectively, in midi format, and midi2hz converts midi values to Hertz.
My code is thus:
I'm getting the following warning:
UserWarning: Q-factor too high for frequencies 27.50,29.10,30.78,32.57,34.46,36.46,38.58,40.82,43.19,45.69,48.35,51.15,54.12,57.26,60.59,64.10,67.82,71.76,75.92,80.33,84.99,89.93,95.15,100.67,106.51,112.69,119.23,126.15,133.48,141.22,149.42,158.09,167.27,176.98,187.25 warn("Q-factor too high for frequencies %s"%",".join("%.2f"%fi for fi in f[q >= qneeded]))
Thanks
The text was updated successfully, but these errors were encountered: