I have used audiokonverter (as a menu option on Dolphin) to convert flac files to mp3. I used bit rate of 128. The converted files play well in MPlayer (but no in Kaffeine) but when I try to play them through a java program (using MP3SPI and JLayer) I get an error claiming an unsupported audio format.
Is MP3 a single format? or are there several different MP3 formats? How can I get a format that does play using MP3SPI? Should I use a different bit rate or a different converter?
The error I get is:
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
Could the problem be related to the bit rate I chose during encoding? I was offered many different values by audiokonverter and chose 128 bit. I also chose to keep stereo (if possible) - which was the only other question I was asked.
I’m not even sure the Java API supports any audio data besides .wav .au and .aiff. Did you try to play other .mp3s with it yet? I suppose they won’t work either.
JavaSE, via Java Sound API (in packages javax.sound), supports two types of audio:
* Sampled Audio: Sampled audio is represented as a sequence of time-sampled data of the amplitude of sound wave. It is supported in package javax.sound.sampled. The supported file formats are: "wav", "au" and "aiff". The samples can be either 8-bit or 16-bit, with sampling rate from 8 kHz to 48 kHz.
* Musical Instrument Digital Interface (MIDI): MIDI music is synthesized from musical notes and special sound effects, instead of time-sampled, like a recipe for creating musical sound. MIDI is supported in package javax.sound.midi.
Java Sound API also include a software sound mixer that supports up to 64 channels for sound effect and background music.
Java Media Framework (JMF), which is not part of JavaSE, is needed to support MP3 and advanced features. JOAL (Java Bindings on OpenAL) supports 3D sound effect.
This is not, and should not be, a java question. I am using MP3SPI which extends java to play MP3 files and is supposed to be a robust solution used by many people. If I have to take a bet on which is wrong - MP3SPI or my encoded file, I think it is probably the latter.
And yes - the output I get is the full output. It seems quite clear, but there is always the possibility that the error message does not match the actual error.
Thanks, this is always a possibility. I will investigate in this direction (the link you give is one I have seen before), but from what I read about MP3SPI it is supposed to work without JMF. Anyway, if this is indeed a java problem it does not belong in this forum.