On Tue, Jun 23, 2009 at 3:11 AM, Katsiaryna <[email protected]>wrote:
> > Hello, > > I am trying to use SoundPool class from the new SDK. However, I > discovered that if I load sounds that are >100K (120K and 350K) from > resources I have problems playing them. The error messages that I get > are as follows: > > 06-23 10:53:42.263: ERROR/AudioFlinger(35): not enough memory for > AudioTrack size=1048640 > 06-23 10:53:42.263: DEBUG/MemoryDealer(35): AudioTrack (0x25018, > size=1048576) > 06-23 10:53:42.263: DEBUG/MemoryDealer(35): 0: 0002aaf0 | > 0x00000000 | 0x00090940 | A > 06-23 10:53:42.263: DEBUG/MemoryDealer(35): 1: 0002ab78 | > 0x00090940 | 0x0006F6C0 | F > 06-23 10:53:42.263: DEBUG/MemoryDealer(35): size allocated: 592192 > (578 KB) > > Consequently, the playback never starts. > > Curiously, the numbers in the message do not seem to change with sound > files of different sizes: whether it is 120K or 350K, it always says > "not enough memory for AudioTrack size=1048640". Also, when I load the > sounds I see numerous messages in the log saying "06-23 10:53:35.743: > ERROR/AudioCache(35): Heap size overflow! req size: 1052672, max size: > 1048576". > > So, is there any "official" size limit on the size of the files you > can play, or are there any settings to adjust to solve this problem? > The test application where I get this doesn't actually do anything > else but loads and tries to play these sounds, so I do not think that > it is the problem of it using too much memory overall. I also tried > both .ogg and .mp3 files - equally without any success. That 120KB mp3 is decoded in to memory by SoundPool, and will expand to something much bigger. The exact numbers depend on the bitrate, sample rate and number of channels, but as an example, a 100KB, 128kbit mp3 has a playback time of over 7 seconds, and if it's 44KHz stereo it will be about 1.3 megabyte when decoded. SoundPool is meant for short, sound effect style sounds that require very low latency and low CPU overhead. For longer sounds, you should use MediaPlayer. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

