Questions tagged [soundpool]

Android API : The SoundPool class manages and plays audio resources for applications

594 questions
4
votes
4 answers

Why does my SoundPool sound not play the first time on Android?

I've got a got a curious problem with playing Ogg Vorbis sounds on Android that I'm having difficulty correcting. I'm using the SoundPool class to play sounds. It works great with the exception of the first sound that I play after a pause. Here's…
user656698
4
votes
3 answers

Android the fastest way to load and play sound in application

I'm working on a project in which I have to load 6 different sounds in one activity and play all sound on button click.The sound file are not so big,but the problem is that maybe they will be more.So my question is which is the fastest way to load…
Android-Droid
  • 14,365
  • 41
  • 114
  • 185
4
votes
1 answer

SoundPool.Builder explained to a newbie

I have searched and read several SoundPool questions and how to construct it in Android Studio in Kotlin language for atleast an hour but I do not understand and I can't get it to work. The videos usually just writes code and does not explain what…
Noccis
  • 63
  • 1
  • 7
4
votes
3 answers

Android SoundPool.stop does not seem to work

I have created a class MySoundPool (I am using this class as sigelton, but don't think this is relevant as everyting else works). I am initianalizing SoundPool, a HashMap, and get the context for AudioManager. Thereafter I am loading two…
Addi
  • 1,099
  • 1
  • 12
  • 17
4
votes
3 answers

Android Soundpool.play() not working in release buld

I'm trying to build an app that records sounds and then plays them back. The recording part works perfectly but when I try to replay the sound it does nothing. When I run it in the debugger and step trough the steps to play the audio, it works. When…
Minion91
  • 1,911
  • 12
  • 19
4
votes
1 answer

Beep sound played in a loop stops after some time for both SoundPool and MediaPlayer

I try to play a short .mp3 sound (beep) continuously, 100 times a minute. It plays around 30-45 times correctly (more on newer devices), then it stops for some time (~30 seconds), and then plays again (~10 times only). I tried both SoundPool…
KlimczakM
  • 12,576
  • 11
  • 64
  • 83
4
votes
3 answers

Android SoundPool cutting sound file short

I'm fairly new to Android so be gentle! I have the following code, which should (I think) just play "developersshort". public constructor(Context context){ this.context = context; soundPool = new SoundPool(2, AudioManager.STREAM_MUSIC,0); …
4
votes
2 answers

Why are my SoundPool sounds not playing simultaneously in onClick()?

When I click, the following code leads the two sounds to be played not simultaneously, but sequentially. Why are they not played simultaneously? @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Doug Bradshaw
  • 1,452
  • 1
  • 16
  • 20
4
votes
2 answers

SoundPool not playing sounds

I made a SoundManager class that uses SoundPool functions in order to loop a specific sound, however I can't figure out why it isn't playing a sound. public class SoundManager { private SoundPool mSoundPool; private HashMap
Chris Fogarty
  • 61
  • 1
  • 4
4
votes
1 answer

Heap size overflow issues with sound clips

I'm creating an Android app that involves multiple short sound clips. At the moment, I'm using SoundPool to load my sound clips once a 2nd activity is begun by the menu activity. The problem I seem to be having is that once this secondary activity…
Fizz
  • 3,427
  • 4
  • 27
  • 43
4
votes
1 answer

How to disable the wired headset programmatically in Java

Please refer my question here. This question is an extension to that: How to check and redirect audio between wired headset and speaker phone? I was able to partially solve my problem by including the permissions
SoulRayder
  • 5,072
  • 6
  • 47
  • 93
4
votes
2 answers

Android Soundpool Load(String path, int priority)

I am trying to load a sound from android. The sound is under res/raw/myownsound.wav. I know that I can already load the sound using: soundPool.load(context, R.raw.myownsound, 1) For customization purposes, I would like to load it using: …
Mikaël Mayer
  • 10,425
  • 6
  • 64
  • 101
4
votes
0 answers

ANR pop up while we use SoundPool to play music in seperate thread

The project still pop up ANR while we had used Thread to play music. --Herewith the ANR keyDispatchingTimedOut log and the SoundManager for reference----- -- log begin ---: DALVIK THREADS: (mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0) "main"…
IceMark
  • 51
  • 2
4
votes
3 answers

Can soundPool be played in oncreate()?

I am working on an app, wherein when a new activity is started, it should start playing a sound. So I used mediaplayer to play the sound in oncreate and It worked fine. But when I tried to use soundpool instead, by loading and playing it in oncreate…
Adarsh H S
  • 1,208
  • 6
  • 21
  • 42
3
votes
1 answer

AudioCache Heap size overflow issue req size: 1053184, max size: 1048576

I am developing an app where i want to play two mp3 files simultaneously one as background music and want to control the sound of each player separately. The file size is 5 mb each i have done with main audio file but when i try to play second file…
Mahesh
  • 1,257
  • 1
  • 14
  • 24