03-11-2009 10:45 PM
I have a WAV file that should loop just fine but when I try to set looping to infinite it always has a silence gap. I've tried lots of different formats including 8 bit, 16 bit, 11 khz, 22 khz, 44 khz, and different prefetch strategies with no success. This is using the latest eclipse plugin with Storm simulator. I have not yet tried on the actual device but the simulator results are making me nervous. Is there a way to increase the amount of read ahead buffers? Can I load the whole WAV file into memory and not have a silence gap? Is the Player the only way to play audio or can I get lower level access?
Here is code that I wrote which helped reduce the silence gap by prefetching the end at startup but sadly does not completely remove:
//Create a new Player from the InputStream//
_player = Manager.createPlayer(inputStream,"audio/wav");
// prefetch the beginning of wav file
// go to the end of wav file
long duration = _player.getDuration();
// prefetch the end so we don't skip on first play
//Add listener to catch Player events
//Start the Player
This is my first post and my first day at creating an application so please be gentle
Thanks in advanced!
03-12-2009 12:23 AM
03-12-2009 12:52 AM
Thanks for the suggestion. I gave that a shot and it had the exact same result. I also tried handling the BUFFERING_STOPPED event to prefetch and that didn't work either. Anything else I can try?
03-12-2009 12:55 AM
My suggestion sucks, but I will offer it anyways.
Have you considered having 2 player objects, and immediately calling player2.start() when the first player sends an end of media event (with the calls to realize, prefetch, etc. having already been made)?
03-12-2009 01:50 AM
I gave that a shot alternating between two players and got simular results. I think once you get to END_OF_MEDIA there is just going to be a gap in sound no matter what. Unless I could start the player a couple milliseconds prior to this condition but not sure how that could be done unless I launched a thread to monitor playback position.
Are there any options for caching the InputStream?
08-26-2009 10:10 AM
I am facing similar problem. I have tried all the possible ways to skip gap.
And i wonder how to do it ?
If you got the possible solution,then please do help me...
09-03-2009 05:18 PM
I was able to do this by extending one of the Stream classes and making it circular!
I tried everything from 2 players, threads, timers etc. but I finally had success with extending the stream class with my own functions.
Basically... the player thinks my wav file is a couple hours long
09-04-2009 01:07 AM
Hi carmine thanks for the reply...
I even tried millions of things but no success.
You must have done the trick in read() of InputStream.Can you please more describe how you did that?
And How You made it circular ?