The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » Java 3D

Thread: JoalMixer reading .mp3 file ...

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Last Post: Oct 23, 2007 4:22 PM by: tmilard
tmilard

Posts: 195
JoalMixer reading .mp3 file ...
Posted: Oct 22, 2007 4:37 PM
 
  Click to reply to this thread Reply

Hello java3D fellowmen.

I use joalMixer which is good. It reads wav files.
Because of limitation in bandwith over the Internet, I really need to load mp3 files rather then wav files (1) in the JOAL API.

Question 1: Has someone in java3D+JOAL+JOALMIXER community has coded it ?
Question 2: If not, is someone interested also with one 'improved' JoalMixer that reads .mp3 ? I a m willing to do it with someone
Question 3 : Please if you want also this joalMixer addon (read mp3 files)) let me know

Don't hesitate to say the most futile idea...

Thanks and bye for now
Thierry


(1) The performance issue is simple: Mp3compression divides for quite a few music files I tested ... 14 times. So the download transfer ( I have a web service) is 14 times faster.I

What I to do today is :
- 1) I Download mp" file
- 2) I convert to a .wav files.
- 3) Than I play the new sound file using JOAL. But problem: the conversion for a mp3file de 2 Mega buytes last 10 seconds ! Too long...

Thierry free-visit.com

David Grace
RE: JoalMixer reading .mp3 file ...
Posted: Oct 23, 2007 3:32 PM   in response to: tmilard
  Click to reply to this thread Reply

Hi Thierry,

I wrote the JOALMixer and I have done some work in getting the JOALMixer to
play mp3 files.

There are two issues:

1. I need to enable streaming of sound data. At the moment all sound
data is cached, thus for an mp3 file the entire file would have to be
decoded before it is given to the JOALMixer and thus you would have the same
problem of conversion time that you experience at the moment without
streaming of data enabled.

2. I need to use an API to do the actual mp3 conversion and put the
output into the streaming and cached parts of the JOALMixer.

As I said I have done some work on it but am pretty busy at the moment, but
I hope that I will have a working version in a couple of months.

Can I ask which API you use for the MP3 conversion at the moment?

Dave.




-----Original Message-----
From: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Sent: Tuesday, October 23, 2007 9:38 AM
To: interest@java3d.dev.java.net
Subject: JoalMixer reading .mp3 file ...

Hello java3D fellowmen.

I use joalMixer which is good. It reads wav files.
Because of limitation in bandwith over the Internet, I really need to
load mp3 files
rather then wav files (1) in the JOAL API.

Question 1: Has someone in java3D+JOAL+JOALMIXER community has coded it ?
Question 2: If not, is someone interested also with one 'improved'
JoalMixer that reads .mp3 ? I a m willing to do it with someone
Question 3 : Please if you want also this joalMixer addon (read mp3 files))
let me know

Don't hesitate to say the most futile idea...

Thanks and bye for now
Thierry


(1) The performance issue is simple: Mp3compression divides for quite a few
music files I tested ... 14 times. So the download transfer ( I have a web
service) is 14 times faster.I

What I to do today is :
- 1) I Download mp" file
- 2) I convert to a .wav files.
- 3) Than I play the new sound file using JOAL. But problem: the conversion
for a mp3file de 2 Mega buytes last 10 seconds ! Too long...

Thierry free-visit.com
[Message sent by forum member 'tmilard' (tmilard)]

http://forums.java.net/jive/thread.jspa?messageID=241592

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content
filtering.
http://www.mailguard.com.au/mg





---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net


tmilard

Posts: 195
Re: RE: JoalMixer reading .mp3 file ...
Posted: Oct 23, 2007 4:22 PM   in response to: David Grace
 
  Click to reply to this thread Reply

Hello David,
Nice to hear from you.

I am very happy to see you think of mp3 files for next version of joalMixer API.
I am 50% time on diminushing the time it takes to load my mp3 files.
So if I can test the version you made that loads mp3 file I am ok with it.
I might not be of any help but at least I can learn...

Thierry

RE: Can I ask which API you use for the MP3 conversion at the moment ?
answer :==>I use "javazoom MP3 SPI .
Here is the main Internet site :
http://www.javazoom.net/mp3spi/documents.html

-------------------------------------------------------------------------------------------------------------------------
-------------------- If it can help Here is my code to copy mp3 stream into a .wav file -------

/**
* Convert the InputStream 'inputSource' (mp3) in a wave file
*
*
* @param inputSource
* InputStream à convertir
* @param nomFichierCible
* fichier wav à écrire
* @throws UnsupportedAudioFileException
* si le format son de l'InputStream n'est pas géré
* @throws IOException
* Si l'InputStream est vide(?) - si l'écriture sur le disque
* est impossible
*/
private static void conversionToWav(InputStream inputSource,
String nomFichierCible) throws UnsupportedAudioFileException,
IOException {
System.out.println("SonJOAL>>conversionToWav(.....) Debut");

System.out.println("SonJOAL>>conversionToWav(.....) nomFichierCible="+nomFichierCible);

AudioInputStream audioInputStream = null;
File fichierCible = new File(nomFichierCible);
// THM 23/05/2007 Pour que les fichier de son tmpN.wav ne poluent pas la machine client:
// New :
fichierCible.deleteOnExit();

System.out.println("SonJOAL>>conversionToWav(.....) fichierCible="+fichierCible);
//------------------------------
// 1) obtention d'un AudioInputStream à partir de l'InputStream

BufferedInputStream leFichierSonBufferedInputStream =
new BufferedInputStream(inputSource);
try {
audioInputStream=
AudioSystem.getAudioInputStream(leFichierSonBufferedInputStream);

//------------------------------

System.out.println("SonJOAL>>conversionToWav(.....) audioInputStream="+audioInputStream);

// 2) récupération du format audio du flux
AudioFormat audioFormat = audioInputStream.getFormat();

//conversion au format wav si ce n'est pas deja son format
if (audioFormat.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
AudioFormat newFormat = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED, audioFormat
.getSampleRate(), 16, audioFormat.getChannels(),
audioFormat.getChannels() * 2, audioFormat.getSampleRate(),
false);

AudioInputStream newStream = AudioSystem.getAudioInputStream(
newFormat, audioInputStream);
audioFormat = newFormat;
audioInputStream = newStream;
}

//Ecriture du fichier wav
AudioFileFormat.Type outputType = AudioFileFormat.Type.WAVE;
System.out.println("SonJOAL>>conversionToWav(.....) Avant appel AudioSystem.write(...)");
AudioSystem.write(audioInputStream, outputType, fichierCible);
System.out.println("SonJOAL>>conversionToWav(.....) Apres appel AudioSystem.write(...)");
System.out.println("SonJOAL>>conversionToWav(.....) Fin");

} catch (Exception e) {
System.out.println("Le son wav " + nomFichierCible+ " n'a pas pu être généré.");
e.printStackTrace();
}


}


-------------------------------------------------------------------------------------------------------------------------




 XML java.net RSS