Tentei o seguinte código que achei na net e nem rolou!!!
void initItNokia() {
try
{
Sound soundWav;
InputStream tune = this.getClass().getResourceAsStream("loud.WAV");
byte[] buffer = new byte[1192];
tune.read(buffer, 0, buffer.length);
soundWav = new Sound(22, 1000L);
soundWav.init(buffer, Sound.FORMAT_WAV);
soundWav.setGain(255);
soundWav.play(25);
buffer = null;
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
assim funciona:
private void initItNokia() {
byte[] soundData = {(byte) 0x02, (byte) 0x4A, (byte) 0x3A, (byte) 0x51,
(byte) 0xD1, (byte) 0x95, (byte) 0xCD, (byte) 0xD0,
(byte) 0x08, (byte) 0x00, (byte) 0x1B, (byte) 0x20, (byte) 0x55}; Sound sound = new Sound(soundData, Sound.FORMAT_TONE);
sound.setGain(255);
sound.play(1);
}
Vocês sabem o que pode ser? Ou pelo menos como converter meu arquivo WAV para hexadecimal???