I analyze mp3 music files. What I'm doing is extracting audio data from a file and counting the musical similarity.
I use javazoom to process mp3 files. Using audioFormat, I extract raw data from an mp3 file:
byte[] audioBytes = new byte[numBytes];
in_format_init = AudioSystem.getAudioInputStream(musicFile);
AudioFormat formatInit = in_format_init.getFormat();
AudioFormat formatFinal = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
formatInit.getSampleRate(),
16,
formatInit.getChannels(),
formatInit.getChannels()*2,
formatInit.getSampleRate(),
false);
AudioInputStream streamIn = AudioSystem.getAudioInputStream(formatFinal, in_format_init);
while (((numBytesRead = streamIn.read(audioBytes)) != -1))
{...}
By doing this, I save the audio data (without headers or tags) in audioBytes, and then the information stored in the array is processed.
My question is: is it possible to extract audio information from an mp3 audio file and save it, as I do in my example? I read about JMF, but it baffles me.
Thank.
source
share