Only One Mp3 Not Playing...

PharCyDeD

Active Member
Licensed User
Longtime User
I have a few mp3's in my project. I know the sound works and the code works because I can hear the other sounds. Here is what I have:

B4X:
Dim SP As SoundPool
   Dim LoadId1, PlayId1, LoadId2, PlayId2, LoadId3, PlayId3, LoadId4, PlayId4 As Int


B4X:
SP.Initialize(4)
      LoadId1 = SP.Load(File.DirAssets, "button-10.mp3")
      LoadId2 = SP.Load(File.DirAssets, "button-6.mp3")
      LoadId3 = SP.Load(File.DirAssets, "button-7.mp3")
      LoadId4 = SP.Load(File.DirAssets, "GameMusic.mp3")

B4X:
PlayId4 = SP.Play(LoadId4, 1, 1, 1, 0, 1)

I added the file to my project and everything but I hear nothing? Is there a limit on playback length or size?? It is only 1:14 and 2mb'ish. GameMusic is the file that won't play.
 
Last edited:

PharCyDeD

Active Member
Licensed User
Longtime User
I tried adding the sound file to the simple SoundPool example and when I do all sounds stop working and the sound doesn't play. Has anyone else experienced anything like this? Should I try to convert the files? Any recommended converters to try?
 
Upvote 0

PharCyDeD

Active Member
Licensed User
Longtime User
Well the file plays fine on my computer, but I am unsure of what makes a sound file "bad" to B4A. Does anyone know the criteria in which B4A looks for in a sound file? I ran the file through a converter that I bought awhile back (and honestly forgot about but finally got to use it again lol) but still have had no results. I just don't understand what makes it unacceptable. Normally I would forget about it and just move to a new file, but I have licensed this particular music for the app. So not using the file = wasted money
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The audio formats supported by Android are here, there shouldn't be any surprises with MP3, but you could always try converting it to ogg Vorbis.
 
Upvote 0

PharCyDeD

Active Member
Licensed User
Longtime User
I have converted to .ogg, .wav, and even lower quality .mp3. It really doesn't make sense to me :BangHead:
 
Upvote 0

PharCyDeD

Active Member
Licensed User
Longtime User
How do I compare the header? I compared the two by right-clicking and going to properties/details and the only difference I could see is the bit rate is 128 for one and 320 for the other. It says "No" in the protected area for both.
 
Upvote 0

PharCyDeD

Active Member
Licensed User
Longtime User
If anyone is willing to give it a shot at working with it please let me know and I can send the file over.

:sign0163:
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes, I'll pm you my email. I can try it on the few devices I have and see.
 
Upvote 0

PharCyDeD

Active Member
Licensed User
Longtime User
Thanks steve. I sent over the file along with one of the working mp3's as well. Let me know how it goes.
 
Upvote 0

PharCyDeD

Active Member
Licensed User
Longtime User
I tried renaming it to all lowercase and it didn't work still. I even converted to .ogg and renamed it as well with no success. Thank you for giving me something to try though. I am willing to give anything a go in order to get this working. Maybe stevel05 will have good news.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I got your file, when I tried loading it, in the unfiltered logs I got the error message:

Heap size overflow! req size: 1052672, max size: 1048576

and found a corresponding question on stack overflow

Android Soundpool problems - Stack Overflow.

Not good news I'm afraid, perhaps you can play the music with mediaplayer without the two clashing? (I did test is on the stand alone media player and it plays fine).
 
Upvote 0

PharCyDeD

Active Member
Licensed User
Longtime User
Well at least I have my answer now. I can't seem to find anything about the MediaPlayer though. How can I see how it is used? Any example sources available?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…