0

So far all mp3 files I've tried work just fine, however, when trying a file I converted from Vorbis format it just wouldn't play.

No errors or anything, it's just that it doesn't make any sound.

Tried multiple converting apps.

Any way this can be solved?

InputStream iStreamSound = getClass().getResourceAsStream("file.mp3"); 
Player p = Manager.createPlayer(iStreamSound, "audio/mp3");
p.start(); 
Lior
  • 5,454
  • 8
  • 30
  • 38

1 Answers1

1

Ogg is a container format. Vorbis is a compression mechanism/scheme for data meant to be stored in an ogg container. However, an ogg file can contain data compressed by means other than Vorbis. As such, I would first check the scheme used for the original file and then look at how that was converted for your mp3. I've found many j2me sound players to be fairly finicky, so it could just be that the underlying data structures aren't supported.

The most thorough way I can think of to convert it would be to take the .ogg first to a .wav file, then convert that to .mp3 if possible. Just make sure the wav->mp3 conversion uses a compression type that your handset supports.

Laughing_Jack
  • 1,603
  • 15
  • 14
  • Tried converting it to a .wav file and then to .mp3, didn't work unfortunately. Are there any other encoding formats I can try that work on Nokia phones? – Lior Dec 06 '12 at 16:20
  • It largely depends on the handset. I assume you're using mp3 for the compression, but as a test I would suggest you create a small sound bite (around 5 seconds) in different formats, starting with wav (remember that you can try changing bit depth, stereo/mono, etc) and moving to other formats like mp3. If you have mp3 working for another sound clip, look at the info for the working sound clip and use that in creating your new/test clip. Also, you might try editing the clip to snip the first and/or last couple of seconds of it, trying to make sure it doesn't have any un-filled packets. – Laughing_Jack Dec 11 '12 at 19:08
  • Literally tried everything, but no luck. I ran my program today on a computer that ran XP, and to my surprise I suddenly heard music playing. Not sure if this is related to the OS, but I did run it on several Windows 7 computers, none of them played the music. So bottom line, is must have something to do with the emulator. Do you have any idea as to how this can be fixed? – Lior Dec 15 '12 at 22:02
  • If it's an OS difference causing the problems, it might just come down to a crap MMAPI implementation. http://docs.oracle.com/javame/dev-tools/wtk-cldc-2.5.2-01/BinaryReleaseNotes.html mentions that there are known (unreproducible) errors in the Player implementation. If you can, either ditch the emulator for on-device functionality testing here (you'll need to eventually do that anyway) or try a different emulator. Sadly, MMAPI is one of the worst problems in J2ME porting. – Laughing_Jack Dec 17 '12 at 21:52
  • Oh well, I guess this is currently my only option. Thanks! – Lior Dec 19 '12 at 20:33