Android :: Low Level Audio - Latency In SoundPool - AudioTrack For Real Time
Oct 26, 2009
I first have to say that I'm biased, 'cus I like to write music apps (like music generation apps). However, this affects games as well. It's somewhat disappointing how OpenGL has made it into the NDK now but there isn't any NDK methods to get to sound to have faster access. Over the weekend I did some more testing and if you make a "drum" app, for example, and play the sound using either SoundPool or AudioTrack, you will get about a 100ms delay buffer, which is clearly audible (gap).
I made a test app where when you touch the screen, upon the DOWN event, it would play a short sound (like a drum sound). It clearly was not real time responsive or even close - you could hear the delay. I'd be interested to know if anyone who has made a game has any trouble with sounds? It seems like they aren't going to really trigger real time enough if you use SoundPool, for example. Am I completely wrong? Seems like your game is going to perform an action, play a sound, but the sound will have latency which I would think would throw off the game a bit..................
View 12 Replies
Mar 23, 2010
I need to load an audio resource and play it, but I also need to be able to modify some parameters (like the volume, or the playback rate) while the audio is being played. For example, I might want to play a 10 seconds audio stream, and change the volume only after 3 seconds. Is there a way to do it? I've been experimenting a little with AudioTrack without results.
View 5 Replies
View Related
Feb 13, 2010
I'm trying to figure out how to write an app that can decode audio morse code on the fly. I found this document which explains how to record audio from the microphone in Android. What I'd like to know is whether it's possible to access the raw input from the microphone or whether it has to be written/read to a file.
View 3 Replies
View Related
Oct 26, 2010
I can use AudioRecord to pull the audio data out. But the format is PCM, which is too huge to sent out through network. Does any one know how to change it to AMR ?
View 2 Replies
View Related
Sep 19, 2009
What are my options for playing simultaneous audio on an Android device with the least amount of latency? Am I going to get anything half decent out of the canned SDK, or is that asking too much? The documentation claims that the SoundPool class is capable of playing multiple sounds simultaneously with relatively good performance, but after running some tests in the emulator and on a physical device it seems pretty weak. Is there maybe a trick to it, or do I have to go to a much lower level api for this kind of thing? I've tried using a single sound pool with multiple samples loaded, and I've tried multiple sound pools each managing a single sample. I'm preloading everything, so that when I attempt to play back I have no additional code being executed other than the call to SoundPool.play().
View 2 Replies
View Related
Apr 12, 2010
Despite everything I have read about the difficulty of making low latency audio apps in Android, I am giving it a shot. To start, I loaded each note in an octave into a SoundPool, and then looped through each note that was to be played on that beat and called play(). This didn't even come close to being accurate enough for me, and got especially bad if a lot of notes were being played at once.
From what I read, the only way to do something like this is to mix the audio yourself, though I am not entirely sure how to go about this. My initial thought is that for each beat, I could precompute the sound the sound that is to be played (i.e., combine the wav's), and then pass that stream to an AudioTrack when it is time to be played.
Are there any good examples out there for how to mix audio like this, or libraries I could use to do this for me? How have coders of other music apps dealt with this?
View 8 Replies
View Related
Sep 29, 2010
This might not be a big deal to most but today, I went to the Android market looking for a music app, something like NanoStudio for iPhone. I found a lot of 2nd rate loop creation synth nonsense. After trying different free versions of paid software I asked myself "why are there no good music apps for Android?"
I emailed the creators of NanoStudio to ask if there are any plans to release an Android version of their software. here is the reply: "Not until they get their act together with audio latency, no. Shame really because NanoStudio's written to be cross platform" This greatly disappointed me. I am a music producer going on 10 years (hip hop, Trip hop, Electronic, etc..) so you can understand my interest in this issue. iphone, iPod have amazing music apps of this sort. Android has nothing close.
View 12 Replies
View Related
Oct 10, 2010
If the Mods decide to delete this and direct you to the OP then thats fine. I just want to spread awareness if this issue. This might not be a big deal to most but I went to the Android market looking for a music app, something like NanoStudio for iPhone. I found a lot of 2nd rate loop creation synth nonsense. After trying different free versions of paid software I asked myself "why are there no good music apps for Android?"
I emailed the creators of NanoStudio to ask if there are any plans to release an Android version of their software. here is the reply: "Not until they get their act together with audio latency, no. Shame really because NanoStudio's written to be cross platform" This greatly disappointed me. I am a music producer going on 10 years (hip hop, Trip hop, Electronic, etc..) so you can understand my interest in this issue. iphone, iPod have amazing music apps of this sort. Android has nothing close.
View 2 Replies
View Related
May 20, 2009
I just found that left/right channels are swapped when calling SoundPool.play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate), running in 1.1 emulator on MacOS. Unfortunately I'm far away from my G1 headset (with proprietary connector) so I can't check if the behavior is the same.
View 2 Replies
View Related
Apr 13, 2010
I'm in the process of wring a music player that can play SID tracks (music from the Commodore 64), and everything is progressing nicely, except that I sometimes get audio stuttering.The stuttering only happens when the player is in the background, and another application has focus. It's most noticeable when a cpu heavy app(like Google Earth) is running in the foreground.I have tried adjusting the priority of my thread and increasing the AudioTrack buffer size, but nothing has solved the stuttering problem.I believe the problem is that generating the audio takes quite a lot of cycles (I'm at 15-30% cpu load), and that my audio thread is being starved and cant keep up with AudioTrack's constant need for data.I'm must be doing something wrong, I can't imagine that gui threads should be able to starve a high priority audio thread.I hope someone have some ideas on how to get my player stutter free, as I'm at a loss :)
View 9 Replies
View Related
Dec 15, 2009
I am trying to play a 0.1s tone using audio track. I have done this succesfully in stream mode by calling play() then writing the array of short containing the data. However when I use STATIC mode and also in stream mode if I write the data before i call play() only about 0.06s of the audio is played. I have tried changing the buffer size but this has not effect.My understanding is that I have to write the data before I call play for static mode to work. Does anyone know what could be going wrong here?
View 5 Replies
View Related
Dec 29, 2009
I am trying to play raw audio samples ( 16 bit, stereo, @ 32000KHz) using AudioTrack, in "MODE_STREAM" mode. I could play the first video buffer successfully but, After having received "onMarkerReached" for that raw audio buffer, I wonder how to push more audio data in AudioTrack ? without closing/stopping it. Writing more data to AudioTrack in "onMarkerReached" callback does not help. I am using the same thread to construct the AudioTrack and pump in audio - buffers and receive callbacks.
View 2 Replies
View Related
Dec 25, 2009
I need to stop the AudioTrack, regardless what's in the buffer, immediately when executing the stop/release. The AudioTrack plays in the STREAM mode. It appears that the AudioTrack finishes playing what's in the buffer and than stops. It seems that it's such a fundamental flaw since there are so many audio applications out there.
View 4 Replies
View Related
Aug 9, 2010
I'm looking for some way in Android to play in-memory audio in a manner analogous to the waveOutOpen family of methods in Windows programming. The waveOut... methods essentially let an application create arrays of sample values (like in-memory WAV files without the headers) and dump them into a queue for sequential playback. Windows transitions seamlessly from one array to the next, so as long as the application keeps dumping arrays into the queue ahead of playback, the program can create and play continuous audio of any arbitrary length. The Windows API also incorporates a callback mechanism that the application can use to indicate progress and load additional buffers.
As far as I can tell, the Android audio API lets an application play a file from local storage or a URL, or from a memory stream. Is there any way to get Android to "queue up" MediaPlayer.start() calls so that one player transitions (without glitches) into the next upon play completion? It appears that Jet does something like this, but only with its own internal synthesis engine. Is there any other way of accessing Android audio in a waveOutOpen way?
View 1 Replies
View Related
Nov 6, 2009
I want to capture audio and along with the audio I also want to show the live signal strength of the audio on the screen.
Is there ant api that give me information regarding the the loudness level (or at least some information indicating whether the user is silent or speaking something) of the audio or should I implement my own signal processing using the captured buffers and determine the level.
View 2 Replies
View Related
Jun 27, 2010
if it was possible to route audio files from the phone to a bluetooth headset on versions of Android API Level 7 and under (so versions older than the new Froyo) If so, do you know of any sample code I could look at to figure out how to do this? Or perhaps just point me in the right direction?
View 2 Replies
View Related
Nov 11, 2010
Is there an app that lets you view your frames per second in real time in video games and emulators?
View 2 Replies
View Related
Sep 23, 2009
Is there a way to manage the audio levels through an app? Or is it more dependent on the phone's built in capabilities? Right now at work I listen to a skype audio call from my house (for security) at a very low volume and then at a higher level I listen to music or podcasts, both sources going at the same time. When my dog goes nuts, the door is knocked on, or (in theory) if someone busted down my door, I notice the change in volume and sound, turn off my local media, and focus on what I'm hearing until the drama passes.
I ask because I would like to continue this setup when not at work, like say while running, where I again have earphones in and am normally listening to audio content. I would like to be able to have two pieces of audio: music combined with a skype stream or normal phone call, going at the same time like at work. So is there a way to have two sources going at the same time, with the volume of each independently adjustable? Is this an app thing or a phone thing? Phone will be Sprint Hero.
View 1 Replies
View Related
Jul 28, 2010
After a round of hassle (many thanks to sontaikle), finally i managed to do some screen capture from my Android but right now I am thinking about this. Is there any way I can do a REAL TIME phone simulation on my PC. Its alike TV output from phone to projector (Galaxy S can do that) but I have other Android which have no TV output function from the phone, so I wonder if I connect the phone to PC and get the real time screen output (few second lagging is ok for me as well) to PC than I can project it out via projector during discussion, presentation. I have tried this Emulator, too bad its doesn't project that on the phone on PC. How to install Android SDK and play with Android 2.0 in the emulator - Android and Me
View 1 Replies
View Related
Feb 15, 2010
I am currently trying to braodcast real time voice from Android using RTP to other Android phones connected over Wifi Ad-hoc network. I have few questions in this regard,
1. How to control and set the RTP on Android? 2. Which Codec are supported by Android for voice communication? and how to incorporate them?
We are able to record a voice from microphone and store it on SD card for a playback. The next step would be to link the outstream of real time voice with RTP also incorporating Codec
View 2 Replies
View Related
Jun 10, 2013
I was wondering why Android keeps lagging a bit. I mean, quadcore should be fast enough to stop that from happening right? So I started Googling.
I got this article: [URL] .....
Basically it says this: Android's UI rendering thread does not work in real-time (the priority is not set at that), unlike iOS'. It's just about the one thing that's still better about iOS in my opinion.
How to make this thread render in real-time?
View 1 Replies
View Related
May 1, 2010
What do you think of the audio level on the speaker of the incrediable?
I feel it is low and weak compared to the Motorola Droid.....
View 5 Replies
View Related
Feb 25, 2010
I know you can apply Permissions for Applications on it's manifest.xml file. What I want to know is, can those Permissions be adjusted by the Applications on the fly?Here's my reason: say I have an application that is allowed to do "x", "y", and "z" (SMS, sockets, etc) Permissions. Now lets say I have a logical "user" that connects to this Application, and I want that user to only be able to do "x" and "y", but not "z" Permissions. It would be nice to have the Android Framework handle that instead of having a bunch of "if's" in the App code.
View 1 Replies
View Related
Mar 13, 2010
I developed and published a game about two months ago. Since then, I've received several negative comments about input lag in the game. Before releasing the game, I already took several measures to hopefully prevent lag from occurring: 1) Game is almost entirely written in native code 2) After initialization, my process never invokes the GC during gameplay (no GC executions from my process show up in the log) 3) Average FPS is generally > 30 fps 4) I tested the game on both a Motorola Milestone and an HTC Magic and I don't experience any noticeable input lag (except perhaps when the GC is executed by other processes) My guess is that the lag that users are experiencing is a result of the GC being invoked by another process. Has anyone been able to address this issue? Specifically, have any game developers been able to achieve a completely lag-free game and thus avoid negative ratings that drag down your app? The only other suspicious thing I've noticed is the following lines showing up in my log any time a SoundPool clip is played: D/AudioHard wareMot ( 1054): AudioMgr:AudioStreamOutMot::standby called D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 entering standby D/AudioHardwareMot( 1054): AudioMgr:Closing stereo device D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 exiting standby
View 1 Replies
View Related
Jul 1, 2010
I need to make a video as a DEMO for one application I have developed. I know that there are some experimental applications that use DDMS and achieve a framerate of 5-6 fps. This framerate is completely insufficient for my purposes since the application has smooth animations that i would like to show. Is there anyone that has found a way to do a real time screen capture on android? Should I settle for a capture of the emulator or a real video done with a real camera?
View 2 Replies
View Related
Sep 9, 2009
I want to know the state of SD card is dynamic mounted or not mounted? it's very kind of you if you can give me a demo(for example, use api register Receiver、Broadcast Receiver、on Receive and so on).
View 5 Replies
View Related
Feb 12, 2009
i need to know about the LocationListener() working in the real time. Does it expect the user(device) to move in order to update the current location details or it automatically updates when ever the gps is enabled? Another query is regarding the getLastKnownLocation(). When is that last known location will be lost and thus returns null... (in realtime).
View 3 Replies
View Related
Nov 9, 2009
Is there an app for real-time(or at best, delayed) stock reads? I have two apps on my Bold(one real-time and one delayed) and before I switch Id like to make sure Im not losing every application I currently use.
View 2 Replies
View Related
Jul 27, 2010
Is there anyway to adjust the audio level out of the Captivate? When I hooked it up to my car stereo to play Pandora, I had to max out the volume on the car stereo just to be able to hear it. I don't listen to music at outrageous levels. If I listen to a CD or the radio, the volume level is between 10 and 25. With the Captivate it is 40 and still not as loud as the radio.
View 2 Replies
View Related
May 1, 2010
I would like to know if somebody knows a library to changing the playback rate of a track in real time. My idea is to load a track and change its playback rate to half or double. Firstly, I tried with MusicPlayer but is was not possible at all and then I tried with SoundPool. The problem is that with SoundPool I cant change the rate once the track is loaded. Here is the code I am using (proof of concept): Code...
View 8 Replies
View Related