File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Problems playing some wav audio formats using MMAPI (WTK22) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Problems playing some wav audio formats using MMAPI (WTK22)" Watch "Problems playing some wav audio formats using MMAPI (WTK22)" New topic
Author

Problems playing some wav audio formats using MMAPI (WTK22)

Sandro Mancuso
Greenhorn

Joined: Sep 08, 2004
Posts: 1
Hi there.

I'm having some problems playing some wav files with the MMAPI (WTK22).

Testing my application with some wav files, I realised that I can play some types of

wav files but I can't play others.

This is just a snapshot of my code.

InputStream is = getClass().getResourceAsStream("/res/audio/RICOCHET.WAV");
Player p;
try {
p = Manager.createPlayer(is, "audio/x-wav");
p.start();
} catch (IOException e1) {
e1.printStackTrace();
} catch (MediaException e1) {
e1.printStackTrace();
}

In this case, the ricochet.wav has the "PCM 11.025 kHz, 8 bit, Mono" audio format

and it works fine.
The audio format "PCM 22.050 kHz, 16 bit, Mono" works fine as well.

When I try to play a wav file that has one of the following audio formats I get a

MediaException with the message "Malformed wave media".
Formats:
- CCITT uLaw 8.000 kHz, 8 bit, Mono
- Microsoft ADPCM 22.050 kHz, 4 bit, Stereo

Does anyone know this problem? Which types of wav file audio formats are supported

by the MMAPI? If the "CCITT uLaw 8.000 kHz, 8 bit, Mono" format is not supported at all, for which format should I convert?

In advance, thank you very much for the help.

Sandro.
Ould Nadif
Ranch Hand

Joined: Jan 21, 2004
Posts: 184
Hi Sandro,

I think that youR problem is the path "res/audio".
Try rather this bit code in your code :
InputStream is = getClass().getResourceAsStream("RICOCHET.WAV");

Cheers

OULD NADIF


We are ones that build the world, thus build it well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems playing some wav audio formats using MMAPI (WTK22)