JMF?

  • Thread starter Dirk Bruere at NeoPax
  • Start date
Q

Qu0ll

Dirk Bruere at NeoPax said:
I need a bit of s/w for playing various basic audio formats eg .wav .mp3
(no GUI).

I assume I'll need JMF.
Are there any decent tutorials about?

JMF is old and no longer being developed. The new media components are
called JMC. There's not much documentation for them about just yet but you
might like to google about them and find out if they are suitable for your
needs.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
K

Knute Johnson

Qu0ll said:
JMF is old and no longer being developed. The new media components are
called JMC. There's not much documentation for them about just yet but
you might like to google about them and find out if they are suitable
for your needs.

What Qu0ll said but JMF still works and will play some mp3 files with
the extra plugin. Many wav files can also be played but you may have to
convert them first. If you want some simple audio player code I'll be
glad to post an outline.
 
Q

Qu0ll

Knute Johnson said:
What Qu0ll said but JMF still works and will play some mp3 files with the
extra plugin. Many wav files can also be played but you may have to
convert them first. If you want some simple audio player code I'll be
glad to post an outline.

Yes, JMF certainly still works as well as it ever did but I was just
pointing out that for a new project JMC is probably the way to go. The OP
may also like to look at the open-source FMJ project [1] for a more
extensive JMF-compatible library.

[1] http://fmj-sf.net/

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
A

Arne Vajhøj

Qu0ll said:
Knute Johnson said:
What Qu0ll said but JMF still works and will play some mp3 files with
the extra plugin. Many wav files can also be played but you may have
to convert them first. If you want some simple audio player code I'll
be glad to post an outline.

Yes, JMF certainly still works as well as it ever did but I was just
pointing out that for a new project JMC is probably the way to go. The
OP may also like to look at the open-source FMJ project [1] for a more
extensive JMF-compatible library.

[1] http://fmj-sf.net/

s/-/./w I presume.

Arne
 
Q

Qu0ll

Arne Vajhøj said:
Qu0ll said:
Knute Johnson said:
Qu0ll wrote:
JMF is old and no longer being developed. The new media components are
called JMC. There's not much documentation for them about just yet but
you might like to google about them and find out if they are suitable
for your needs.

What Qu0ll said but JMF still works and will play some mp3 files with
the extra plugin. Many wav files can also be played but you may have to
convert them first. If you want some simple audio player code I'll be
glad to post an outline.

Yes, JMF certainly still works as well as it ever did but I was just
pointing out that for a new project JMC is probably the way to go. The
OP may also like to look at the open-source FMJ project [1] for a more
extensive JMF-compatible library.

[1] http://fmj-sf.net/

s/-/./w I presume.

No, the URL is correct as is.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
A

Arne Vajhøj

Qu0ll said:
Arne Vajhøj said:
Qu0ll said:
Qu0ll wrote:
JMF is old and no longer being developed. The new media components
are called JMC. There's not much documentation for them about just
yet but you might like to google about them and find out if they
are suitable for your needs.

What Qu0ll said but JMF still works and will play some mp3 files
with the extra plugin. Many wav files can also be played but you
may have to convert them first. If you want some simple audio
player code I'll be glad to post an outline.

Yes, JMF certainly still works as well as it ever did but I was just
pointing out that for a new project JMC is probably the way to go.
The OP may also like to look at the open-source FMJ project [1] for a
more extensive JMF-compatible library.

[1] http://fmj-sf.net/

s/-/./w I presume.

No, the URL is correct as is.

So it is not a SF project.

They sure fooled me.

Arne
 
Q

Qu0ll

Arne Vajhøj said:
Qu0ll said:
Arne Vajhøj said:
Qu0ll wrote:
Qu0ll wrote:
JMF is old and no longer being developed. The new media components
are called JMC. There's not much documentation for them about just
yet but you might like to google about them and find out if they are
suitable for your needs.

What Qu0ll said but JMF still works and will play some mp3 files with
the extra plugin. Many wav files can also be played but you may have
to convert them first. If you want some simple audio player code I'll
be glad to post an outline.

Yes, JMF certainly still works as well as it ever did but I was just
pointing out that for a new project JMC is probably the way to go. The
OP may also like to look at the open-source FMJ project [1] for a more
extensive JMF-compatible library.

[1] http://fmj-sf.net/

s/-/./w I presume.

No, the URL is correct as is.

So it is not a SF project.

They sure fooled me.

The actual code base is hosted on SF. The given URL is the project's home
page.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
K

Knute Johnson

Qu0ll said:
Knute Johnson said:
What Qu0ll said but JMF still works and will play some mp3 files with
the extra plugin. Many wav files can also be played but you may have
to convert them first. If you want some simple audio player code I'll
be glad to post an outline.

Yes, JMF certainly still works as well as it ever did but I was just
pointing out that for a new project JMC is probably the way to go. The
OP may also like to look at the open-source FMJ project [1] for a more
extensive JMF-compatible library.

[1] http://fmj-sf.net/

JMC is part of Java 7 which is not released yet and JMC is not expected
to be complete in Java 7 either. FMJ is a great idea but it is far from
complete either. Sadly we are stuck with JavaSound and JMF for some
time to come.
 
A

Andrew Thompson

...Sadly we are stuck with JavaSound and JMF for some
time to come.

How do you* go with this page?
<http://javafx.com/samples/MediaBox/index.html>

It tries to embed a streamed(?) video in a web page.

After first crashing FF (3.0.11) under Java 1.6.0_10
on Ubuntu, I reopened the browser to see a (v. violent)
video with a rabbit and small critters. Then it crashed
FF again after the video completed.

(I am guessing if JavaFX can do videos, it can also
do sound formats..)

* Anybody, everybody..
 
K

Knute Johnson

Andrew said:
How do you* go with this page?
<http://javafx.com/samples/MediaBox/index.html>

It tries to embed a streamed(?) video in a web page.

After first crashing FF (3.0.11) under Java 1.6.0_10
on Ubuntu, I reopened the browser to see a (v. violent)
video with a rabbit and small critters. Then it crashed
FF again after the video completed.

(I am guessing if JavaFX can do videos, it can also
do sound formats..)

* Anybody, everybody..

It worked fine for me on my Windows XP system with 1.6.0_14 installed.
It did ask to install the JavaFX runtime which I thought was included in
the 1.6 runtime but it worked fine.

I really don't know if the media features of JavaFX are the same ones
that are coming with Java 7 or if they are completely different.

I'll try it on XUbuntu and FF a little later and report back.
 
K

Knute Johnson

Knute said:
It worked fine for me on my Windows XP system with 1.6.0_14 installed.
It did ask to install the JavaFX runtime which I thought was included in
the 1.6 runtime but it worked fine.

I really don't know if the media features of JavaFX are the same ones
that are coming with Java 7 or if they are completely different.

I'll try it on XUbuntu and FF a little later and report back.

It works fine on my XUbuntu installation with FF too. It didn't ask to
download any runtimes either.

knute...
 
A

Andrew Thompson

....
It works fine on my XUbuntu installation with FF too.  It didn't ask to
download any runtimes either.

Huhh. What version of Java are you running?

What I forgot to add to my original description is
that I /was/ prompted to install the JavaFX API
(via a webstart - 'click to proceed' dialog) before
the first crash. The second time I visited the page,
I was not prompted and it worked.

As an aside, while Sun has bundled the JavaFX SDK
with the 1.6.0_14 SDK, I had not thought that to
mean they had already included it in the JRE of the
same version (_14 is the latest, right?). Perhaps
I am mistaken.

(I don't have the spare bandwidth at this instant,
to be downloading the _14 SDK, otherwise I might
try out some JavaFX dev. myself..)
 
D

Dirk Bruere at NeoPax

Dirk said:
I need a bit of s/w for playing various basic audio formats eg .wav .mp3
(no GUI).

I assume I'll need JMF.
Are there any decent tutorials about?
Having said that, what I want is an audio player class without GUI that
will play common audio formats and have basic methods for stuff like
vol, start, stop etc

Is there one available? - I'm looking and have not found anything
suitable yet. I would have thought it should be easy, but it doesn't
seem to be.

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
K

Knute Johnson

Andrew said:
Huhh. What version of Java are you running?

On Windows 1.6.0_14. On Linux it was 1.6.0_10 but I did the upgrade to
_14 while I was playing with the JavaFX site.
What I forgot to add to my original description is
that I /was/ prompted to install the JavaFX API
(via a webstart - 'click to proceed' dialog) before
the first crash. The second time I visited the page,
I was not prompted and it worked.

I was surprised by that too. Not sure why the JDK 1.6.0_14 didn't
already have the JavaFX runtime installed. I thought it was part of it
as well.
As an aside, while Sun has bundled the JavaFX SDK
with the 1.6.0_14 SDK, I had not thought that to
mean they had already included it in the JRE of the
same version (_14 is the latest, right?). Perhaps
I am mistaken.

(I don't have the spare bandwidth at this instant,
to be downloading the _14 SDK, otherwise I might
try out some JavaFX dev. myself..)
 
K

Knute Johnson

Dirk said:
Having said that, what I want is an audio player class without GUI that
will play common audio formats and have basic methods for stuff like
vol, start, stop etc

Is there one available? - I'm looking and have not found anything
suitable yet. I would have thought it should be easy, but it doesn't
seem to be.

Here is a simple outline class. Implementation of a level control is a
little more complicated. This will play .au, .aiff and some .wav,
depending on the actual data format.

import java.io.*;
import javax.sound.sampled.*;

public class Play {
public static void main(String[] args) {
class MyLineListener implements LineListener {
public void update(LineEvent le) {
LineEvent.Type type = le.getType();
System.out.println(type);
}
};

try {
AudioInputStream fis =
AudioSystem.getAudioInputStream(new File(args[0]));
System.out.println("File AudioFormat: " + fis.getFormat());
AudioInputStream ais = AudioSystem.getAudioInputStream(
AudioFormat.Encoding.PCM_SIGNED,fis);
AudioFormat af = ais.getFormat();
System.out.println("AudioFormat: " + af.toString());

int frameRate = (int)af.getFrameRate();
System.out.println("Frame Rate: " + frameRate);
int frameSize = af.getFrameSize();
System.out.println("Frame Size: " + frameSize);

SourceDataLine line = AudioSystem.getSourceDataLine(af);
line.addLineListener(new MyLineListener());

line.open(af);
int bufSize = line.getBufferSize();
System.out.println("Buffer Size: " + bufSize);

line.start();

byte[] data = new byte[bufSize];
int bytesRead;

while ((bytesRead = ais.read(data,0,data.length)) != -1)
line.write(data,0,bytesRead);

line.drain();
line.stop();
line.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
 
D

Dirk Bruere at NeoPax

Knute said:
Dirk said:
Having said that, what I want is an audio player class without GUI
that will play common audio formats and have basic methods for stuff
like vol, start, stop etc

Is there one available? - I'm looking and have not found anything
suitable yet. I would have thought it should be easy, but it doesn't
seem to be.

Here is a simple outline class. Implementation of a level control is a
little more complicated. This will play .au, .aiff and some .wav,
depending on the actual data format.

import java.io.*;
import javax.sound.sampled.*;

public class Play {
public static void main(String[] args) {
class MyLineListener implements LineListener {
public void update(LineEvent le) {
LineEvent.Type type = le.getType();
System.out.println(type);
}
};

try {
AudioInputStream fis =
AudioSystem.getAudioInputStream(new File(args[0]));
System.out.println("File AudioFormat: " + fis.getFormat());
AudioInputStream ais = AudioSystem.getAudioInputStream(
AudioFormat.Encoding.PCM_SIGNED,fis);
AudioFormat af = ais.getFormat();
System.out.println("AudioFormat: " + af.toString());

int frameRate = (int)af.getFrameRate();
System.out.println("Frame Rate: " + frameRate);
int frameSize = af.getFrameSize();
System.out.println("Frame Size: " + frameSize);

SourceDataLine line = AudioSystem.getSourceDataLine(af);
line.addLineListener(new MyLineListener());

line.open(af);
int bufSize = line.getBufferSize();
System.out.println("Buffer Size: " + bufSize);

line.start();

byte[] data = new byte[bufSize];
int bytesRead;

while ((bytesRead = ais.read(data,0,data.length)) != -1)
line.write(data,0,bytesRead);

line.drain();
line.stop();
line.close();
} catch (Exception e) {
System.out.println(e);
}
}
}

Thanks.
Any way of extending it to mp3, flac?

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
K

Knute Johnson

Dirk said:
Knute said:
Dirk said:
Dirk Bruere at NeoPax wrote:
I need a bit of s/w for playing various basic audio formats eg .wav
.mp3 (no GUI).

I assume I'll need JMF.
Are there any decent tutorials about?

Having said that, what I want is an audio player class without GUI
that will play common audio formats and have basic methods for stuff
like vol, start, stop etc

Is there one available? - I'm looking and have not found anything
suitable yet. I would have thought it should be easy, but it doesn't
seem to be.

Here is a simple outline class. Implementation of a level control is
a little more complicated. This will play .au, .aiff and some .wav,
depending on the actual data format.

import java.io.*;
import javax.sound.sampled.*;

public class Play {
public static void main(String[] args) {
class MyLineListener implements LineListener {
public void update(LineEvent le) {
LineEvent.Type type = le.getType();
System.out.println(type);
}
};

try {
AudioInputStream fis =
AudioSystem.getAudioInputStream(new File(args[0]));
System.out.println("File AudioFormat: " + fis.getFormat());
AudioInputStream ais = AudioSystem.getAudioInputStream(
AudioFormat.Encoding.PCM_SIGNED,fis);
AudioFormat af = ais.getFormat();
System.out.println("AudioFormat: " + af.toString());

int frameRate = (int)af.getFrameRate();
System.out.println("Frame Rate: " + frameRate);
int frameSize = af.getFrameSize();
System.out.println("Frame Size: " + frameSize);

SourceDataLine line = AudioSystem.getSourceDataLine(af);
line.addLineListener(new MyLineListener());

line.open(af);
int bufSize = line.getBufferSize();
System.out.println("Buffer Size: " + bufSize);

line.start();

byte[] data = new byte[bufSize];
int bytesRead;

while ((bytesRead = ais.read(data,0,data.length)) != -1)
line.write(data,0,bytesRead);

line.drain();
line.stop();
line.close();
} catch (Exception e) {
System.out.println(e);
}
}
}

Thanks.
Any way of extending it to mp3, flac?

I don't know flac. Some MP3 files can be played with the JMF MP3 plugin
for JavaSound.
 
Q

Qu0ll

Knute Johnson said:
On Windows 1.6.0_14. On Linux it was 1.6.0_10 but I did the upgrade to
_14 while I was playing with the JavaFX site.


I was surprised by that too. Not sure why the JDK 1.6.0_14 didn't already
have the JavaFX runtime installed. I thought it was part of it as well.

JavaFX uses JMC, the same components to be used in Java 7. The JavaFX
runtime is included in the most recent JREs and you should note that when
running the media examples it *validates* the JavaFX JARs/DLLs rather than
*downloads* them.

Having said that, I do not know exactly what is installed when the prompt
appears to install the JavaFX Runtime. I also get that prompt when running
the JavaFX examples but it does appear that whatever it is installing is not
particularly large as it installs virtually instantaneously. It is
obviously not the entire JavaFX runtime.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
A

Andrew Thompson

Thanks for the extra details.
...The JavaFX
runtime is included in the most recent JREs...

I don't suppose you know at what version that began,
do you? (I spent some time browsing a variety of pages
searching for specific information on JavaFX and found
the documentation sorely lacking - though it may be
better in the SDK documentation).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Official Java Classes 10
Can an Applet beep? 4
Delay 2
Change character in string 105
Slightly tricky string problem 18
ListModel name 10
Accessing static field 21
Sorting a JList 4

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top