| | |
| | | |
| | | import ( |
| | | "fmt" |
| | | "time" |
| | | "voicesnap/internal/config" |
| | | "voicesnap/internal/language" |
| | | "voicesnap/internal/logger" |
| | |
| | | Close() |
| | | } |
| | | |
| | | // StreamingEngine is implemented by engines that can expose partial results |
| | | // while audio is still being captured. |
| | | type StreamingEngine interface { |
| | | NewStreamingSession() (StreamingSession, error) |
| | | } |
| | | |
| | | // ReleaseTailCaptureEngine is implemented by engines that need a short audio |
| | | // capture grace period after the user releases the recording hotkey. |
| | | type ReleaseTailCaptureEngine interface { |
| | | ReleaseTailCaptureDelay() time.Duration |
| | | } |
| | | |
| | | // HoldPreCaptureEngine is implemented by engines that should start capturing |
| | | // audio immediately on hold-to-talk key down, before the activation delay has |
| | | // confirmed that the hotkey was not part of a key combination. |
| | | type HoldPreCaptureEngine interface { |
| | | HoldPreCaptureEnabled() bool |
| | | } |
| | | |
| | | // StreamingSession receives incremental 16kHz mono PCM and returns the current |
| | | // best transcript for the active utterance. |
| | | type StreamingSession interface { |
| | | Accept(samples []float32) (string, error) |
| | | Finish() (string, error) |
| | | Close() |
| | | } |
| | | |
| | | // ModelDir returns the path to the sensevoice model directory. |
| | | func ModelDir() string { |
| | | resolved, err := resolveCurrentModel() |