switch to alsa default device and ask users to configure through alsa.conf

This commit is contained in:
Emil Lerch 2025-09-10 18:05:51 -07:00
parent 2fd5b3fc2f
commit 33aa37cf38
Signed by: lobo
GPG key ID: A7B62D657EF764F8
3 changed files with 21 additions and 1 deletions

View file

@ -2,6 +2,20 @@
This project implements a minimal real-time speech-to-text application using Vosk and Zig.
## Audio Device Configuration
The application uses ALSA's default device, which is configured in `alsa.conf`. To use a different audio device:
1. Find your audio devices: `aplay -l` or `arecord -l`
2. Edit `alsa.conf` and update the `pcm.!default` section:
```
pcm.!default {
type hw
card 3 # Change to your card number
device 0 # Change to your device number
}
```
3. Rebuild and run the application
### Prerequisites
- Zig 0.15.1 (configured via mise)

View file

@ -1,3 +1,9 @@
pcm.!default {
type hw
card 3
device 0
}
pcm.hw {
@args [ CARD DEV SUBDEV ]
@args.CARD {

View file

@ -168,7 +168,7 @@ pub fn main() !void {
// These parameters maintain the existing working behavior
const options = stt.SttOptions{
.model_path = "zig-out/bin/vosk-model-small-en-us-0.15",
.audio_device = "hw:3,0", // Maintain existing audio device configuration
.audio_device = "default", // Use ALSA default device from alsa.conf
.event_handler = speech_handler,
.sample_rate = 16000, // Standard sample rate for speech recognition
.channels = 2, // Stereo input (will be converted to mono internally)