audiotrack

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)

using Android's AudioTrack to combine bytes of sound samples produces noise

放肆的年华 提交于 2019-11-30 15:40:20
I'm building a fairly simple Android app (sdk revision 14: ICS) which allows users to pick two audio clips at a time (all are RIFF/WAV format, little-endian, signed PCM-16 bit encoding) and combine them in various ways to create new sounds. The most basic method I'm using for this combination is as follows: //...sound samples are read in to memory as raw byte arrays elsewhere //...offset is currently set to 45 so as to skip the 44 byte header of basic //RIFF/WAV files ... //Actual combination method public byte[] makeChimeraAll(int offset){ for(int i=offset;i<bigData.length;i++){ if(i <

How do you determine the audio latency (AudioTrack) on Android?

微笑、不失礼 提交于 2019-11-30 13:57:47
问题 I have an app in which I use an AudioTrack in streaming mode to play dynamically generated audio. The app doesn't have to respond instantaneously to inputs, so the latency issues don't bother me for that side of the program. The problem is that I have an animation that needs to be as precisely 'in-sync' as possible with the audio and it seems that different devices have different amounts of time between when the AudioTrack stops blocking the write() call and asks for more data, and when that

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

How do you determine the audio latency (AudioTrack) on Android?

╄→гoц情女王★ 提交于 2019-11-30 09:03:27
I have an app in which I use an AudioTrack in streaming mode to play dynamically generated audio. The app doesn't have to respond instantaneously to inputs, so the latency issues don't bother me for that side of the program. The problem is that I have an animation that needs to be as precisely 'in-sync' as possible with the audio and it seems that different devices have different amounts of time between when the AudioTrack stops blocking the write() call and asks for more data, and when that audio is played from the speaker. My current solution gets me most of the way there -- I count the

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):

PCM Raw Bytes [] To Audio on Android

岁酱吖の 提交于 2019-11-30 00:14:26
I currently have a PCM audio in the form of a byte array. The format is signed 16 bit little endian. I would like to convert this to some playable format on the Android, preferably version 3.2 or higher. Does anyone have suggestions on how this can be done? I have done some research and tried the following below, but none were successful. It would be much appreciated if anyone can suggest a better way or indicate where I have gone wrong. I have tried creating an AudioFormat with the correct audio settings, however Android does not support the javax.sound.sampled library. I have also tried

How to tell when AudioTrack object has finished playing?

做~自己de王妃 提交于 2019-11-29 09:24:04
I'm trying to play a PCM file in Android using the AudioTrack class. I can get the file to play just fine, but I cannot reliably tell when playback has finished. AudioTrack.getPlayState says playback has stopped when it hasn't finished playing. I'm having the same problem with AudioTrack.setNotificationMarkerPosition , and I'm pretty sure my marker is set to the end of the file (although I'm not completely sure I'm doing it right). Likewise, playback continues when getPlaybackHeadPosition is at the end of the file and has stopped incrementing. Can anyone help? I found that using audioTrack

AudioTrack Android playing sounds from raw folder

安稳与你 提交于 2019-11-29 07:40:53
Is it possible to play wav files with AudioTrack from the resources folder raw? It tried many ways to reference the raw files in my Android project, but I got a lot of exceptions. This is what I have now, but when I press the button, no sound plays. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button buttonPlayAudioTrack = (Button) findViewById(R.id.buttonPlayAudioTrack); buttonPlayAudioTrack.setOnClickListener(this); int minBufferSize = AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT);

How to convert .pcm file to .wav or .mp3?

妖精的绣舞 提交于 2019-11-28 23:54:35
I am currently developing an Android Application that has audio recording and playing. I am new to dealing with audio and I'm having some trouble with encoding and formats. I am able to record and play the audio in my application, but when exporting I am not able to reproduce the audio. The only way I found was exporting my .pcm file and converting using Audacity. This is my code to record the audio is: private Thread recordingThread private AudioRecord mRecorder; private boolean isRecording = false; private void startRecording() { mRecorder = new AudioRecord(MediaRecorder.AudioSource.MIC,