Android Question Faster audio response time

JamesGreaves

Active Member
Licensed User
The fastest way to get an audio response, that I have found is by pre-loading an audio file, then using Touch action in a panel to play it with MediaPlayer. However there is still a slight delay.
Is there any faster method that anyone knows of?

B4X:
Sub Globals
    Dim MP As MediaPlayer
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
    MP.Initialize2("MP") '  Sound
    MP.Load(File.DirAssets, "Knock.mp3")
End Sub

Sub Panel1_Touch (Action As Int, X As Float, Y As Float)
    MP.Play
End Sub
 

sorex

Expert
Licensed User
if it is just a sound effect that ain't too long then you can try to convert your .mp3 to a .wav file. it might be faster since it's a lot easier to decode and play
but if it will be enough to remove all delay I don't know.
 
Top