How to extract audio features in java? - java

My thesis project is on Audio Feature extraction, their classifcation and comparison.
I am unable to extract the audio features from the last 6months.
I just have an idea that may work.
The audio in any format is to be converted into pcm format and features like bandwidth, Zero Crossing Rate, Noise Frame Ratio, Pitch Strength and mel Frequency Cepctral Coefficients can be extracted from it.
Then a data set is prepared using these features and then various audio classifiaction algoriths are applied to it.
Kindly help how can i proceed further and extract audio features?
Thanx

Although it is a very old post but maybe someone would reach here after googling. Now there are some very good toolkits to use :
TarsoDSP https://github.com/JorenSix/TarsosDSP
OpenSmile http://www.audeering.com/research/opensmile
CMU Sphinx

This is probably too late to be of much help, but you should really look at the jmir project. It's a system for doing audio feature extraction and classification in Java. It's all open source and well documented.

Related

find compression mode of JPEG image

I was trying to open jpeg files in a Java program and noticed that neither ImageIO nor the Apache commons imaging library tools could open the images. The commons library showed me this error:
"Only sequential, baseline JPEGs are supported at the moment"
So, my image files are compressed in a way both libraries aren't able to read. I could make an ImageJ macro and transform all the images first but I would like to just use my program and not something extra.
Is there a way to find the compression mode in jpeg or even a java library that can read jpegs in several modes?
Thanks in advance
Suddenly it works with the ImageIO standard Class. Don't ask me why. Thanks for your help guys.
You need to get some tool that will allow you to dump a JPEG stream. There are a number of them out there.
What you are looking for is the start of frame marker.
FFC0 indicates baseline sequential.
FFC1 indicates extended sequential. It doesn't take much more code to do extended sequential than baseline. It is puzzling why a decoder would limit itself to baseline these day.
FFC2 is progressive.
There are others but those are the only ones you are likely to encounter and are widely supported.
You just need to find a tool that will save in baseline format. Finding one to read the other two formats is easy.

How can I play and manipulate .wav files using Java?

I'm looking for a small library to play, merge and change pitch for .wav files.
I've tried JASS, beads, something from anyexample.com, basic javax.sound examples, Sonia Sound Library etc.
Can anyone help me? I just need change pitch, merge and play wav files in Java.
Have you tried the Java Media Framework? Even though it has its limitations, it may be an option. In addition, the wikipedia article (linked above) has a listing of alternatives - maybe one of them does the trick for you.

Pitch detection and change java

I'm french so I'm sorry if you have trouble to understand some of my sentences.
Anyways, I saw in some topics that the pitch could be fetected thanks to the Fourier transform
but I didn't really understand how to implement it.
Moreover, I didn't find how to change the pitch of a wav file and if possibl ,a mp3 file
I am listening to music using javaSound for the wav and JLayer for the mp3.
Thanks
Sounds like you're just getting started with audio. Consider using MATLAB or Octave to learn about the Fourier transform. See their respective signal processing packages. The reason I'm suggesting MATLAB or Octave is because it will help you learn faster than Java will. You need to learn about what you want to code before you actually code it. The book DAFX would be a good place to start learning and it also includes sample MATLAB scripts for pitch shifting, and probably detection as well.

Reading RAW images from Java

Canon/Nikon/other cameras save raw output of their sensor in some of their proprietary formats (.CR2, whatever). Is there any Java library designed to read them and convert into manageable BufferedImages?
I don't reqlly care here about fully customizable conversion similar to ufraw or imagemagick, rather something simple that "just works" for rendering simple previews of such images.
I've been where you are, and I feel for you. Your best bet is to use an Adobe or dcraw-based program to create thumbnails automatically. Temporary DNG files using Adobe's converter may be easier to use.
IF you insist on doing it in Java, you're about to run into a mountain of pain. RAW formats change often, have all sorts of crazy nuances and are intentionally hard to work with. Camera makers want you to use THEIR RAW conversion software, to show the camera's abilities at its best and screw Adobe. The guy behind dcraw found that some are camera manufacturers even use encryption now!
The existing Java libraries are poor -- JRawIO has improved since I last looked at it, but it supports only a fraction of the formats that dcraw does. In addition to the listed libraries, the imagero library may provide the ability to display a thumbnail for your image.
From personal experience, don't even think about writing your own RAW file reader.
I tried to do this with a very simple RAW format once (just a solid array of sensor data, 12 bits per pixel). The dcraw source translates badly to Java. You haven't seen such a nightmare of bit-fiddling ever. Took me days to debug problems with byte alignment and endian-ness.
jrawio is a plugin for Java Image I/O. With it you can read the raster data, the thumbnails and the metadata from the raw image file.
nef and cr2 already contains preview images in jpeg. just find the right offset and the right length to extract it...
Laurent Clevy # lclevy.free.fr/raw
Laurent
Unless you want to write you own file parser/loader (sounds fun imho ;) ), perhaps JMagick will help you. I haven't tried it and it might not work given your target platform since JMagick uses JNI.
UPDATE: dcraw looks like a good resource/reference

Playing small sounds in Java game

For the computer game I'm making, I obviously want to play sound. So far, I've been using AudioClip to play WAV files. While this approach works fine, the WAV files tend to be gigantic. A few seconds of sound end up being hundreds of kB. I'm faced with having a game download that's 95% audio!
The obvious option here would be to use MP3 or Ogg Vorbis. But I've had limited success with this - I can play MP3 using JLayer (but it plays in the same thread). As for Ogg, I've had no luck at all. Worse, JLayer's legal status is a bit on the dubious side.
So my question is to both Java developers and generally people who actually know something about sound: What do I do? Can I somehow "trim the fat" off my WAVs? Is there some way of playing Ogg in Java? Is there some other sound format I should use instead?
You could use JOrbis library to play back OGG music. For working sample usage you can look at these files here.
I also experimented with some lossless audio compression, for example I had a 16 bit mono sound. I separated the upper and lower bytes of each sample and put them after each other. Then I applied a differential replacement where each byte is replaced by its difference from the last byte. And finally used GZIP to compress the data. I was able to reduce the data size to 50-60% of the original size. Unfortunately this was not enough so I turned to the OGG format.
One thing I noticed with 8 bit music is that if I change the audio volume, the playback becomes very noisy. I solved this problem by upsampling the audio data to 16 bit right before the SourceDataLine.write().
These may be outdated, but they are officially recognized by the Xiph.org team (who maintain Ogg and Vorbis, among others).
http://www.vorbis.com/software/#java
The problem you describe is addressed by the Service Provider Interface (SPI) for sound in Java. The result is that simply adding JAR files to your classpath will add functionality to the default Java Sound API. Thus enabling the handling of more sound formats without changing code.
Last time I tried this the Javazoom people offered a working MP3 SPI JAR. Which was based on the JLayer you mentioned.
For Vorbis OGG there now also seems to be an SPI library. Check out the docs on the Vorbis SPI on Javazoom.
If you decide to stay with wav format...
It is probably not very important to have high quality sound files. You can use your favorite wav editor to lower the bit rate, switch to mono, or both. That will save tons of space and you won't notice the difference in quality while playing the game.
Hope this helps.

Categories

Resources