Files
alfred-mobile/WAKE_WORD_IMPLEMENTATION.md
jknapp 6d4ae2e5c3 Initial commit: Alfred Mobile - AI Assistant Android App
- OAuth authentication via Authentik
- WebSocket connection to OpenClaw gateway
- Configurable gateway URL with first-run setup
- User preferences sync across devices
- Multi-user support with custom assistant names
- ElevenLabs TTS integration (local + remote)
- FCM push notifications for alarms
- Voice input via Google Speech API
- No hardcoded secrets or internal IPs in tracked files
2026-02-09 11:12:51 -08:00

2.6 KiB

Wake Word Implementation Plan

Overview

Add "Hey Alfred" or "Alfred" wake word detection to activate voice input hands-free.

Technology Choice: Porcupine by Picovoice

Why Porcupine:

  • On-device processing (no internet required)
  • Low battery usage
  • Free tier available (1 wake word, non-commercial)
  • Android SDK available
  • Custom wake words supported

Free Tier Limits:

  • 1 user account
  • 1 custom wake word model
  • Non-commercial use only
  • On-device processing (unlimited uses)

Implementation Steps

1. Sign up for Porcupine

2. Add Porcupine SDK

Add to app/build.gradle.kts:

dependencies {
    implementation("ai.picovoice:porcupine-android:3.0.2")
}

3. Add to secrets.properties

PORCUPINE_ACCESS_KEY=<your-access-key-here>

4. Create WakeWordManager.kt

Similar to VoiceInputManager, this would:

  • Initialize Porcupine with the wake word model
  • Listen continuously in the background (low power mode)
  • Trigger voice input when wake word detected
  • Show visual feedback (e.g., pulse animation)

5. Add Background Service

Wake word detection needs to run in the background:

  • Foreground service with notification
  • Shows "Listening for 'Hey Alfred'..." notification
  • Can be toggled on/off from app
  • Respects battery optimization settings

6. UI Updates

Add toggle in settings or status bar:

  • "Wake Word Detection" switch
  • Shows when listening
  • Visual feedback when triggered (e.g., microphone icon pulses)

User Experience Flow

  1. User enables "Wake Word Detection" in app
  2. App starts background service
  3. Notification shows: "Listening for 'Hey Alfred'"
  4. User says "Hey Alfred" or "Alfred"
  5. App shows visual feedback (screen lights up, icon pulses)
  6. Voice input starts automatically
  7. User speaks their message
  8. Message auto-sends when done
  9. Alfred responds with voice

Considerations

Battery Impact:

  • Porcupine is optimized for low power
  • Typically <1% battery drain per hour
  • Can be toggled off when not needed

Privacy:

  • All processing on-device
  • No audio sent to cloud
  • Only activates when wake word detected

Implementation Complexity:

  • Medium complexity (1-2 hours work)
  • Requires Porcupine setup
  • Need background service implementation
  • Permission handling (microphone always-on)

Next Steps

If you want this feature:

  1. Create Picovoice account
  2. Get Access Key
  3. Train "Alfred" wake word model
  4. I can implement the code integration

Let me know if you want to proceed with this! 🎤