pyACA: Documentation 0.3.1
Source Code for Audio Content Analysis
Loading...
Searching...
No Matches
Functions
pyACA.ToolFreq2Bin Namespace Reference

helper function: convert Hz to bin (still floating point) More...

Functions

 ToolFreq2Bin (fInHz, iFftLength, f_s)
 

Detailed Description

helper function: convert Hz to bin (still floating point)

Args: fInHz: The frequency to be converted, can be scalar or vector iFftLength: length of the Fft (time domain block size) f_s: sample rate

Returns: bin

Function Documentation

◆ ToolFreq2Bin()

ToolFreq2Bin ( fInHz,
iFftLength,
f_s )

Definition at line 17 of file ToolFreq2Bin.py.

17def ToolFreq2Bin(fInHz, iFftLength, f_s):
18 def acaFreq2Bin_scalar_I(f, iFftLength, f_s):
19 return f / f_s * iFftLength
20
21 f = np.asarray(fInHz)
22 if f.ndim == 0:
23 return acaFreq2Bin_scalar_I(f, iFftLength, f_s)
24
25 fBin = np.zeros(f.shape)
26 for k, fk in enumerate(f):
27 fBin[k] = acaFreq2Bin_scalar_I(fk, iFftLength, f_s)
28
29 return fBin