Reputation: 37
Now I have an AudioInputStream, using the following code I can write it to a WAVE file. While what I want is an MP3 file, what should I do?
AudioInputStream ais= new AudioInputStream(bais1, audioFormat, bufferSize);
try {
AudioSystem.write(ais, AudioFileFormat.Type.WAVE, new File("demoFile.wav")
);
}
catch(Exception e) {
e.printStackTrace();
}
In my project, the cache is not big enough to store big files, which means solution like using a tool to convert WAVE to MP3 is not allowed(WAVE file is too big).
Upvotes: 1
Views: 1970
Reputation: 7910
Here is a github library of java audio utilities that include claims of being able to encode mp3.
I haven't used the mp3 libraries, only ogg/vorbis decoding. I'd be tempted to try the JOrbis encoder for ogg/vorbis before getting into mp3's.
Upvotes: 2