switch to alsa default device and ask users to configure through alsa.conf
This commit is contained in:
parent
2fd5b3fc2f
commit
33aa37cf38
3 changed files with 21 additions and 1 deletions
14
README.md
14
README.md
|
@ -2,6 +2,20 @@
|
||||||
|
|
||||||
This project implements a minimal real-time speech-to-text application using Vosk and Zig.
|
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
|
### Prerequisites
|
||||||
- Zig 0.15.1 (configured via mise)
|
- Zig 0.15.1 (configured via mise)
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
pcm.!default {
|
||||||
|
type hw
|
||||||
|
card 3
|
||||||
|
device 0
|
||||||
|
}
|
||||||
|
|
||||||
pcm.hw {
|
pcm.hw {
|
||||||
@args [ CARD DEV SUBDEV ]
|
@args [ CARD DEV SUBDEV ]
|
||||||
@args.CARD {
|
@args.CARD {
|
||||||
|
|
|
@ -168,7 +168,7 @@ pub fn main() !void {
|
||||||
// These parameters maintain the existing working behavior
|
// These parameters maintain the existing working behavior
|
||||||
const options = stt.SttOptions{
|
const options = stt.SttOptions{
|
||||||
.model_path = "zig-out/bin/vosk-model-small-en-us-0.15",
|
.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,
|
.event_handler = speech_handler,
|
||||||
.sample_rate = 16000, // Standard sample rate for speech recognition
|
.sample_rate = 16000, // Standard sample rate for speech recognition
|
||||||
.channels = 2, // Stereo input (will be converted to mono internally)
|
.channels = 2, // Stereo input (will be converted to mono internally)
|
||||||
|
|
Loading…
Add table
Reference in a new issue