3

I'm currently investigating dejavu.py (some more info), and I must say that I am quite impressed by it so far. Though I do find that the docs are a bit incomplete when it comes to user interfacing.
When you recognise a song from file with oDjv.recognize(FileRecognizer, sFile), you get returned a dictionary which looks like this:

{'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}

And from recording (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}

So, to the questions:
1) What exactly is confidence, and is there an upper bounds for the confidence level?

2) What is the difference between offset_seconds and offset?

3) Why does it take the algorithm somewhere between 30 and 60 seconds (in the case of all tests I ran) to identify the song from disk, but it can do it in 10 or so seconds when recording audio?

4) When running the function to record from audio, I get the following chunk of code preceding the actual output (even if successful) from the function. Where are we trying to go?

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) Is there an online music Database that I can just plug into the config?

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

oDjv = Dejavu(dConfig)
4

2 回答 2

6

您的大部分问题都可以在 Dejavu github README.md中找到,也可以在此处的文章和解释中找到。

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

  1. 在 Dejavu 中,confidence是当前音频剪辑中与数据库最接近匹配“对齐”的指纹哈希数。没有概率解释。请记住,每个音频文件可能有数千个指纹,因此请将其作为参考点。
  2. 它们是相同的持续时间,但单位不同。offset_seconds表示为秒,并offset表示为算法时间箱的长度
  3. Dejavu 以 3 倍的收听速度对大多数歌曲进行指纹识别。因此,一首 3 分钟的歌曲可能需要比它听 10 秒的短音频片段更长的时间。您可以通过使用 which listeners 5 秒而不是默认的 10 秒来调整默认命令行麦克风识别需要多长时间python dejavu.py --recognize mic 5。仅供参考,该库的最佳选项之一是您还可以更改 Dejavu 用于 on- 的秒数使用密钥在JSON 配置文件中识别磁盘。fingerprint_limit
  4. 您的安装有问题,或者您使用的虚拟机不知道如何录制音频并将其放入pyaudio. 在您的情况下,请参阅此解决方案,也许它可能会有所帮助。
  5. 没有在线音乐数据库,您插入自己的 MySQL 或(很快)PostgreSQL并记录自己的指纹。Dejavu 旨在识别各种预先录制的音频。另外,每个用户的需求都不同。想要以牺牲大多数指纹为代价进行更准确的指纹识别?提高DEFAULT_FAN_VALUE. 需要更高的碰撞保证但不介意额外的存储成本?您可以减少FINGERPRINT_REDUCTION并保留每个 SHA-1 的更多字符。Dejavu 旨在适应许多不同的用例,这必然意味着如果您更改此文件中的指纹参数,您的数据库将具有不同的分布和结构。
于 2015-05-18T13:40:34.843 回答
2

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

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

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

@tkhurana96,对不起,我还没有回复评论的声誉,但希望这可以为你澄清事情。

于 2018-02-12T01:22:41.703 回答