soundpool

Android Soundpool problems

 ̄綄美尐妖づ 提交于 2019-12-01 02:24:25
问题 I've got an app on the Android Market and have been using the SoundPool classes for the sound effects. I've noticed that, of all the parts of the Android API, this seems to have caused me the most problems. For example: HTC Desire has problems playing WAV files (this causes it to lock up randomly). Using .ogg files fixes this On the Droid, if you exceed the number of channels in the init setup call: mSoundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0); the handset would lock up. If you

How to play multiple ogg or mp3 at the same time..?

烂漫一生 提交于 2019-11-30 20:21:49
问题 I'm trying to play 20 ogg files at the same time using MediaPlayer. This is because I want to make a mixing effect. While one music is playing, other files also have to be played. Actually, I already made an application with this function by iOS, and it didn't have any problems to play and mix. And now, I should convert this app into android app. so I sentenced 20 mediaplayer variables MediaPlayer player1; MediaPlayer player2; MediaPlayer player3; ..... play1 = (Button)findViewById(R.id.btn1)

Playing two sounds Simutaneosly

China☆狼群 提交于 2019-11-30 19:53:13
I am trying to play two sounds simutaneosly in android.I have created two MediaPlayers and am using the code below.They are currently playing one after another.Or not exactly one after another but kinda delayed into eachother. private void playSound(){ if (mp1 != null) { mp1.release(); } if (mp2 != null) { mp2.release(); } mp1 = MediaPlayer.create(this, soundArray[0]); mp2 = MediaPlayer.create(this, soundArray[3]); mp1.start(); mp2.start(); } Thanks Emile Vrijdags Playing two digital sounds simultaneously is as simple as summing them together (as in the real world), so you could do that

Seamless Looping with SoundPool on Android?

跟風遠走 提交于 2019-11-30 14:50:22
问题 I am trying to loop short (20kb), gapless ogg files with the SoundPool class and cannot get consistent results while testing on hardware. It always plays back perfectly using the emulator but when I test on a Nexus 1, or on a Samsumg Galaxy Tab 10.1 there are audible pops or clicks at every loop point. What is very strange is that while consistent once the application has started, the clicks are slightly different every time I restart the app and on rare occasions (more frequently on the

Android audio : change pitch

為{幸葍}努か 提交于 2019-11-30 14:12:32
问题 The Android documentation for SoundPool says "the application can also alter the pitch by adjusting the playback rate in real-time for doppler or synthesis effects". So I tried to do this, using the setRate method to vary smoothly from one note to another, but the result is awful: the sound variation is very ragged. Here is the code I tried. Please tell me if there is a better way. int streamId = soundPool.play (soundId, 1, 1, 1, 0, 1.0f); for (float x = 0; x < 1; x += 0.005) { SystemClock

Android audio programming nightmare - soundpool, audiotrack arrghh?

可紊 提交于 2019-11-30 13:37:41
I've built a simple music sequencer Android app that plays multiple audio files. Originally I was using SoundPool to play mp3 files and it worked perfectly on 2.3.4 with an old HTC Droid Incredible. Then I tested it on a Galaxy Nexus running 4.3 and the performance was horrendous. The audio timing all over the place and there were glitches/clicks/pops. So I spent several days making a player using AudioTrack including an mp3 decoder and got it working perfectly on both the Galaxy and the HTC. Now I've just tested it on a Nexus 4 (running 4.3) and the performance is terrible - the timing is all

SoundPool error: no more track names available

六月ゝ 毕业季﹏ 提交于 2019-11-30 08:29:03
I'm having troubles with the soundpool class. Here it goes: In my game app (music app btw) I need to reproduce at least 32 short sounds at the same time, so I declare my soundpool like that: private SoundPool sp; sp = new SoundPool(128, AudioManager.STREAM_MUSIC, 0); After that I load all the MP3 sounds needed, about 80 sound of 55KB each. I have no troubles loading all the sounds, but its slow! Well it's no the problem. The real trouble is when I play about 20 sounds at the same time, there's an error in my log: ERROR/AudioFlinger(59): no more track names available ERROR/AudioTrack(26349):

stream volume in SoundPool vs volume in AudioManager

丶灬走出姿态 提交于 2019-11-30 06:29:41
I am so confused... SoundPool.play(int soundID, float leftVolume, float rightVolume , int priority, int loop, float rate) volume here is from 0.0 to 1.0 Tutorials I've seen recommend to calculate stream volume as: AudioManager mgr = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE); int streamVolume = mgr.getStreamVolume(AudioManager.STREAM_MUSIC); streamVolume = streamVolume / AudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, 0, 1f); which makes sense. I would assume that this volume would

SoundPool: Error creating AudioTrack

房东的猫 提交于 2019-11-30 01:12:49
I am having a problem With SoundPool as it refuses to work with my .ogg files. I am getting this error: AudioFlinger could not create track, status: -12 Error creating AudioTrack I've found a thread concerning this and the (possible) answer is: Make sure you use .ogg media files with constant bitrate! Is this the case? (someone please confirm or cancel) If yes - which application to use (Audacity doesn't support .ogg custom export settings). If not - what else could be wrong? As a side note - before I used MediaPlayer but now I want to play a few sounds parallel. MAJOR EDIT: FOUND A WAY TO FIX

Waiting for SoundPool to load before moving on with application

≡放荡痞女 提交于 2019-11-29 14:07:15
I was following a tutorial to integrate SoundPool into my app, and this is the code which was given in the tutorial: package com.example.soundpoolexample; import android.app.Activity; import android.media.AudioManager; import android.media.SoundPool; import android.media.SoundPool.OnLoadCompleteListener; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; public class SoundPoolExample extends Activity implements OnTouchListener { private SoundPool soundPool; private int soundID; boolean loaded =