Problems playing some wav audio formats using MMAPI (WTK22 for Windows)
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sandro_Mancuso
Posted On:   Tuesday, January 18, 2005 08:49 AM

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 &   More>>

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.

   <<Less

Re: Problems playing some wav audio formats using MMAPI

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, February 19, 2005 08:43 AM

It sounds (?) like your API can only handle PCM, which is raw uncompressed audio samples. The ones it couldn't play (CCITT uLaw, MS ADPCM) are compressed formats, requiring some codec.

Re: Problems playing some wav audio formats using MMAPI (WTK22 for Windows)

Posted By:   Anonymous  
Posted On:   Thursday, February 17, 2005 03:25 AM

i am also a new developer when you use the above code for playing a wav file watch your memory moniter it keep on eating the memory for every call of the wav file . so if
any body can answer to this it will be helpfull.
About | Sitemap | Contact