~/blog/using-audx-android-in-jetpack-compose.md

Real-time audio denoising in Jetpack Compose with audx-android

2026-11-23#android#compose#audio#audx20 min read


Suppose you are building a voice recorder. The microphone captures your voice, but it also captures the fan beside your desk. Before saving or sending that recording, you want to reduce the background noise.

audx-android handles that processing. It uses RNNoise, a neural network for suppressing noise in speech, and also reports how likely each piece of audio is to contain a voice. That second feature is called voice activity detection, or VAD.

In this guide, we will build a Compose screen with a microphone permission button, a start/stop button, and a live voice activity meter. The app will process microphone audio with audx-android v3.0.0. Playback and saving audio are separate steps, so you will see the meter change without hearing audio from the speaker.

You should already be able to run an Android Studio Empty Activity project with Kotlin and Compose, and recognize a function, a class, and a lambda such as { value -> ... }. We will explain the audio terms and the coroutine tools as we use them.

First, follow the audio

There are two results to keep separate: cleaned audio samples and a VAD probability. The samples are what you would save or transmit. The probability is what we will display on screen.

Read this diagram from top to bottom. Each arrow passes data to the next step:

Audio flows from the microphone through AudioRecord and a ShortArray into Audx, which produces cleaned samples and a VAD probability for Compose.

AudioRecord is Android’s microphone recording API. Audx processes audio that we give it. It does not open the microphone or draw the interface.

For example, if Audx reports 0.82f, our screen will show VAD: 0.82. We will choose 0.5f as the threshold for displaying “Speech detected”. This is an estimate of voice activity, not a measure of loudness or a guarantee that the cleaned audio sounds good.

1. Set up the Android project

Use minSdk 24 or higher and compileSdk 36 or higher for this library version. The tagged library targets Java 21, so use a toolchain that supports consuming Java 21 bytecode. The v3.0.0 build configuration is the reference if Gradle reports a compatibility error.

In the project’s settings.gradle.kts, add JitPack inside the existing dependency repositories block. JitPack is the repository Gradle uses to find Audx:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven("https://jitpack.io") // Makes the Audx dependency available.
    }
}

In app/build.gradle.kts, add the dependencies below to the existing dependencies block. Keep the Compose dependencies generated by Android Studio, including Material 3 and Activity Compose.

dependencies {
    implementation("com.github.rizukirr.audx-android:audx:v3.0.0")

    // Connect ViewModel state and screen lifecycle to Compose.
    val lifecycleVersion = "2.11.0"
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
    implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion")
    implementation("androidx.lifecycle:lifecycle-runtime-compose:$lifecycleVersion")
}

If your project already declares these Lifecycle libraries, use its compatible version consistently rather than adding duplicate declarations. Audx also brings in Kotlin coroutines, which we will use to process audio away from the UI thread.

Next, add this permission directly inside the existing <manifest> element of app/src/main/AndroidManifest.xml, before <application>:

<!-- Declare that this app uses the microphone. -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />

The manifest declares what the app needs. Android still asks the person using the app to grant access at runtime. We will add that request to the screen later.

Sync Gradle now. Resolve dependency or SDK errors before adding the audio code.

2. Understand one piece of audio

A microphone recording is a sequence of numbers. Each number, called a sample, describes the sound at one moment.

We will use these settings throughout the example:

Term Meaning Our setting
Sample rate How many samples represent one second of audio 16,000 samples per second, or 16 kHz
Mono One audio channel One microphone signal
PCM16 Raw audio stored as signed 16-bit numbers Kotlin Short values
Chunk A small piece of the recording passed to the processor 10 milliseconds of audio
Buffer An array that holds samples while we work on them A ShortArray

The chunk size comes from the sample rate:

16,000 samples per second x 0.010 seconds per chunk = 160 samples per chunk

160 samples x 2 bytes per Short = 320 bytes per chunk

These units matter. AudioRecord.getMinBufferSize() returns a size in bytes, while AudioRecord.read() with a ShortArray uses a count of samples.

RNNoise itself works with 480 samples at 48 kHz, also 10 milliseconds. Setting Audx’s input rate to 16_000 tells it to convert our audio to that internal rate and convert the result back. This conversion is called resampling. We still provide 160 input samples and receive 160 output samples per call.

Look at the processing call first

Before adding a microphone or a screen, look at the smallest processing example. This is an isolated example to read or run on a background thread in an Android app. You do not need to paste it into the files we will build below.

import com.audx.android.Audx

fun processSilentChunk() {
    // The rate must match the audio we will give Audx.
    val audx = Audx.Builder()
        .inputRate(16_000)
        .resampleQuality(Audx.AUDX_RESAMPLER_QUALITY_VOIP)
        .build()

    try {
        val input = ShortArray(160) // Zero-filled samples represent silence.
        val output = ShortArray(160) // Audx writes cleaned samples here.

        audx.process(input, output) { probability ->
            // The callback receives the voice activity estimate.
            println("VAD: $probability")
        }
    } finally {
        // Audx owns native memory that must be released.
        audx.close()
    }
}

Builder lets us configure the processor before build() creates it. The VOIP quality setting is intended for voice communication. We will keep that setting for the tutorial.

Follow the values through this call:

  1. ShortArray(160) creates 160 zeros, representing 10 milliseconds of silence at 16 kHz.
  2. audx.process(input, output) processes that chunk and writes the audio result into output.
  3. The lambda receives a probability and prints a line beginning with VAD:. Its exact value comes from the model.
  4. finally calls close(), even if processing throws an exception.

The callback receives a Float. The cleaned audio is in output. Audx deliberately fills the first processed chunk with silence to suppress startup noise, so the first output alone is not a useful quality test.

Remember the shape of this call: audio goes into one array, cleaned audio goes into another, and a probability goes to the callback. We will reuse one processor for all chunks in a recording session.

3. Turn the microphone into a stream of chunks

Create MicRecorder.kt beside your MainActivity.kt. Keep the same package declaration Android Studio generates at the top of each Kotlin file in this guide, followed by the imports shown.

We need to deliver many chunks over time. A Kotlin Flow represents a sequence of values that arrive over time. Here, each value is a ShortArray containing one complete chunk. Calling frames() prepares the flow. Recording begins when another part of the app starts collecting it.

import android.annotation.SuppressLint
import android.media.AudioFormat
import android.media.AudioRecord
import android.media.MediaRecorder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.isActive

class MicRecorder {
    companion object {
        const val SAMPLE_RATE = 16_000
        const val FRAME_SIZE = 160 // 10 ms at this sample rate.
    }

    // The screen must obtain runtime permission before collecting this flow.
    @SuppressLint("MissingPermission")
    fun frames(): Flow<ShortArray> = flow {
        val minBufferBytes = AudioRecord.getMinBufferSize(
            SAMPLE_RATE,
            AudioFormat.CHANNEL_IN_MONO,
            AudioFormat.ENCODING_PCM_16BIT,
        )
        check(minBufferBytes > 0) { "Unsupported microphone configuration" }

        // Android's internal buffer is measured in bytes, unlike ShortArray.
        val recorder = AudioRecord(
            MediaRecorder.AudioSource.VOICE_RECOGNITION,
            SAMPLE_RATE,
            AudioFormat.CHANNEL_IN_MONO,
            AudioFormat.ENCODING_PCM_16BIT,
            maxOf(minBufferBytes, FRAME_SIZE * 2 * 4),
        )

        try {
            check(recorder.state == AudioRecord.STATE_INITIALIZED) {
                "Microphone failed to initialize"
            }
            recorder.startRecording()
            check(recorder.recordingState == AudioRecord.RECORDSTATE_RECORDING) {
                "Microphone failed to start"
            }

            val buffer = ShortArray(FRAME_SIZE)
            var filled = 0

            while (currentCoroutineContext().isActive) {
                // Return promptly so cancellation can stop the loop.
                val count = recorder.read(
                    buffer,
                    filled,
                    buffer.size - filled,
                    AudioRecord.READ_NON_BLOCKING,
                )
                check(count >= 0) { "Microphone read failed: $count" }

                if (count == 0) {
                    delay(5) // Wait for more audio without spinning the CPU.
                    continue
                }

                // A read may return fewer samples than requested.
                filled += count
                if (filled == buffer.size) {
                    emit(buffer.copyOf()) // Give the collector its own full chunk.
                    filled = 0
                }
            }
        } finally {
            try {
                if (recorder.recordingState == AudioRecord.RECORDSTATE_RECORDING) {
                    recorder.stop()
                }
            } finally {
                recorder.release() // Release even if stop() fails.
            }
        }
    }.flowOn(Dispatchers.IO)
}

There are three parts to understand here: creating a recorder, assembling complete chunks, and releasing the recorder when collection ends.

getMinBufferSize() asks Android how large its recording buffer must be. We use at least that many bytes, with room for at least four of our chunks. This internal buffer and the ShortArray serve different purposes: Android stores incoming audio in its buffer, and we read that audio into our array.

The loop fills the array before calling emit(), which sends a value to the collector. For example, suppose one read returns 100 samples and the next returns 60. Read this trace from left to right:

filled = 0
    -> read 100 samples into positions 0..99
filled = 100
    -> read 60 samples into positions 100..159
filled = 160
    -> emit a copy of the full 160-sample array
filled = 0, ready for the next chunk

We must not send just the first 100 samples to Audx. For this 16 kHz configuration, its native processor expects a complete 160-sample frame. Copying the array also prevents the recorder from overwriting samples while the collector is using them.

A coroutine is work that can suspend while waiting and can be cancelled when we no longer need it. Dispatchers.IO runs this recording work away from the main thread, which handles drawing and button presses. READ_NON_BLOCKING returns with whatever audio is available. If there is none, delay(5) suspends briefly. This lets the loop notice cancellation without getting stuck waiting for a full read.

The finally blocks stop and release the microphone on cancellation or failure. The screen will not release it directly, which keeps cleanup in the same place as the recording work.

Checkpoint: given reads of 100 and 60 samples, the collector receives one array of 160 samples. It never receives a partially filled array.

Read more: Android’s AudioRecord reference.

4. Process chunks and hold the screen state

A ViewModel holds the screen’s data and the work behind it. Compose may rerun a composable function to redraw the screen. That rerun is called recomposition. We want recording to belong to a session managed by the ViewModel, so drawing the screen does not create another recorder.

Create DenoiseViewModel.kt. First, add these imports and the state class:

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.audx.android.Audx
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

// One value describes everything the screen needs to display.
data class DenoiseUiState(
    val hasPermission: Boolean = false,
    val isRecording: Boolean = false,
    val vadProbability: Float = 0f,
    val denoisedSamples: Long = 0,
    val error: String? = null,
)

StateFlow holds a current value and lets the screen observe changes. The ViewModel will hold a mutable version privately and expose a read-only version to Compose. That way, buttons ask the ViewModel to do work rather than changing recording state themselves.

Add this class below DenoiseUiState in the same file:

class DenoiseViewModel : ViewModel() {
    private val _state = MutableStateFlow(DenoiseUiState())
    val state: StateFlow<DenoiseUiState> = _state.asStateFlow()

    private val recorder = MicRecorder()
    private var recordJob: Job? = null

    fun onPermissionResult(granted: Boolean) {
        _state.update { it.copy(hasPermission = granted) }
        if (!granted) stopRecording()
    }

    fun startRecording() {
        if (!_state.value.hasPermission) return
        // Include a cancelling job here so sessions cannot overlap.
        if (recordJob?.isCompleted == false) return

        _state.update {
            it.copy(isRecording = true, denoisedSamples = 0, error = null)
        }

        recordJob = viewModelScope.launch {
            try {
                // Both initialization and processing happen off the UI thread.
                withContext(Dispatchers.Default) {
                    val audx = Audx.Builder()
                        .inputRate(MicRecorder.SAMPLE_RATE)
                        .resampleQuality(Audx.AUDX_RESAMPLER_QUALITY_VOIP)
                        .build()

                    try {
                        val output = ShortArray(MicRecorder.FRAME_SIZE)

                        recorder.frames().collect { input ->
                            audx.process(input, output) { probability ->
                                _state.update {
                                    it.copy(
                                        vadProbability = probability,
                                        denoisedSamples = it.denoisedSamples + input.size,
                                    )
                                }
                            }

                            // Consume output here before the next processing call.
                            // For a queued consumer, pass output.copyOf().
                        }
                    } finally {
                        // Processing has ended before we free its native memory.
                        audx.close()
                    }
                }
            } catch (e: CancellationException) {
                throw e // Stopping a session is normal coroutine cancellation.
            } catch (e: UnsatisfiedLinkError) {
                _state.update { it.copy(error = "Audx native library could not load") }
            } catch (e: Exception) {
                _state.update { it.copy(error = e.message ?: "Recording failed") }
            } finally {
                _state.update {
                    it.copy(isRecording = false, vadProbability = 0f)
                }
            }
        }
    }

    fun stopRecording() {
        recordJob?.cancel() // The recording and processing finally blocks clean up.
    }
}

Follow one chunk through the ViewModel

Pressing Start calls startRecording(). It checks permission and rejects a second session while the previous job is running or cleaning up. A Job is the handle we keep so Stop can cancel that work.

viewModelScope.launch starts a coroutine whose lifetime belongs to the ViewModel. withContext(Dispatchers.Default) moves initialization and processing onto background threads. Inside it, we build one Audx instance and reuse one output array for the entire session.

collect receives each array emitted by MicRecorder.frames(). Suppose a 160-sample input produces a VAD probability of 0.82f:

MicRecorder emits 160 samples. Audx cleans them and reports 0.82 VAD probability. The ViewModel updates state, and Compose displays the result.

it.copy(...) creates a new DenoiseUiState with the changed fields. Fields we do not mention, such as hasPermission, retain their values. The next chunk adds another 160 to the sample count.

The output array is reused to avoid allocating a new one for every processing call. A consumer that keeps the audio for later needs a copy, because the next call overwrites that array. This tutorial leaves a comment at the point where a file writer or streaming connection would consume the audio.

We use synchronous process() because this collector already runs on a background dispatcher. Calls happen one after another, which matters because one Audx instance must not process two chunks concurrently. processAsync() is also available, but it is a suspending wrapper that switches to Dispatchers.Default, not a separate recording session or a parallel processing queue. See the Audx implementation.

Follow Stop through cleanup

cancel() requests that the coroutine stop. It does not mean cleanup has already finished. That is why startRecording() checks isCompleted before allowing another session.

Cancellation ends collection, releases the microphone, and closes Audx after processing leaves its try block. The outer finally resets the screen state. We rethrow CancellationException so a normal Stop does not appear as an error.

We create a fresh Audx instance for each recording session and close it at the end of that session. If the ViewModel is cleared, viewModelScope cancels its work and the same cleanup runs. There is no separate UI call that can close Audx while a processing call is using it.

Checkpoint: the ViewModel sends probability and sample count to the screen. The cleaned audio stays in the processing pipeline.

5. Request permission and display the result

Create DenoiseScreen.kt. The screen observes the state and sends button presses to the ViewModel.

rememberLauncherForActivityResult connects a permission request to its result. collectAsStateWithLifecycle() makes the latest StateFlow value readable by Compose while the screen’s lifecycle is active. We also need to stop the recording itself when the screen stops. Pausing state observation alone does not stop microphone capture.

import android.Manifest
import android.content.pm.PackageManager
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
import androidx.lifecycle.compose.LifecycleStartEffect
import androidx.lifecycle.compose.collectAsStateWithLifecycle

@Composable
fun DenoiseScreen(viewModel: DenoiseViewModel) {
    val state by viewModel.state.collectAsStateWithLifecycle()
    val context = LocalContext.current

    // Android delivers the person's permission choice to this callback.
    val permissionLauncher = rememberLauncherForActivityResult(
        ActivityResultContracts.RequestPermission(),
    ) { granted ->
        viewModel.onPermissionResult(granted)
    }

    LifecycleStartEffect(viewModel) {
        // Recheck permission when the screen starts, including after Settings.
        val granted = ContextCompat.checkSelfPermission(
            context,
            Manifest.permission.RECORD_AUDIO,
        ) == PackageManager.PERMISSION_GRANTED
        viewModel.onPermissionResult(granted)

        onStopOrDispose {
            viewModel.stopRecording() // This demo records only while visible.
        }
    }

    Column(
        modifier = Modifier.fillMaxSize().padding(24.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp),
    ) {
        Text(
            text = when {
                !state.isRecording -> "Ready to record"
                state.vadProbability > 0.5f -> "Speech detected"
                else -> "Silence or noise"
            },
            style = MaterialTheme.typography.headlineSmall,
        )

        LinearProgressIndicator(
            progress = { state.vadProbability.coerceIn(0f, 1f) },
            modifier = Modifier.fillMaxWidth(),
        )
        Text("VAD: %.2f".format(state.vadProbability))
        Text("Processed samples: ${state.denoisedSamples}")

        if (!state.hasPermission) {
            Button(
                onClick = { permissionLauncher.launch(Manifest.permission.RECORD_AUDIO) },
                modifier = Modifier.fillMaxWidth(),
            ) {
                Text("Grant microphone permission")
            }
            Text("If permission stays denied, enable microphone access in app settings.")
        } else {
            Button(
                onClick = {
                    if (state.isRecording) viewModel.stopRecording()
                    else viewModel.startRecording()
                },
                modifier = Modifier.fillMaxWidth(),
            ) {
                Text(if (state.isRecording) "Stop recording" else "Start denoising")
            }
        }

        state.error?.let { message ->
            Text(text = message, color = MaterialTheme.colorScheme.error)
        }
    }
}

The permission button opens Android’s dialog. Granting access changes hasPermission, so Compose displays the Start button. Granting permission does not start recording by itself.

When recording produces a probability of 0.82f, the progress indicator fills to about 82 percent and the > 0.5f check selects “Speech detected”. The value is formatted to two decimal places. Your real microphone values will vary.

LifecycleStartEffect ties the cleanup to the visible screen. Going to the background or removing the screen requests a stop. Rotating the device also stops this demo’s recording, and you press Start to begin a new session. It does not automatically resume microphone capture.

Read more: State and Jetpack Compose and the Lifecycle Compose APIs.

6. Show the screen from your activity

In MainActivity.kt, keep your existing package declaration and app theme import. Add these imports and use the screen inside the activity’s existing setContent block:

import androidx.lifecycle.viewmodel.compose.viewModel
// Inside MainActivity.onCreate(), after super.onCreate(savedInstanceState).
setContent {
    // Keep your generated theme here, using your project's actual theme name.
    YourAppTheme {
        val denoiseViewModel: DenoiseViewModel = viewModel()
        DenoiseScreen(viewModel = denoiseViewModel)
    }
}

Replace YourAppTheme with the theme already used by your project. Keep Android Studio’s androidx.activity.compose.setContent import. The viewModel() helper obtains the ViewModel for this activity, so recomposition reuses it.

Your files now have these jobs:

File Responsibility
MicRecorder.kt Capture complete 160-sample chunks and release the microphone
DenoiseViewModel.kt Manage the session, process audio, and publish screen state
DenoiseScreen.kt Request permission, display state, and handle button presses
MainActivity.kt Display the screen inside your app’s theme

7. Try a full recording session

Run the app on a device with a working microphone. The default Audx dependency includes native libraries for ARM64 devices and x86_64 emulators. If you use an emulator, make sure its microphone input is enabled.

  1. Tap “Grant microphone permission” and allow access. The button should change to “Start denoising”.
  2. Tap “Start denoising”. The processed sample count should increase as microphone chunks arrive.
  3. Speak, then pause. Watch the VAD value and speech label change. A pause may still contain noise, so do not expect a fixed number.
  4. Tap “Stop recording”. After cleanup, the count should stop increasing and the button should return to “Start denoising”. Start again to check a new session.
  5. Send the app to the background while recording. Return to the app and check that recording has stopped.

At 16 kHz, 16,000 processed samples represent about one second of captured audio. The screen may skip intermediate state values while drawing, which is fine: it displays the latest result while the collector processes each audio chunk.

You will not hear a cleaned recording yet. To listen to the result, a later step would send the output samples to playback or save them in an audio file with the correct format. The VAD meter verifies that results reach the UI. It does not verify denoising quality.

If something goes wrong

Use the symptom to find which stage to inspect:

Symptom Check
Gradle cannot find Audx JitPack belongs in settings.gradle.kts, and the dependency version is v3.0.0
A Lifecycle import is unresolved Add the matching Lifecycle dependency, then sync Gradle
Audx’s native library cannot load The device CPU architecture must match a bundled native library
Microphone permission remains denied Check the app’s microphone permission in Android Settings
Microphone initialization or reads fail Check microphone availability and support for 16 kHz mono PCM16 on the device
The first cleaned chunk is silent Audx deliberately mutes its first processed chunk
The meter moves but the speaker is silent This example processes audio and displays VAD, with no playback connected

Audx initialization and processing exceptions reach the ViewModel’s error state. Invalid settings can throw IllegalArgumentException, and processing after close() throws IllegalStateException. Both are reasons to fix the call sequence or configuration. Repeatedly retrying the same invalid call will not repair it.

For a longer recording session, consider limiting how often you publish meter updates. Our audio chunks represent 10 milliseconds each, so we can produce about 100 results per second. Audio processing still needs every chunk, even if the UI displays fewer updates.

Optional: choose native libraries and resampling quality

Once the basic example works, you can adjust packaging and processing settings independently of the screen.

An ABI describes the native machine code a device can run. For example, arm64-v8a targets 64-bit ARM devices, while x86_64 covers Intel-based emulators. The default audx dependency includes both. For a device requiring armeabi-v7a, or to package fewer architectures, replace the default Audx dependency with audx-core and the matching ABI modules:

dependencies {
    implementation("com.github.rizukirr.audx-android:audx-core:v3.0.0")
    implementation("com.github.rizukirr.audx-android:audx-arm64-v8a:v3.0.0")
    // Add only the extra architectures your app supports.
    // implementation("com.github.rizukirr.audx-android:audx-armeabi-v7a:v3.0.0")
    // implementation("com.github.rizukirr.audx-android:audx-x86_64:v3.0.0")
}

A 32-bit ARM device also needs NEON support. If you want the entire app package to contain only ARM64 native libraries, add this inside the app module’s existing android block. Such a build will not run on an x86_64 emulator:

android {
    defaultConfig {
        ndk {
            abiFilters.addAll(setOf("arm64-v8a"))
        }
    }
}

The resampler quality setting controls the work spent converting between sample rates:

Constant Value Trade-off
AUDX_RESAMPLER_QUALITY_MIN 0 Lowest resampling quality, least processing work
AUDX_RESAMPLER_QUALITY_VOIP 3 A voice communication preset, used in this guide
AUDX_RESAMPLER_QUALITY_DEFAULT 4 The default quality setting
AUDX_RESAMPLER_QUALITY_MAX 10 Highest resampling quality, more processing work

If you choose to record at 48 kHz, configure both the recorder and Audx for that rate and use 480 samples per 10-millisecond chunk. Matching Audx’s native rate avoids resampling. Changing the rate in just one place would make the processor interpret the audio incorrectly.

contents
  1. First, follow the audio
  2. 1. Set up the Android project
  3. 2. Understand one piece of audio
  4. 3. Turn the microphone into a stream of chunks
  5. 4. Process chunks and hold the screen state
  6. 5. Request permission and display the result
  7. 6. Show the screen from your activity
  8. 7. Try a full recording session
  9. If something goes wrong
  10. Optional: choose native libraries and resampling quality

10 sections, 590 lines

SUMMARY OF COMMANDS

e
write an email
g
open GitHub
/
search projects or posts
h
show or hide this help
j, k
next or previous section (home)
q
back to the blog (on a post)
tab
next category (in an empty search box)
1 to 9
open a published project
esc
clear search, close this help