Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > LineUnavailableException when trying to play .wav file

Reply
Thread Tools

LineUnavailableException when trying to play .wav file

 
 
Scott
Guest
Posts: n/a
 
      04-30-2007
I'm trying to play a simple .wav file using code copied from:

http://www.developer.com/java/other/article.php/2173111

I'm running the latest Java 1.6 on windows 98 SE. However I get:

PCM_SIGNED 22050.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 22050.
0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported.
at com.sun.media.sound.DirectAudioDevice$DirectDL.imp lOpen(Unknown Source)
at com.sun.media.sound.AbstractDataLine.open(Unknown Source)
at com.sun.media.sound.AbstractDataLine.open(Unknown Source)
at AudioPlayer02$PlayThread.run(AudioPlayer02.java:14 6)

This happens whenever I try to open the line. I get the same problem when I run
jsinfo.jar (from http://www.jsresources.org/apps/jsinfo.html) - everything is
fine until I try to open a line.

WinAmp plays the .wav file without any problems.

I can even play it using the DirectSound code in:
http://msdn.microsoft.com/archive/en...asp?frame=true

Is this just a problem with windows 98 or is there something I'm over looking?
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      04-30-2007
Scott wrote:
>I'm trying to play a simple .wav file ..


What do you mean by 'simple'?

>..using code copied from:

...
>PCM_SIGNED 22050.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian
>javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 22050.
>0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported.


That message is saying that Java does not support that format.

>WinAmp plays the .wav file without any problems.


WinAmp will play almost anything.
I have MP3's that both WinAmp and the JMStudio
will play, while I have others that can only be played
by WinAmp. The same for MIDI files (and I expect,
WAV files).

>I can even play it using the DirectSound code in:
>http://msdn.microsoft.com/archive/en...asp?frame=true


That code digs directly into the Windows based
system - it would not work cross-platform, so
Java does not work that way.

>Is this just a problem with windows 98 or is there something I'm over looking?


Try whis WAV file, which has been seen to be
'Java compatible'
<http://www.physci.org/test/oscilloscope/sounds/101_0166.wav>

The JMF (especially the Performance Pack) will bring
support for more codecs (types) of more formats, but
even that only covers a relatively small number of sound
types.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via http://www.javakb.com

 
Reply With Quote
 
 
 
 
Scott
Guest
Posts: n/a
 
      04-30-2007
Andrew Thompson wrote:
> Scott wrote:
>> I'm trying to play a simple .wav file ..

>
> What do you mean by 'simple'?
>
>> ..using code copied from:

> ..
>> PCM_SIGNED 22050.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian
>> javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 22050.
>> 0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported.

>
> That message is saying that Java does not support that format.
>
>> WinAmp plays the .wav file without any problems.

>
> WinAmp will play almost anything.
> I have MP3's that both WinAmp and the JMStudio
> will play, while I have others that can only be played
> by WinAmp. The same for MIDI files (and I expect,
> WAV files).
>
>> I can even play it using the DirectSound code in:
>> http://msdn.microsoft.com/archive/en...asp?frame=true

>
> That code digs directly into the Windows based
> system - it would not work cross-platform, so
> Java does not work that way.
>


If I understand correctly Java is using DirectSound so think I've shown that
the Windows DirectSound interface is OK.

>> Is this just a problem with windows 98 or is there something I'm over looking?

>
> Try whis WAV file, which has been seen to be
> 'Java compatible'
> <http://www.physci.org/test/oscilloscope/sounds/101_0166.wav>
>


Same problem:

PCM_UNSIGNED 16000.0 Hz, 8 bit, mono, 1 bytes/frame,
javax.sound.sampled.LineUnavailableException: line with format PCM_UNSIGNED
16000.0 Hz, 8 bit, mono, 1 bytes/frame, not supported.
at com.sun.media.sound.DirectAudioDevice$DirectDL.imp lOpen(Unknown Source)
at com.sun.media.sound.AbstractDataLine.open(Unknown Source)
at com.sun.media.sound.AbstractDataLine.open(Unknown Source)
at AudioPlayer02$PlayThread.run(AudioPlayer02.java:14 6)


> The JMF (especially the Performance Pack) will bring
> support for more codecs (types) of more formats, but
> even that only covers a relatively small number of sound
> types.
>


Thanks for your input, I've just downloaded JMF and I can play .wav files using
JMStudio but the small test program still has the same problem. I think it
must be a configuration issue.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open the line: javax.sound.sampled.LineUnavailableException Java Guy Java 13 03-07-2009 01:32 PM
To play or not to play bhuckle@bigpond.net.au DVD Video 1 08-01-2007 07:18 AM
PLAY MORE VIDEO GAMES WITH GOTTA PLAY Paul Heslop Digital Photography 0 05-21-2007 11:40 AM
Error C00D11CD when trying to play vid file w/Windows Media Player Shakey Street Computer Support 6 08-05-2004 07:34 AM



Advertisments