Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>All native Android audio is <a href="http://en.wikipedia.org/wiki/Audio_compression_%28data%29" rel="nofollow noreferrer">encoded</a>. You can only play out <a href="http://en.wikipedia.org/wiki/PCM" rel="nofollow noreferrer">PCM</a> formats in real time, or use a special <a href="http://en.wikipedia.org/wiki/Streaming_media" rel="nofollow noreferrer">streaming</a> codec, which I don't think is trivial on Android.</p> <p>The point is that if you want to record/play out audio simultaneously, you would have to create your own audio buffer and store raw PCM-encoded audio samples in there (I'm not sure if you're thinking <em>duh!</em> or whether this is all over your head, so I'll try to be clear but not to chew your own gum).</p> <p>PCM is a digital representation of an analog signal in which your audio <a href="http://en.wikipedia.org/wiki/Sampling_%28signal_processing%29" rel="nofollow noreferrer">samples</a> are a set of "snapshots" of the original acoustic wave. Because all kinds of clever mathematicians and engineers saw the potential in trying to reduce the number of bits you represent this data with, they came up with all sorts of <a href="http://en.wikipedia.org/wiki/Lossless_data_compression" rel="nofollow noreferrer">encoders</a>. The encoded (compressed) signal is represented very differently from the raw PCM signal and has to be decoded (en-<em>cod</em>-er+<em>dec</em>-oder = <em>codec</em>). Unless you're using special algorithms and media streaming codecs, it's impossible to play back an encoded signal like you're trying to, because it's not encoded sample by sample, but rather frame by frame, where you need the whole frame of samples, if not the complete signal, to decode this frame.</p> <p>The way to do it is to manually store audio samples coming from the microphone buffer and manually feeding them to the output buffer. You will have to do some coding for that, but I believe there are some open-source apps that you can look at and take a peak at their source (unless you're willing to sell your app later on, of course, but that's a whole different discussion).</p> <p>If you're developing for Android 2.3 or later and are not too scared of programming in <a href="http://en.wikipedia.org/wiki/Java_Native_Interface" rel="nofollow noreferrer">native code</a>, you can try using <a href="http://www.khronos.org/registry/sles/specs/OpenSL_ES_Specification_1.0.1.pdf" rel="nofollow noreferrer">OpenSL ES</a>. The Android-specific features of OpenSL ES are listed <a href="http://mobilepearls.com/labs/native-android-api/ndk/docs/opensles/" rel="nofollow noreferrer">here</a>. This platform allows you somewhat more flexible audio manipulation and you might find just what you need, if your app will be highly reliant on audio processing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload