worldveil / dejavu

Audio fingerprinting and recognition in Python
MIT License
6.36k stars 1.43k forks source link

sure you want neg inf with zero? #118

Closed fommil closed 5 years ago

fommil commented 7 years ago
    # apply log transform since specgram() returns linear array
    arr2D = 10 * np.log10(arr2D)
    arr2D[arr2D == -np.inf] = 0  # replace infs with zeros

0 is quite a high number here (it will be more significant than most of your data points and therefore introduce a lot of false peaks). In my own code I've been thresholding before the log, e.g.

        data[data < 1e-8] = 1e-8
        data = np.log10(data)

which gives more control where the cut-off is. It's hard to say what the threshold cutoff should be.