Giter Site home page Giter Site logo

jorensix / panako Goto Github PK

View Code? Open in Web Editor NEW
175.0 175.0 34.0 57.29 MB

The Panako acoustic fingerprinting system.

License: GNU Affero General Public License v3.0

Shell 0.47% Java 90.36% HTML 0.50% Ruby 5.70% Gnuplot 0.16% Dockerfile 0.28% TeX 2.19% Python 0.33%
acoustic-fingerprinting audio-processing duplicate-detection music-information-retrieval

panako's People

Contributors

jorensix avatar simran-b avatar wardva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

panako's Issues

Unbale to build Panako library: Compile error

After running ant in the Panako/build directory this is what occurs

Buildfile: /root/Panako/build/build.xml

compile:
[javac] Compiling 87 source files to /root/Panako/bin
[javac] /root/Panako/src/be/panako/util/StopWatch.java:142: error: unmappable character for >encoding ASCII
[javac] formatString = "%.2f ??s";
[javac] ^
[javac] /root/Panako/src/be/panako/util/StopWatch.java:142: error: unmappable character for >encoding ASCII
[javac] formatString = "%.2f ??s";
[javac] ^
[javac] 2 errors

BUILD FAILED

panako store process hangs indefinitely

When storing a large file (over 2 hours). With AVAILABLE_PROCESSORS=0
It looks like the java process goes to sleep midway through.
Running strace on the PID gives this message:

futex(0x7fe0b8229078, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY

Is this a thread deadlocking issue?

Main thread hangs in java.io.FileInputStream.readBytes

Panako can succesfully store all my MP3 collection, except a few MP3 files (that are perfectly playable) that makes it hang forever.
Here one of the MP3 files in question : https://mega.nz/file/pKFVDAyb#vtjUcy2UfDPt5SJMl7HFTRsnZxFC3vRG_Cqyo0w8fGE

[0] % panako store "Blondie - Maria.mp3"
Audiofile;Audio duration;Fingerprinting duration;ratio

I've extracted the main thread stacktrace with Mission Control:

main [1] (RUNNABLE)
   java.io.FileInputStream.readBytes line: not available [native method]
   java.io.FileInputStream.read line: 276 
   java.io.BufferedInputStream.read1 line: 282 
   java.io.BufferedInputStream.read line: 343 
   java.io.BufferedInputStream.fill line: 244 
   java.io.BufferedInputStream.read1 line: 284 
   java.io.BufferedInputStream.read line: 343 
   be.tarsos.dsp.io.UniversalAudioInputStream.read line: 54 
   be.tarsos.dsp.AudioDispatcher.readNextAudioBlock line: 399 
   be.tarsos.dsp.AudioDispatcher.run line: 286 
   be.panako.strategy.olaf.OlafStrategy.toFingerprints line: 212 
   be.panako.strategy.olaf.OlafStrategy.toFingerprints line: 167 
   be.panako.strategy.olaf.OlafStrategy.store line: 97 
   be.panako.cli.Store$StoreTask.run line: 128 
   be.panako.cli.Store.run line: 74 
   be.panako.cli.Panako.actuallyReallyStartApplication line: 234 
   be.panako.cli.Panako.actuallyStartApplication line: 213 
   be.panako.cli.Panako.startApplication line: 155 
   be.panako.cli.Panako.main line: 329 

The same freeze (in java.io.FileInputStream.readBytes) is happening with panako print "Blondie - Maria.mp3".

Some informations about my machine:

salomonbrys@Salomons-MacBook-Pro ‹ master › : ~/Code/clones/Panako
[0] % uname -a
Darwin Salomons-MacBook-Pro.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 x86_64 i386 Darwin

salomonbrys@Salomons-MacBook-Pro ‹ master › : ~/Code/clones/Panako
[0] % git show-ref HEAD
c2cd1cfe2305d1c933e7753a6823d2df4fb0c469 refs/remotes/origin/HEAD

salomonbrys@Salomons-MacBook-Pro ‹ master › : ~/Code/clones/Panako
[0] % java -version
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)

Can you give more information about settings for strategy NFFT?

Hello,
Can you give more information about settings for strategy NFFT?
I try use panako for detecting patterns in phone calls. For detecting answering machines by audio records.
And I cannot found any addityonal information about this parametrs.

Now I try found best settings for my task using algorithm Simulated annealing.

	/**
	 * The name of the MapDB database location.
	 */
	NFFT_MAPDB_DATABASE("/opt/panako/dbs/nfft_panako_db"),
	/**
	 * The sample rate of the input signal
	 */
	NFFT_SAMPLE_RATE(8000),	
	/**
	 * The size of the audio block and consequently the size (in samples) of the FFT.
	 */
	NFFT_SIZE(512),
	/**
	 * The size of the audio block step size (in samples).
	 */
	NFFT_STEP_SIZE(256),
	
	/**
	 * Allows only  a limited amount of event points each frame.
	 * Especially useful for percussive onsets.
	 */
	NFFT_EVENT_POINTS_MAX_PER_FFT_FRAME(3),

	/**
	 * Minium euclidean distance between event points. 
	 * The value is expressed in milliseconds cents
	 */
	NFFT_EVENT_POINT_MIN_DISTANCE(600),
	/**
	 * The maximum number of fingerpints per event points (fan-out).
	 */
	NFFT_MAX_FINGERPRINTS_PER_EVENT_POINT(2),
	
	
	/**
	 * The size of the Min filter halve of the MIN/MAX filter for 
	 * spectral peak detection, it should be odd.
	 */
	NFFT_MIN_FILTER_WINDOW_SIZE(7),
	/**
	 * The size of the MAX filter halve of the MIN/MAX filter for 
	 * spectral peak detection, it should be odd.
	 */
	 NFFT_MAX_FILTER_WINDOW_SIZE(15),
	 
	 /**
	 * Use a hash based on refined pitch estimates using the phase
	 * or not.
	 */
	NFFT_USE_PHASE_REFINED_HASH("FALSE"),

gradle test fails due to wrong DATASET_URL

TestData.java
private static final String DATASET_URL = "https://panako.be/releases/Panako-test-dataset/"

it should be:
private static final String DATASET_URL = "https://0110.be/releases/Panako/Panako-test-dataset/"

However, the main problem is having a dependency on a remote web server which makes a test not repeatable (The R in F.I.R.S.T) under certain conditions.
As Robert Martin writes in Clean Code:

Tests should be repeatable in any environment [...] and on your laptop while riding home on the train without network

Caching partially solves this problem, I would add the required files in the repo since the build fails without working tests.

create_dataset.rb doesn't work with Ruby 3.2.x

I tried to run the script resources/scripts/create_test_dataset/create_dataset.rb with Ruby 3.2.2, but it failed:

> ruby create_dataset.rb 
create_dataset.rb:79:in `<main>': undefined method `exists?' for File:Class (NoMethodError)

FileUtils.mkdir_p(QUERY_FOLDER) unless File.exists? QUERY_FOLDER
                                           ^^^^^^^^
Did you mean?  exist?

This is because using exists? is deprecated since Ruby 2.1 and was removed in 3.2: https://stackoverflow.com/a/75353113
After downgrading the version to Ruby 3.1.4 it works.

Multiple Store

I was wondering if we may create multiple named store with panako. Basically multiple buckets possibility under single store which can be accessed by name with the store command.

PanakoStrategy Query Logic - allow duplicate fingerprint hash?

Possible minor refactoring to improve the recognition rate.

Testing Result
Playing around with whether a duplicate fingerprint hash is processed produced an unexpected improvement in the recognition rate when duplicate fingerprints are not considered. However, this might not suit all use cases for the query algorithm.

Suggestion
Add a boolean flag to allow duplicate fingerprints or not. See pseudocode below:

//query
for(PanakoFingerprint print : prints) {
	long hash = print.hash();
        hashNotADuplicate = // add duplicate logic  
        if(allowDuplicates || hashNotADuplicate) {
	    db.addToQueryQueue(hash);
        }
	printMap.put(hash, print);
}

Sync Match Duration

Hi All,

I have tried panako for sync and its working find. I am facing an issue its not giving matched duration.
So is there is any way that I can get duration of matched content.
I am using NFFT recognition with sync process.

Panako doesn't recognize pitch and speed differences

I tried Panako to compare 2 audios which are

  1. different with pitch (I used ([https://vocalremover.org]) to change pitch), but Panako didn't recognize it.
  2. different with speed (I used [https://vocalremover.org] to change speed), but they haven't recognized as well.

I think the problem here can be peak picking algorithm. Because when I print triplets, all peaks are different in some examples with frequency and in some examples with time. What can be a problem?. Because the paper which describes Panako assures that type of differences are catchable.

Not working on Debian buster

Hi Joren,
First of all, thanks for this amazing work.

I wanted to ask you if you could help me making panako work in debian buster. I've make it work on ubuntu:20.04 flawlessly but it fails on debian when running panako store test/be/panako/tests/res/11266.mp3 STRATEGY=PANAKO.

The error I get is that the execution hangs. If I call the .jar file directly I obtain the following output:

java -jar build/panako-2.0.jar store test/be/panako/tests/res/11266.mp3 STRATEGY=PANAKO
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Mar 29, 2022 4:44:08 PM be.tarsos.dsp.io.PipeDecoder <init>
INFO: found ffmpeg on the path (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin). Will use ffmpeg for decoding media files.
Mar 29, 2022 4:44:08 PM be.panako.cli.Panako actuallyReallyStartApplication
INFO: Starting Panako application store with 1 arguments
Audiofile;Audio duration;Fingerprinting duration;ratio
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.lmdbjava.ByteBufferProxy$AbstractByteBufferProxy (file:/panako/build/panako-2.0.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of org.lmdbjava.ByteBufferProxy$AbstractByteBufferProxy
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Mar 29, 2022 4:44:08 PM be.tarsos.dsp.io.PipeDecoder getDecodedStream
INFO: Starting piped decoding process for /panako/test/be/panako/tests/res/11266.mp3
Mar 29, 2022 4:44:08 PM be.tarsos.dsp.io.PipeDecoder getDecodedStream
INFO:  with command: ffmpeg -hide_banner -loglevel panic -ss 0.0   -i "/panako/test/be/panako/tests/res/11266.mp3" -vn -ar 16000 -ac 1 -f s16le -acodec pcm_s16le pipe:1
Could not load jgaborator JNI library. Will attempt to use a version packed in the JAR archive
  info : no jgaborator in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]

Here is the Dockerfile for reproducibility:

FROM debian:buster #if we change it to FROM ubuntu:20.04 it works
RUN apt-get update && apt-get install -y --no-install-recommends git default-jdk ant ffmpeg
RUN git clone https://github.com/JorenSix/Panako.git /panako
ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
WORKDIR /panako/build
RUN ant && ant install && ant doc
RUN cp panako /usr/local/bin
RUN cp config.properties ~/.panako/
CMD panako store /panako/test/be/panako/tests/res/11266.mp3 STRATEGY=PANAKO

Thanks in advance!

Mac M1 Docker image fails to build, Native build does not process anything.

docker build -t panako:2.1 resources/scripts/

 => [internal] load build definition from Dockerfile                                                                                                              0.0s
 => => transferring dockerfile: 1.44kB                                                                                                                            0.0s
 => [internal] load .dockerignore                                                                                                                                 0.0s
 => => transferring context: 2B                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye                                                                                                1.9s
 => [auth] library/debian:pull token for registry-1.docker.io                                                                                                     0.0s
 => [ 1/26] FROM docker.io/library/debian:bullseye@sha256:1beb7cf458bdfe71b5220cb2069eb45e3fc7eb77a1ccfb169eaebf5f6c4809ab                                       12.0s
 => => resolve docker.io/library/debian:bullseye@sha256:1beb7cf458bdfe71b5220cb2069eb45e3fc7eb77a1ccfb169eaebf5f6c4809ab                                          0.0s
 => => sha256:1beb7cf458bdfe71b5220cb2069eb45e3fc7eb77a1ccfb169eaebf5f6c4809ab 1.85kB / 1.85kB                                                                    0.0s
 => => sha256:42336fd1e6984b68afbf5c44d2583e8eaba3b96ab4ecb89ac5f8cd9775f96f7f 529B / 529B                                                                        0.0s
 => => sha256:4c26a989498112aa2445f8b49116e71205127a096c51316cb029c48a178286bc 1.48kB / 1.48kB                                                                    0.0s
 => => sha256:e837d9f05c625de5b814b851adbc03559ba02ea7078f57c81a01e18fc65bf42b 53.70MB / 53.70MB                                                                 10.3s
 => => extracting sha256:e837d9f05c625de5b814b851adbc03559ba02ea7078f57c81a01e18fc65bf42b                                                                         1.6s
 => [ 2/26] RUN apt-get update                                                                                                                                    4.0s
 => [ 3/26] RUN apt-get install -y --no-install-recommends git default-jdk ffmpeg                                                                                71.8s
 => [ 4/26] RUN apt-get install -y --no-install-recommends make gcc g++ libc-dev                                                                                 15.7s
 => [ 5/26] RUN git clone --depth 1 https://git.openldap.org/openldap/openldap.git                                                                               13.6s
 => [ 6/26] WORKDIR /openldap/libraries/liblmdb                                                                                                                   0.0s
 => [ 7/26] RUN make                                                                                                                                              3.1s
 => [ 8/26] RUN mv liblmdb.so /lib/                                                                                                                               0.1s
 => [ 9/26] RUN git clone --depth 1 https://github.com/JorenSix/JGaborator                                                                                        1.6s
 => [10/26] WORKDIR /JGaborator/gaborator/                                                                                                                        0.0s
 => ERROR [11/26] RUN make                                                                                                                                        0.3s
------
 > [11/26] RUN make:
0.263 echo /usr/lib/jvm/default-java
0.264 /usr/lib/jvm/default-java
0.264 ruby precompile_for_targets.rb
0.264 make: ruby: No such file or directory
0.264 make: *** [Makefile:6: all] Error 127
------
Dockerfile:26
--------------------
  24 |     WORKDIR /JGaborator/gaborator/
  25 |     ENV JAVA_HOME=/usr/lib/jvm/default-java
  26 | >>> RUN make
  27 |     RUN cp ../build/precompiled/libjgaborator.so /lib/
  28 |
--------------------
ERROR: failed to solve: process "/bin/sh -c make" did not complete successfully: exit code: 2```

Building Panako from Dockerfile fails

Hi,

I think there's a problem with the code since building from Dockerfile fails. Could you help me with this?

> Task :compileJava FAILED
/Panako/src/main/java/be/panako/strategy/olaf/OlafStrategy.java:76: error: cannot find symbol
                        db = OlafStorageBtree.getInstance();
                             ^
  symbol:   variable OlafStorageBtree
  location: class OlafStrategy
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 21s
1 actionable task: 1 executed
Removing intermediate container 22d2644d2150
The command '/bin/sh -c ./gradlew shadowJar' returned a non-zero code: 1

Run on Windows

I am trying to run Panako on windows 10. So far I managed to compile using ant. Using store parameter with input mp3 from file.txt gives following output only

java -server -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xms256m -Xmx256m -Djava.util.logging.config.file=logging.properties -jar panako-2.0.jar store list.txt
Audiofile;Audio duration;Fingerprinting duration;ratio

stats command

java -server -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -Xms256m -Xmx256m -Djava.util.logging.config.file=logging.properties -jar panako-2.0.jar stats
Exception in thread "main" java.lang.IllegalArgumentException: Unknown result code 112
at org.lmdbjava.ResultCodeMapper.checkRc(ResultCodeMapper.java:111)
at org.lmdbjava.Env$Builder.open(Env.java:495)
at org.lmdbjava.Env$Builder.open(Env.java:512)
at be.panako.strategy.olaf.storage.OlafStorageKV.(Unknown Source)
at be.panako.strategy.olaf.storage.OlafStorageKV.getInstance(Unknown Source)
at be.panako.strategy.olaf.OlafStrategy.printStorageStatistics(Unknown Source)
at be.panako.cli.Stats.run(Unknown Source)
at be.panako.cli.Panako.actuallyReallyStartApplication(Unknown Source)
at be.panako.cli.Panako.actuallyStartApplication(Unknown Source)
at be.panako.cli.Panako.startApplication(Unknown Source)
at be.panako.cli.Panako.main(Unknown Source)

Can anyone help me to get it running in windows environment?

Could not create a lock file for the database.

Hey there,

I'm currently having trouble to get panako running. I'm getting the following error message when trying to store a first fingerprint of some random mp3:

Could not create a lock file for the database.
Please make sure that '/opt/panako/dbs/nfft_panako_db.lck' is writable.

I tested this in two different environments. The first one was my local installation on Mac OS. The second one was an Ubuntu based Docker container. I was able to run panako -v or panako config via the "java -jar /opt/panako/panako.jar" way you described. However I'm currently out of ideas what I still need to set up to make things working?

BTW: When I look into the /opt/panako directory I cannot see any folder named dbs.

Looking forward to hearing from you.

Cheers,
Julian

Monitor is hanging on big files

Hello all,

I'm using "monitor" from Panako to analyse big files of music (1-2 hours).
But after 10 minutes the process is hanging and never ends, the processor doesn't seem to be used anymore at this stage.

No exception is raised nor logged in the log files (I set the log configuration to "ALL"), and the last window analysed seemed to be random, even though it is always around the 1600th window analysed and about 10 minutes of computation. Cutting the file in small segments of 15 minutes and running "monitor" on each one of them solves the issue, but this is not convenient.

I'm using a custom configuration with Panako from @werthen's master thesis: https://lib.ugent.be/fulltxt/RUG01/002/494/859/RUG01-002494859_2018_0001_AC.pdf
I tried to find and increase the settings linked to stop conditions with no success so far. Here's the configuration I'm currently using:

STRATEGY=NCTEQ
MONITOR_STEP_SIZE=15
MONITOR_OVERLAP=14
NFFT_SIZE=512
NFFT_MIN_FILTER_WINDOW_SIZE=7
NFFT_USE_PHASE_REFINED_HASH=FALSE
NFFT_MAPDB_DATABASE=/home/mickael/Documents/programming/Panako/dbs/nfft_panako_db
NFFT_EVENT_POINTS_MAX_PER_FFT_FRAME=100
NFFT_STEP_SIZE=256
NFFT_MAX_FINGERPRINTS_PER_EVENT_POINT=100
NFFT_EVENT_POINT_MIN_DISTANCE=300
NFFT_SAMPLE_RATE=8000
NFFT_MAX_FILTER_WINDOW_SIZE=15
HTTP_SERVER_PORT=8080
META_DATA_COMMAND=/opt/panako/extract_metadata.sh
DECODER_PIPE_LOG_FILE=decoder_log.txt
SYNC_MIN_ALIGNED_MATCHES=7
CHECK_DUPLICATE_FILE_NAMES=TRUE
DECODER_PIPE_ENVIRONMENT=/bin/bash
AVAILABLE_PROCESSORS=0
SYNC_MARKER_TIME_ERROR_ALLOWED=10
PCH_SAMPLE_RATE=22050
DECODER_PIPE_BUFFER_SIZE=44100
PCH_SIZE=2048
DECODER_PIPE_ENVIRONMENT_ARG=-c
DECODER=PIPE
MAX_FILE_SIZE=2097152000
PCH_OVERLAP=1024
DECODER_PIPE_COMMAND=ffmpeg -ss %input_seeking% %number_of_seconds% -i "%resource%" -vn -ar %sample_rate% -ac %channels% -sample_fmt s16 -f s16le pipe:1
PCH_FILES=/home/mickael/Documents/programming/Panako/dbs/pch
SYNC_MARKER_LOUDNESS_DELTA=17
META_DATA_DIRECTORY=/opt/panako/metadata
SYNC_MARKER_MAX_TIMESTAMP=3
NCTEQ_MAPDB_DATABASE=/home/mickael/Documents/programming/Panako/dbs/cteq_panako_db_2
NCTEQ_SAMPLE_RATE=44100
NCTEQ_STEP_SIZE=1536
NCTEQ_MIN_FREQ=3700
NCTEQ_MAX_FREQ=12200
NCTEQ_BINS_PER_OCTAVE=36
NCTEQ_EVENT_POINTS_PER_SECOND_FOR_QUERY=400
NCTEQ_EVENT_POINTS_PER_SECOND_FOR_STORAGE=200
NCTEQ_EVENT_POINT_FREQUENCY_DELTA_MAX=1066
NCTEQ_EVENT_POINT_BRANCHING_FOR_STORAGE=200
NCTEQ_EVENT_POINT_BRANCHING_FOR_QUERY=600
NCTEQ_MAX_HASH_COLLISIONS=10000
NCTEQ_MINIMUM_MATCHES_THRESHOLD=0
NCTEQ_MINIMUM_ALIGNED_MATCHES_THRESHOLD=0

Am I missing a setting stopping the computation somehow? I increased NCTEQ_MAX_HASH_COLLISIONS, SYNC_MARKER_MAX_TIMESTAMP, and SYNC_MARKER_TIME_ERROR_ALLOWED with no impact on the issue. But it's hard to find the correct configuration as I didn't find any description of those settings.

./gradlew javadoc fails

> aren't properly encoded as &gt;. This leads to a failure, at least when using Java 11.

$ ./gradlew javadoc

> Task :javadoc
/Panako/src/main/java/be/panako/util/Key.java:113: error: bad use of '>'
         * So use a large number (> 50) to return all results
                                  ^
/Panako/src/main/java/be/panako/util/StopWatch.java:161: error: bad use of '>'
         * Return a formatted string for a time duration in seconds so from 61s => 1m:1s
                                                                                 ^
2 errors

> Task :javadoc FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':javadoc'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Panako/build/tmp/javadoc/javadoc.options'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
2 actionable tasks: 1 executed, 1 up-to-date

Path to docs in README wrong

The readme says the docs are in doc, but in fact they are in build/docs

./gradlew javadoc #Creates the documentation in doc

Not getting accurate matches with radio recordings

I'm having issues with matching. I'm using the default config. My use case includes recorded audio from FM radio stations. We know radio adds problems for audio fingerprinting and matching because of compression and distortion. However, the recordings are clear enough that I would expect at least a bit of a match. I've fingerprinted a few hundred studio WAV files into my database. Then I cut a song from a radio broadcast, the same song I have previously fingerprinted in my database with a studio WAV. I'm not getting matches and sometimes I see matches for different genres (E.g. A techno song matched to a hard rock song). To my ears the studio WAV I fingerprinted and the FM radio recording sound similar enough. Sure the radio has slight distortion and artifacts but there isn't a huge audible difference. I see a lot of settings in config.properties but I'm unsure what changes would help my situation. Any ideas? Thanks

PanakoStrategy.java typo Line 372?

In PanakoStrategy.java line 372 reads:

timeFactor < Config.getFloat(Key.PANAKO_MAX_FREQ_FACTOR)

Should read:

frequencyFactor < Config.getFloat(Key.PANAKO_MAX_FREQ_FACTOR)

PanakoStrategy Query logic - mostCommonDeltaTforHitList selects most common delta time by position in HashMap

Possible minor refactoring to improve the recognition rate.

Observation
A test against a set of audio tracks found that the PanakoStrategy.mostCommonDeltaTforHitList method will return the most common delta dependent on the number of occurrences. However, when more than one delta time has the same number of occurrences, the delta time returned is dependent on where it is stored in the HashMap, rather than a mathematical decision.

For example, for delta times x, y and z:
x with 1 occurrence
y with 2 occurrences
z with 3 occurrences

z is returned, but if x, y, and z delta times all have the same number of occurrences, which one is returned is dependent on chance - their position in the HashMap.

Suggestion
I don't know what mathematical decision is most suitable, but I tried taking the lowest delta time and this improved the recognition rate of the query. This is my quickly written alternative implementation of mostCommonDeltaTforHitList:

var timeDeltas = new ArrayList<TimeDeltaInfo>();

for(var queryMatch : queryMatches) {

  var foundTimeDelta = false;
  for(var timeDelta : timeDeltas) {
	  if(timeDelta.timeDelta == queryMatch.getTimeDelta()) {
		  timeDelta.count ++;
		  foundTimeDelta = true;
		  break;
	  }
  }
  if(!foundTimeDelta) {
	  timeDeltas.add(new TimeDeltaInfo(queryMatch.getTimeDelta()));
  }
}

// Get the time deltas with the highest number of occurrences at the top
timeDeltas.sort((a, b) -> b.count - a.count);

// Don't know what to do if we have no time deltas, so just return zero for now
if(timeDeltas.size() == 0) {
  return 0;
}

var topTimeDelta = timeDeltas.get(0);
var topTimeDeltas = new ArrayList<TimeDeltaInfo>();
topTimeDeltas.add(topTimeDelta);

for(var i = 1; i < timeDeltas.size(); i++) {
  if(timeDeltas.get(i).count == topTimeDelta.count) {
	  topTimeDeltas.add(timeDeltas.get(i));
  }
}

// Get the smallest time delta as it seems to work better than taking the average or the largest time delta.
topTimeDeltas.sort((a, b) -> a.timeDelta - b.timeDelta);

return topTimeDeltas.get(0).timeDelta;	

PanakoStrategy query logic Line 280 - printMap overwrites frequency and time values?

Possible minor refactoring to improve the recognition rate.

Issue
Initial testing against a set of audio tracks shows a fingerprint pattern (hash, f1, t1) will sometimes be repeated, but more often the hash is repeated and the f1/t1 is different.

In the current application logic, the use of a HashMap for the printMap means the f1/t1 information is sometimes lost resulting in a slightly less accurate recognition.

//query
for(PanakoFingerprint print : prints) {
	long hash = print.hash();
	db.addToQueryQueue(hash);
	printMap.put(hash, print);
}
...
hit.queryTime = printMap.get(fingerprintHash).t1;
hit.queryF1 = printMap.get(fingerprintHash).f1;

Suggestion
Pass the entire fingerprint to the db queue, extend the PanakoHit class to support queryTime and queryF1, set them when processing the db queue and do anyway with the printMap.

//query
for(PanakoFingerprint print : prints) {
	db.addToQueryQueue(print);
}
...
hit.queryTime = dbHit.queryT1;
hit.queryF1 = dbHit.queryF1;

PanakoStrategy Query Logic - maxListSize @ 250 needs an override

Possible minor refactoring to improve the recognition rate.

Testing Results
Running the query algorithm using a high-powered system found that taking half the query matches as the firstHits and lastHits (see below) results in a slightly better recognition rate.

Suggestion
Add maxListSize to config.properties, maybe with a switch to allow the query algorithm to take half the query matches each time.

if(!overrideMaxListSize) {
  //view the first and last hits (max 250)
  int maxListSize = 250;
  firstHits = queryMatches.subList(0, Math.min(maxListSize,Math.max(minimumUnfilteredHits,queryMatches.size()/5)));
  lastHits  = queryMatches.subList(queryMatches.size()-Math.min(maxListSize, Math.max(minimumUnfilteredHits,queryMatches.size()/5)), queryMatches.size());
}
else { // Taking half and half seems to achieve a better recognition rate
  var numQueryMatches = queryMatches.size();
  var numQueryMatchesEvened = numQueryMatches % 2 == 0 ? numQueryMatches : numQueryMatches - 1;
  var batchSize = numQueryMatchesEvened / 2;
  firstHits = queryMatches.subList(0, batchSize - 1);
  lastHits = queryMatches.subList(numQueryMatchesEvened - batchSize , numQueryMatches - 1);	
}

A couple of issues on Windows

Hi,

First of all my java knowledge is non-existent so apologies for any blatant mistakes!

I am trying to use Panako on a Windows machine as the subject says. Because I don't have a java setup on Windows I thought I'd compile it on a linux vm (ubuntu based) and then send the .jar file over to Windows and try it there. Also I have populated a db from the linux vm and brought that over as well.

When I try to run the jar file on Windows I get the following output:

java -jar panako.jar query ..\sos-10.wav

Apr 12, 2018 1:21:03 PM be.tarsos.dsp.io.PipeDecoder <init>
INFO: found ffmpeg on the path (C:/u-blox/gallery/oracle/java/win_64/jdk1.8.0_102/bin;C:\CEVA-ToolBox\V10\CEVA-XC;C:\CEVA-ToolBox\V10\license;C:\CEVA-ToolBox\V1
0\Common;C:\u-blox\depot\\3.1;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\W
bem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Managemen
t Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Graphviz 2.28\bin;C:\Pr
ogram Files\Microsoft Windows Performance Toolkit\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\12
0\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\u-blox\Programs\MATLAB\R2017b\runtime\win64;C:\u-blox\Programs\M
ATLAB\R2017b\bin;C:\Program Files (x86)\GitExtensions\;C:\Program Files\TortoiseSVN\bin). Will use ffmpeg for decoding media files.
Apr 12, 2018 1:21:03 PM be.panako.cli.Panako actuallyReallyStartApplication
INFO: Starting Panako application query with 1 arguments
Query;Query start (s);Query stop (s); Match Identifier;Match description; Match start (s); Match score; Time factor (%); Frequency factor(%)
Apr 12, 2018 1:21:03 PM be.tarsos.dsp.io.PipeDecoder getDecodedStream
INFO: Starting piped decoding process for C:\Users\gnak\Desktop\leenueks_shared\panako\..\sos-10.wav
Apr 12, 2018 1:21:03 PM be.tarsos.dsp.io.PipeDecoder getDecodedStream
INFO:  with command: ffmpeg -ss 0.0   -i "C:\Users\gnak\Desktop\leenueks_shared\panako\..\sos-10.wav" -vn -ar 8000 -ac 1 -sample_fmt s16 -f s16le pipe:1
Apr 12, 2018 1:21:03 PM be.tarsos.dsp.io.PipeDecoder getDecodedStream
WARNING: IO exception while decoding audio via sub process.Cannot run program "/bin/bash": CreateProcess error=2, The system cannot find the file specified
java.io.IOException: Cannot run program "/bin/bash": CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at be.tarsos.dsp.io.PipeDecoder.getDecodedStream(PipeDecoder.java:175)
        at be.tarsos.dsp.io.PipedAudioStream.getMonoStream(PipedAudioStream.java:91)
        at be.tarsos.dsp.io.PipedAudioStream.getMonoStream(PipedAudioStream.java:73)
        at be.tarsos.dsp.io.jvm.AudioDispatcherFactory.fromPipe(AudioDispatcherFactory.java:187)
        at be.tarsos.dsp.io.jvm.AudioDispatcherFactory.fromPipe(AudioDispatcherFactory.java:163)
        at be.panako.strategy.nfft.NFFTStrategy.query(Unknown Source)
        at be.panako.cli.Query$QueryTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 12 more

My java version on windows is "1.8.0_102" and on linux "1.8.0_162". Also for the record this runs fine on linux. Because I found some multi-platform support in the source code and libraries I thought it might work

Any ideas?

Thanks,
George

Monitor matched length

First of all, thanks for amazing piece of code. Exploring monitor sub-application for fingerprint matching and it looks great to find occurrence of the fingerprint into reference file and we get results like this

_Query;Query start (s);Query stop (s); Match Identifier;Match description; Match start (s); Match score; Time factor (%); Frequency factor(%)
p1-1568098567-0156.ts;-5;10;1691754436;-Kissan-Roll.aac;7;9;100%;100%
While Match start gives start offset of the matching , is it possible to get Match Stop in similar way, if yes then we can easily calculate the occurrence as well as match length ?

I understand that SYNC can be used to calculate the offset but sync is complex/resource consuming process and if we may introduce Match Stop with Monitor then it will be great tool.

Please suggest way forward.

javadoc warnings

Somewhat cosmetic: When creating docs, javadoc warns about a number of missing @param and @return tags:

/Users/hendrik/Projects/Panako/src/main/java/be/panako/cli/Application.java:191: warning: no @param for defaultValue
        protected int getIntegerOption(String option,int defaultValue, String... arguments){
                      ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/strategy/olaf/OlafEventPoint.java:70: warning: no @param for m
        public OlafEventPoint(final int t, final int f, final float m){
               ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/strategy/QueryResult.java:82: warning: no @param for queryPath
        public QueryResult(String queryPath,
               ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/strategy/QueryResult.java:82: warning: no @param for refPath
        public QueryResult(String queryPath,
               ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/strategy/QueryResult.java:82: warning: no @param for refStop
        public QueryResult(String queryPath,
               ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/strategy/QueryResult.java:82: warning: no @param for percentOfSecondsWithMatches
        public QueryResult(String queryPath,
               ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/util/Hamming.java:59: warning: no @param for x
            public static int d(long x, long y) {
                              ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/util/Hamming.java:59: warning: no @param for y
            public static int d(long x, long y) {
                              ^
/Users/hendrik/Projects/Panako/src/main/java/be/panako/util/Hamming.java:59: warning: no @return
            public static int d(long x, long y) {

Should the DB Index be in RAM? Big collection - multiple indexes?

I am trying to index a very large collection of audio programmes (90000 items, ca. 1/2 hr per programme)
This collection has grown over 20 years - and my intention is to weed out the many duplicates.

I have started indexing using the standard settings. olaf db and cache are at ca. 10GB each for 4500 files analysed so far.
This suggests and overall index size of 200GB each.... (I know reducing the sample rate would reduce the index size).

I have 16GB RAM on the current server, with the same again as swap. The server has about 2TB free space left.

My question concerns querying/building the index. I can imagine it should/must be in RAM - is this correct?

If this is the case I was thinking of breaking the index to ca. 10GB fragments. i.e. scan to an index size of ca. 10GB then
stop and restart with a fresh index for the next load of files (e.g. at the current rate scan 4500 files for each index). I would slightly change the config before continuing each run of panako to make this happen.
This has the "advantage" also of being runnable on multiple machines (all accessing the same directory but different selections of files). The disadvantage would be having to query against 20 or so indexes (though this can be automated using bash).

Would this approach make sense? Or I my assumptions about RAM and the index incorrect - and an index file of 200GB is fine?

Thanks for any insights

I succeed store sound track into dbs, but can't query matching music

I have already installed Panako on my Mac OSx, and succeed stored some sound tracks for testing.
panako stats
Number of audio objects: 4
Number of fingerprints: 296
Number of seconds: 58.0
Number of fingerprints/second: 5.103448275862069

But, when I make a query testing. It's only the totally same with original sound can be matched. Beyond that, any cutting fragment sound from original sound cannot be matched.

panako query ser.m4a
Query;Query start (s);Query stop (s); Match Identifier;Match description; Match start (s); Match score; Time factor (%); Frequency factor(%)
/Users/rex/Desktop/ser.m4a;0;2;null;null;-1;-1;-1%;-1%

And I use panako browse, I can get the fragment is matching. How can I use this, thanks a lot
image

A fatal error has been detected by the Java Runtime Environment

java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
panako --version
Panako Acoustic Fingerprinting, by user
  Built on: June 14 2021
  Version: 2.0-20210614
uname -a
Linux box 5.4.0-74-generic #83-Ubuntu SMP Sat May 8 02:35:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

I am trying to import a couple hundred mp3s into the database and after 70 or so I get this error. Then it keeps happening every 5 or so mp3s. The mp3 files are fine and not corrupt. My RAM is only 20% utilized and swap is 1% when importing. CPU hits 99-100% on all cores while importing but system doesn't freeze or seem to slow. I also tried Java 11, same crash. Any ideas?

panako store list.txt
78/822;Track91.mp3;00:03:11;15.96 s;11.99
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fdbfa9086a0, pid=17201, tid=0x00007fdbdda96700
#
# JRE version: OpenJDK Runtime Environment (8.0_292-b10) (build 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10)
# Java VM: OpenJDK 64-Bit Server VM (25.292-b10 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x7146a0]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/vghugyfjhf/Desktop/test/hs_err_pid17201.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
/usr/local/bin/panako: line 32: 17201 Aborted                 (core dumped) java $PANAKO_JVM_OPTS -Djava.util.logging.config.file=$LOG_CONFIGURATION -jar $PANAKO_JAR "$@" 2>> $PANAKO_STD_ERROR

Small issues with performance script docs

This is regarding https://github.com/JorenSix/Panako/blob/master/resources/scripts/benchmark/benchmark.textile Thank you for adding the script and its description. A couple of minor points:

  • Typo in "The FMA medium set contains 25, tracks of 30s spread over 16 unbalanced genres (22 GiB)". "25," tracks seems wrong.
  • You show two figures, one for Panako and one for Olaf, but don't describe them at all. Just seeing this one page, it's not easily understandable what Olaf refers to. You might want to add an explanatory sentence, very briefly describing the two graphs and what they show.
  • The page describing the benchmark should probably link to the script, instead of just mentioning that it's there.
  • The benchmark page does not seem to be linked to (or did I miss it?). A link from the README seems appropriate.

Some files can't be stored

When I call 'panako store file.mp3' on some files, it's stuck in infinite loop.

From my brief debugging, it seems that AudioDispatcher in TarsosDSP library always returns positive number from this.readNextAudioBlock();

I don't know why it happens only to some files, though :( Any idea?

Simple "how similar are two mp3 files" example

I was giving this software a shot, but I may have missed something. (It keeps trying to store files in a database in a directory that isn't writable. Does it need the datastore for the fingerprints to work?)

I was trying to make the simplest possible "hello world" Java example that would take in two mp3 files, and spit out "95% chance these are the same song". To do that, I think I create a new strategy (I choose which one), then pass it the path to the mp3, but I'm not sure if it needs to be uncompressed to a wav first.

Which strategy is the current best? (Reasonably fast, robust, good chance of accurate results)

This project seems to be the most advanced I've found for "are these two mp3s duplicates?" in Java.

Improvement to Sync and SyncSink

I have been exploring using audio fingerprinting to determine sync offsets in media files. So far Panako has been extremely accurate in certain cases. If I have 2 files that are identical, but one has 160ms of silence at the beginning of the file, Panako reports this as a 160ms offset. Perfect! If I have a second set of files the the same 160ms offset at the beginning and an edit in the middle that adds 250ms of silence, bringing the total offset by the end to 410ms, Panako reports this as a single offset value of 410ms.

If Panako could report a more verbose analysis, I could potentially use ffmpeg to realign the test file to the reference.

A real world example would be the reference file as an audio stream for episodic content and the test file being Dubbed in spanish. This would contain the same music and effects and should match a fingerprint for the music.

Fingerprint matching and DB init

  1. I'm testing Panako from a docker image with this config NFFT_MAPDB_DATABASE=/opt/panako/dbs/nfft_panako_db
    There's no such db file

  2. Is it possible to sort a list of fingerprints by similarity rather than just look for an exact match?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.