Has anyone managed to use acoustid (http://acoustid.org/chromaprint) in an Java application? Accessing the chromaprint clib should be easy but I can't just pass in the audio file. I requires the raw uncompressed audio data.
I've tried using xuggler to get the uncompressed audio but didn't get anywhere. Basically I have no idea how to get the raw audio from encoded files like mp3/m4a/etc
Has anybody managed to make this work? Anyone mind sharing their code?
I suggest you use the fpcalc command line tool (included in Chromaprint, binaries for Windows/Mac/Linux are included on the website), run it in a subprocess from your Java application. You get output like this, which should be easy to parse:
FILE=/path/to/file.mp3
DURATION=398
FINGERPRINT=AQADtEqkRIkkrQ...
That's how most programs integrate AcoustID and I believe it's the easiest way.
Related
I want to play an .ogg file, so i found this piece of code.
So it downloads .ogg file from the given url and plays it. I've tried it with external files like
ExamplePlayer player = new ExamplePlayer(new File("D:\\sound.ogg").toURI().toURL().toString())
and it works. But when i try this with internal files and get it using
ExamplePlayer.class.getClassLoader().getResource("sound.ogg")
it says that "There is a hole in the first packet data.". I think maybe it doesn't work because of JAR's compression or something.
So questions are: why it doesn't work? how could i fix it? If i can't fix it, is there any other way to play .ogg files using java? Thanks.
UPD: I found a lib, but the problem still the same, it cannot read from jar file. It
I'm looking at an application I wrote several years ago that uses ogg resources, and seeing that I first import the ogg file to an InputStream object using getResourceAsStream method.
Usually with wav files, importing via the URL is preferred. Unfortunately I don't recall why I did it this way--too much new tech under the bridge. First guess is that it's a requirement from the jcraft code, otherwise I would have used my preferred method.
Even if this works in the context of an IDE, IDK if it will also work after putting the code into a JAR. getResourceAsStream is often dicey in jars.
Before I invest more time, please let us know if switching to getResourceAsStream does the trick. Maybe the fix is that simple!
+++++++++++++
EDIT: Ugh. Looking at my code, I see where I copied a class from JCraft and edited it, supplying an InputStream via wrapper code. The edit was made in order to output float PCM data from the decoder rather than having the decoder play the sound. The float PCM is then saved in a custom object similar to AudioCue, and the app I wrote this for uses that for playback. All I can remember was that it took a lot tweaking to get this to work.
I have just started learning Java and I have to deliver a assignment in Which I have to read an Audio (.wav) File and Create echo effect of the audio file and save it without using any external library. Kindly guide me from where exactly to start. Although I have a basic knowledge about C++ upto functions and a little about Classes & Objects. Looking forward for the right direction as I am short of time!
Thanks.
You can find a working example here : http://www.java2s.com/Code/Java/Development-Class/Anexampleofplayingasoundwithanechofilter.htm
I have download Android source code and flashed it to device. I have written LKM which reads/writes information to /proc/myFile. I want to write to /proc/myFiLE file from my android activity but using java code not native. I know in native code we can can use system( ) system call to write using echo command but i do not know that how to write from java code? Thanks in advance.
Just treat them as normal files. You can use the usual File and *Stream objects to write what you need.
You can use something like this.
Runtime.getRuntime().exec("your command")
i have a windows app based on mfc that saves its doc using the CArchive (MFC) serialization class
i would like to load these files into my new andriod app but need some java code to understand the serialized data file format. once i pull it apart i can handle the data ok but don't really want to dissect CArchive created files myself. can anyone help, maybe a library out there somewhere?
See previous answers to this question (with respect to Ruby instead of Java) - Parsing CArchive (MFC classes) files in Ruby
Unfortunately, I think that you're going to have dissect it yourself.
I stumbled upon the need to find out (inside Java code) which files are dynamically loaded by an SWF-file. Is there any possibility to get a list of paths of every object referenced inside?
I tried out some libraries without proper documentation and gave up. Although I ran out of Google Search Phrases... ;)
Maybe there is an external tool which can be accessed by Java via command line?
Ggreat thanks in advance
Maybe you can get to the information you need using the dump tool which is part of Apparat.
I use actionscript more than Java, so I also recommend having a look at AS3SWF which is a great library you could use to load and analyze the swf you need. Think of it as decompiling at runtime.
Either way, the SWF Format Specifications will come in handy.
I'm not sure there's something that does exactly what you want, but I imagine you could collect all the strings (DefineText tags), loop through them and run an URL RegEx against them.
I think even if you could analyze a SWF file, you can't be sure to get this information. I have Flex Project (finally a swf file) which dynamically loads some modules, but the names (URLs) of the available modules are requested from the server. So there is no chance to retrieve this information from the main swf file.