• Post Reply Bookmark Topic Watch Topic
  • New Topic

Interesting Problem - Creating and playing .wav files  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to play a .wav file, with MIDP 2.0 and CLDC1.1 as follows :
ByteArrayInputStream in = new ByteArrayInputStream(dataBuffer);
Player p = Manager.createPlayer(in, "audio/x-wav");
I actually at runtime generate a .wav file(in the dataBuffer) from input PCM samples of sound data, and try ot play the wave. I have 4 buffers which I first fill and then send for playing
After filling 1-2-3 buffers, I start the playing 1st and filling 4th, (the buffers are being filled by a different thread than the one which is playing)
My problems is that after playing the 1st buffer the player cries "out of memory" and doesnt play the second buffer on wards...as a result i just hear one sec of song and then nothing

Questions :
1) Can we play a wave like this through a buffer, I believe theoritically its possible...but then I am still a novice in J2ME and so maybe wrong.
2) I believe that the problem above is occouring in the player, is there a way to avoid this.
3) I require to append the .wav file header to each buffer i play... Can I avoid this issue ? and by some way just create a header once and just process the wav data in buffers later on ?

I would really appreciate help on any of the above issues.
I am a programmer working on developing mobile music solutions on Nokia & Erricson handsets.

Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!