Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Android: platform AEC doesn't cancel app's own playback unless the OUTPUT stream uses Usage::VoiceCommunication

Chiusa Adatta ai principianti
#1,254 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, cpp, react-native

Direzione di ricerca

Esamina openAudioStream() di AudioPlayer.cpp insieme alla gestione di voiceCommunication da parte di AudioRecorder. Verifica l’acquisizione e la riproduzione full-duplex su un dispositivo Android fisico con altoparlante, quindi implementa il comportamento concordato del flusso di output oppure documenta la configurazione necessaria nella prossima documentazione di AudioRecorder. Il lavoro è completato quando l’AEC della piattaforma rimuove l’eco del segnale locale senza modificare il routing dell’altoparlante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

android bug
Feature Request

When building a full-duplex voice assistant (mic capture + TTS playback at the same
time), enabling androidInputPreset: 'voiceCommunication' on the AudioRecorder alone
was not enough to get working acoustic echo cancellation on Android. Our STT kept
transcribing the assistant's own TTS playback.

The missing piece: the output stream (AudioPlayer.cpp) is opened without any
Usage, which defaults to USAGE_MEDIA. On many devices, the platform AEC chain
engaged by the VOICE_COMMUNICATION input preset only references the
voice-communication output path and media-stream playback leaks into the microphone
uncancelled.

Adding two lines to the output stream builder fixed it completely:

// AudioPlayer.cpp — openAudioStream()
builder.setSharingMode(SharingMode::Exclusive)
    ->setFormat(AudioFormat::Float)
    // ...existing config...
    ->setUsage(Usage::VoiceCommunication)   // ← added
    ->setContentType(ContentType::Speech)  // ← added
    // ...
Environment
  • react-native-audio-api 1.0.0-nightly-f8b57cd-20260825
  • React Native 0.86.2 / Expo SDK 57, physical Android device (loudspeaker, no headphones)
  • Capture: AudioRecorder with { androidInputPreset: 'voiceCommunication', iosVoiceProcessing: true }
  • Playback: AudioContext playing TTS PCM buffers
  • Use case: streaming STT (websocket ASR) while speaking TTS replies (barge-in style interaction)
Symptom before the patch
  • Speech-to-text transcribed the assistant's own spoken replies as if they were user input
  • Token-overlap heuristics and LLM-based intent filtering reduced but never eliminated
    the self-echo turns
  • Verified the input preset reaches Oboe correctly (setInputPreset(VoiceCommunication)
    present in openAudioStream()), so the gap was on the output/reference side
After the patch
  • Self-echo eliminated at DSP level (zero phantom transcripts during playback)
  • Real barge-in (user talking over the reply) works reliably
  • No audio-routing regressions on our test device: playback still comes out of the
    loudspeaker as before
Suggestions
  1. Library behavior: consider applying Usage::VoiceCommunication (+ ContentType::Speech)
    to the output stream automatically when an active recorder uses
    androidInputPreset: 'voiceCommunication' or expose an option for it.
  2. Docs (next → AudioRecorder): the full-duplex section recommends
    androidInputPreset: 'voiceCommunication' + iosVoiceProcessing: true, but doesn't
    mention that the playback side must also sit on the voice-communication path for
    Android AEC to reference it.
Lingua principale
C++
Stelle
848
Fork
95
Merge medio
4g 20m
PR unite (30g)
31

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di software-mansion/react-native-audio-api

Tutte le issue di software-mansion/react-native-audio-api

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.