dejavu.py 识别的歌曲的附加信息

Additional information for songs recognised by dejavu.py

我目前正在调查 dejavu.py (some more info),我必须说到目前为止我对它印象深刻。虽然我确实发现文档在用户界面方面有点不完整。
当您从带有 oDjv.recognize(FileRecognizer, sFile) 的文件中识别出一首歌曲时,您会返回一个如下所示的字典:

{'song_id': 2, 'song_name': 'Sean-Fournier--Falling-For-You', 'file_sha1': 'A9D18B9B9DAA467350D1B6B249C36759282B962E', 'confidence': 127475, 'offset_seconds': 0.0, 'match_time': 32.23410487174988, 'offset': 0}

并且来自录音 (oDjv.recognize(MicrophoneRecognizer, seconds=iSecs)):

{'song_id': 2, 'song_name': 'Sean-Fournier--Falling-For-You', 'file_sha1': 'A9D18B9B9DAA467350D1B6B249C36759282B962E', 'confidence': 124, 'offset_seconds': 24.89179, 'offset': 536}

所以,对于问题
1) confidence 到底是什么,置信度是否有上限?

2) offset_secondsoffset有什么区别?

3) 为什么算法需要 30 到 60 秒之间的某处(在所有测试的情况下我 运行)从磁盘识别歌曲,但它可以在 10 秒左右完成录音时?

4) 当 运行 从音频录制的函数时,我在函数的实际输出(即使成功)之前得到以下代码块。我们要去哪里?

ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started

5) 是否有可以直接插入配置的在线音乐数据库?

dConfig = {
    "database": {
        "host": "some magical music database",
        "user": "root",
        "passwd": "", 
        "db": "dejavu"
    }
}

oDjv = Dejavu(dConfig)

您的大部分问题都可以在 Dejavu github README.md or by the writeup and explanation here.

中找到

但要回答您的每个编号问题:

  1. 在 Dejavu 中,confidence 是当前音频剪辑中 "aligned" 与数据库最接近匹配的指纹哈希数。没有概率解释。请记住,每个音频文件可能有数千个指纹,因此请将其作为参考点。
  2. 它们是相同的持续时间,但单位不同。 offset_seconds表示为秒,offset表示为length of the algorithm's time bins
  3. Dejavu 以 3 倍的收听速度对大多数歌曲进行指纹识别。因此,一首 3 分钟的歌曲可能比听一段 10 秒的短音频片段需要更长的时间。您可以使用 python dejavu.py --recognize mic 5 来调整默认命令行麦克风识别所花费的时间,它会监听 5 秒而不是默认的 10 秒。仅供参考,该库的最佳选择之一是您还可以更改秒数Dejavu 在 JSON config file 中使用 fingerprint_limit 键进行磁盘识别。
  4. 您的安装有问题,或者您使用的虚拟机不知道如何录制音频并将其导入 pyaudio。在您的情况下,请参阅 this solution,也许它可能会有所帮助。
  5. 没有在线音乐数据库,您插入自己的 MySQL 或(很快)PostgreSQL and record your own fingerprints. Dejavu is meant for recognizing all sorts of pre-recorded audio. Plus, each user's needs are different. Want more accurate fingerprinting at the expense of most fingerprints? Raise the DEFAULT_FAN_VALUE. Need higher collision guarantees but don't mind the extra storage cost? You can decrease the FINGERPRINT_REDUCTION and keep more characters of each SHA-1. Dejavu is meant to adapt to many different use cases which necessarily means that if you change fingerprinting parameters in this file 您的数据库将有不同的分布和结构。

一切都已经很好地回答了,只是进一步澄清 1)。

每个文件有数千个指纹的原因是因为 Dejavu 试图根据声音识别歌曲,而不考虑歌曲样本的长度、样本在歌曲中的位置或可能存在的任何噪音录音(它试图实现与 Shazam 试图实现的相同目的)。每个指纹都是由音频内容本身的多个数据样本组成的,从而导致潜在的大量指纹。 Dejavu 有很多影响指纹大小和数量的旋转因素,可以根据自己的要求进行微调。

如果我们只为每个文件使用一个指纹,那么找到匹配项的唯一方法就是为它提供完全相同的文件。

@tkhurana96,抱歉,我还没有回复评论的资格,但希望这能为你澄清一些事情。