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

Functions

 FeatureTimeAcfCoeff (x, iBlockLength, iHopLength, f_s, eta=19)
 computes the ACF coefficients of a time domain signal
 

Function Documentation

◆ FeatureTimeAcfCoeff()

FeatureTimeAcfCoeff ( x,
iBlockLength,
iHopLength,
f_s,
eta = 19 )

computes the ACF coefficients of a time domain signal

Parameters
xarray with floating point audio data (dimension samples x channels)
iBlockLengthblock length in samples
iHopLengthhop length in samples
f_ssample rate of audio data
etaindex (or vector of indices) of coeff result
Returns
vacf: autocorrelation coefficient
t: time stamp

Definition at line 17 of file FeatureTimeAcfCoeff.py.

17def FeatureTimeAcfCoeff(x, iBlockLength, iHopLength, f_s, eta=19):
18
19 # create blocks
20 xBlocks, t = pyACA.ToolBlockAudio(x, iBlockLength, iHopLength, f_s)
21
22 # number of results
23 iNumOfBlocks = xBlocks.shape[0]
24 if np.isscalar(eta):
25 iNumOfResultsPerBlock = 1
26 else:
27 iNumOfResultsPerBlock = eta.size
28
29 # allocate memory
30 vacf = np.zeros([iNumOfResultsPerBlock, iNumOfBlocks])
31
32 for n, block in enumerate(xBlocks):
33 # calculate the acf
34 if not block.sum():
35 vacf[np.arange(0, iNumOfResultsPerBlock), n] = np.zeros(iNumOfResultsPerBlock)
36 continue
37 else:
38 afCorr = np.correlate(block, block, "full") / np.dot(block, block)
39
40 # find the coefficients specified in eta
41 vacf[np.arange(0, iNumOfResultsPerBlock), n] = afCorr[iBlockLength + eta]
42
43 return vacf, t