How 22davidd/project-diana works
Project Diana is an offline, continuously running voice-assistant loop. A microphone block enters the main state machine, which routes it to wake detection while idle and to streaming speech recognition after the spoken acknowledgement. The resulting command goes through intent handling: recognized device actions update an in-memory state registry, while unmatched requests may use optional local Ollama chat. The handler’s response returns to the state machine for console or Piper speech output. The map follows README architecture and sampled module contracts; some main-loop wiring is documented but omitted from the source excerpt.
Main entry points: main.py State machine · command.py Command handler · speaker.py Speaker interface · wakeword.py Wake detector
Components 15
Audio input
- Audio source
diana/audio.py - Wake detector
diana/wakeword.py - Speech recognition
diana/stt.py
Conversation loop
- State machine
diana/main.py - Configuration
diana/config.py
Command handling
- Command handler
diana/command.py - Intent parser
diana/intents.py - Device registry
diana/devices.py - Local chat
diana/chat.py
Response output
- Speaker interface
diana/speaker.py - Console output
diana/speaker.py - Piper speech
diana/speaker.py
Other components
- User
- Microphone
- Ollama server
Connections 20
- Microphone → Audio source: captures audio
- State machine → Audio source: reads blocks
- State machine → Wake detector: checks wake
- State machine → Speech recognition: feeds speech
- Wake detector → State machine: signals wake
- Speech recognition → State machine: returns transcript
- State machine → Command handler: handles command
- Command handler → Intent parser: parses text
- Intent parser → Device registry: checks devices
- Command handler → Device registry: reads or updates
- Command handler → Local chat: requests fallback
- Local chat → Ollama server: sends prompt
- Command handler → State machine: returns response
- State machine → Speaker interface: speaks response
- Speaker interface → Console output: prints text
- Speaker interface → Piper speech: synthesizes speech
- Piper speech → User: plays speech
- Console output → User: displays text
- User → Microphone: speaks
- Configuration → State machine: configures loop