Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ArrayIndexOutOfBoundsException in unsafeRunSync() #10

Open
andluu opened this issue May 4, 2020 · 0 comments
Open

java.lang.ArrayIndexOutOfBoundsException in unsafeRunSync() #10

andluu opened this issue May 4, 2020 · 0 comments

Comments

@andluu
Copy link

andluu commented May 4, 2020

Hey there!
Im writing a Java application wich supposed to receive audio files, calculate fingerprint, and search track based on it.
But Im facing a problem that the sample Java interop code you mention in README doesnt work.

Here is my code

        File file = new File("song.mp3");
        System.out.println(file.exists());
        System.out.println(file.length());
        AudioSource source = new AudioSource.AudioFileSource(file);
        Fingerprinter fingerprinter = new Fingerprinter();
        Fingerprint fingerprint = fingerprinter.apply(source).unsafeRunSync();
        System.out.println(fingerprint.compressed());

Here is the exception:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
	at javazoom.spi.mpeg.sampled.convert.DecodedMpegAudioInputStream$DMAISObuffer.append(DecodedMpegAudioInputStream.java:294)
	at javazoom.jl.decoder.Obuffer.appendSamples(Obuffer.java:59)
	at javazoom.jl.decoder.SynthesisFilter.compute_pcm_samples(SynthesisFilter.java:1510)
	at javazoom.jl.decoder.SynthesisFilter.calculate_pcm_samples(SynthesisFilter.java:1550)
	at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:324)
	at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219)
	at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147)
	at javazoom.spi.mpeg.sampled.convert.DecodedMpegAudioInputStream.execute(DecodedMpegAudioInputStream.java:185)
	at org.tritonus.share.TCircularBuffer.read(TCircularBuffer.java:138)
	at org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream.read(TAsynchronousFilteredAudioInputStream.java:197)
	at org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream.read(TAsynchronousFilteredAudioInputStream.java:182)
	at chromaprint.AudioSource$.$anonfun$audioInputStreamToByteStream$8(AudioSource.scala:59)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:87)
	at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
	at cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Also, here is the track: https://mega.nz/file/mO5DTbRA#f-3EUFlPbHs47eYfNMLiElaA3gbA4yJzP-8RtZR1V1c

Java version: 1.8
Library version: 0.3.1

What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant