Closed qarmin closed 1 year ago
Hello! Thanks for trying out this library!
Music file with invalid numbers of channel, crashes internally instead returning error
This was fixed for a while now when I implemented resampling, but wasn't published to crates.io - I've just released a new version including some bugfixes.
Sample rate is 11025 which seems to be 44100 / 4, but why not just 44100? Also looks that this value cannot be regulated per file
11025 is used in the original implementation and may not be easy to change since there are some hardcoded parameters that would require tuning. However, resampling is implemented now so it should work with any sample rate.
When it comes to your test application, the Fingerprinter::consume
accepts a slice of samples so you need another crate to decode your file first. Symphonia is pure Rust and supports many formats, including MP3s. I created a small example using it here.
I improved the documentation slightly and I hope to extend it further this weekend.
I updated to latest version, but cannot test output quality due crash, music files which cause this - test.zip
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `358`,
right: `492`', /home/rafal/.cargo/git/checkouts/rusty-chromaprint-a12bb360ca835070/96a9591/chromaprint/src/fingerprint_matcher.rs:213:9
stack backtrace:
0: rust_begin_unwind
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/panicking.rs:64:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
4: rusty_chromaprint::fingerprint_matcher::match_fingerprints
5: test::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
https://github.com/darksv/rusty-chromaprint/tree/main/compare - should be available as crate feature, because for now I just copy paste calc_fingerprint into project(I don't really see a reason, why I would need to reimplement this function)
@qarmin, sorry for late respond, but I didn't manage to work on this last week.
I updated to latest version, but cannot test output quality due crash
This panic should be fixed now. I checked your test files and it seems to work. Thanks.
https://github.com/darksv/rusty-chromaprint/tree/main/compare - should be available as crate feature, because for now I just copy paste calc_fingerprint into project(I don't really see a reason, why I would need to reimplement this function)
Sure. I can add this function in the future version.
This two songs Music.zip - crashes with preset_test4
and preset_test5
in calc_fingerprint
(source code TestRustyChromaprint.zip )
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/rafal/.cargo/git/checkouts/rusty-chromaprint-a12bb360ca835070/ad1a81c/chromaprint/src/fingerprint_calculator.rs:14:78
stack backtrace:
test_preset_2
with other presets numbers are still quite low ~1.5)thread '
' panicked at 'called Option::unwrap()
on aNone
value', /home/rafal/.cargo/git/checkouts/rusty-chromaprint-a12bb360ca835070/ad1a81c/chromaprint/src/fingerprint_calculator.rs:14:78
Thanks, I'll look into this.
Configuration presets in calc_fingerprint and match fingerprints should be same or can be different?
Right now it doesn't matter, because the config is not used in match_fingerprints
. It might change at some point, so it should be the same.
If I understand correctly - 0 means almost no difference between fingerprints and 32(or 10) means maximum diff? (In documentation there is number 32, but in reality I only get max 9.99)
Segments with score above 10 are automatically rejected. I probably should make it configurable, though.
How to deal with false positives? A lot of music files returns 0 when comparing them with each other(like this two from above), but they are completely different (tested with test_preset_2 with other presets numbers are still quite low ~1.5)
For these two files I got a single segment that is 2 seconds long, so I'd say there is not much similarity between them. Ideally for two different files with the same song you'll get a single segment that lasts as long as that song.
For these two files I got a single segment that is 2 seconds long, so I'd say there is not much similarity between them. Ideally for two different files with the same song you'll get a single segment that lasts as long as that song.
Where can I find info about segment length?
Segment { offset1: 1631, offset2: 1499, items_count: 16, score: 0.0 }
Use Segment::duration
. It converts items_count
to seconds based on the configuration.
I already started to use this library, so initial sentence that I don't know how to use it, is no more valid
When trying to test this project, I noticed few problems
Most of examples how to use this, I found directly in tests inside code in
src
folder insteadexamples
Music file with invalid numbers of channel, crashes internally instead returning error
Number of channels returned by lofty sometimes cause crashes(so or lofty or this library not properly handle number of channels)
Sample rate is
11025
which seems to be44100 / 4
, but why not just 44100? Also looks that this value cannot be regulated per fileI tested some music files(remixes etc.) with this library(11025 sample rate, 1 channel - to not have crash, multiple configurations) but always results were similar for each compared music files(usually results - completely different songs and also remixes - differs in max ~1)
Project which I used to test TestRustyChromaprint.zip