You can use the javax.sound.sampled package for this. To load an audio file, do this:
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
Mixer mixer = AudioSystem.getMixer(mixers[mixers.length - 1]); //or something...
AudioFormat format = audioStream.getFormat();
byte[] audio = new byte[audioStream.available()];
audioStream.read(audio);
Now you have a buffer containing the bytes for the audio file. This consists of a couple of thousand elements, so it can be hard to grasp the meaning of the values. What you need to do is locate peeks in this byte code.
> I also have this problem. I want to draw the waveform
> of an audio file that I load via JMF this is often a
> MP3. I tried building a custom datasink, but it seems
> only to get the data very slowly (maybe realtime). Is
> there a better way to do this?
I tried another soloution, i wrote a Effect plugin to the Processor, In the effect i pushed the array of bytes to my visual component, it works, but it gives me to big array of data.
Hi,
i d like to know how to modify each channel of the stereo signal (left and right channel) separately using jmf.
I wanna write a pan effect filter just for education and then go on with the real project.
I wanna write it as a effect plugin.
You can also reply directly to
christ_o@gmx.de
Thanks a lot,
Olaf Christ