mirror of
https://github.com/correl/dejavu.git
synced 2024-11-23 11:09:52 +00:00
Added tuning section to README.md. Removed trailing space from fingerprint.py
This commit is contained in:
parent
efe3a33915
commit
4d2b91b052
2 changed files with 24 additions and 11 deletions
13
README.md
13
README.md
|
@ -100,6 +100,19 @@ An example configuration is as follows:
|
|||
>>> djv = Dejavu(config)
|
||||
```
|
||||
|
||||
## Tuning
|
||||
|
||||
Inside `fingerprint.py`, you may want to adjust following parameters (some values are given below).
|
||||
|
||||
FINGERPRINT_REDUCTION = 30
|
||||
PEAK_SORT = False
|
||||
DEFAULT_OVERLAP_RATIO = 0.4
|
||||
DEFAULT_FAN_VALUE = 10
|
||||
DEFAULT_AMP_MIN = 15
|
||||
PEAK_NEIGHBORHOOD_SIZE = 30
|
||||
|
||||
These parameters are described in the `fingerprint.py` in detail. Read that in-order to understand the impact of changing these values.
|
||||
|
||||
## Recognizing
|
||||
|
||||
There are two ways to recognize audio using Dejavu. You can recognize by reading and processing files on disk, or through your computer's microphone.
|
||||
|
|
|
@ -12,8 +12,8 @@ IDX_TIME_J = 1
|
|||
|
||||
######################################################################
|
||||
# Sampling rate, related to the Nyquist conditions, which affects
|
||||
# the range frequencies we can detect.
|
||||
DEFAULT_FS = 44100
|
||||
# the range frequencies we can detect.
|
||||
DEFAULT_FS = 44100
|
||||
|
||||
######################################################################
|
||||
# Size of the FFT window, affects frequency granularity
|
||||
|
@ -23,15 +23,15 @@ DEFAULT_WINDOW_SIZE = 4096
|
|||
# Ratio by which each sequential window overlaps the last and the
|
||||
# next window. Higher overlap will allow a higher granularity of offset
|
||||
# matching, but potentially more fingerprints.
|
||||
DEFAULT_OVERLAP_RATIO = 0.5
|
||||
DEFAULT_OVERLAP_RATIO = 0.5
|
||||
|
||||
######################################################################
|
||||
# Degree to which a fingerprint can be paired with its neighbors --
|
||||
# higher will cause more fingerprints, but potentially better accuracy.
|
||||
DEFAULT_FAN_VALUE = 15
|
||||
# higher will cause more fingerprints, but potentially better accuracy.
|
||||
DEFAULT_FAN_VALUE = 15
|
||||
|
||||
######################################################################
|
||||
# Minimum amplitude in spectrogram in order to be considered a peak.
|
||||
# Minimum amplitude in spectrogram in order to be considered a peak.
|
||||
# This can be raised to reduce number of fingerprints, but can negatively
|
||||
# affect accuracy.
|
||||
DEFAULT_AMP_MIN = 10
|
||||
|
@ -39,13 +39,13 @@ DEFAULT_AMP_MIN = 10
|
|||
######################################################################
|
||||
# Number of cells around an amplitude peak in the spectrogram in order
|
||||
# for Dejavu to consider it a spectral peak. Higher values mean less
|
||||
# fingerprints and faster matching, but can potentially affect accuracy.
|
||||
# fingerprints and faster matching, but can potentially affect accuracy.
|
||||
PEAK_NEIGHBORHOOD_SIZE = 20
|
||||
|
||||
######################################################################
|
||||
# Thresholds on how close or far fingerprints can be in time in order
|
||||
# Thresholds on how close or far fingerprints can be in time in order
|
||||
# to be paired as a fingerprint. If your max is too low, higher values of
|
||||
# DEFAULT_FAN_VALUE may not perform as expected.
|
||||
# DEFAULT_FAN_VALUE may not perform as expected.
|
||||
MIN_HASH_TIME_DELTA = 0
|
||||
MAX_HASH_TIME_DELTA = 200
|
||||
|
||||
|
@ -56,7 +56,7 @@ MAX_HASH_TIME_DELTA = 200
|
|||
PEAK_SORT = True
|
||||
|
||||
######################################################################
|
||||
# Number of bits to throw away from the front of the SHA1 hash in the
|
||||
# Number of bits to throw away from the front of the SHA1 hash in the
|
||||
# fingerprint calculation. The more you throw away, the less storage, but
|
||||
# potentially higher collisions and misclassifications when identifying songs.
|
||||
FINGERPRINT_REDUCTION = 20
|
||||
|
@ -137,7 +137,7 @@ def generate_hashes(peaks, fan_value=DEFAULT_FAN_VALUE):
|
|||
[(e05b341a9b77a51fd26, 32), ... ]
|
||||
"""
|
||||
fingerprinted = set() # to avoid rehashing same pairs
|
||||
|
||||
|
||||
if PEAK_SORT:
|
||||
peaks.sort(key=itemgetter(1))
|
||||
|
||||
|
|
Loading…
Reference in a new issue