Files
mute 8585972a1e v0.1: Robovoice — PTT re-voicing app
WinForms tray app that captures text (from file or direct input) and
synthesizes speech via libpiper (Piper TTS), outputting to any audio
device (VB-CABLE for virtual mic routing).

Features:
- Global PTT hotkey (configurable F1-F12) via WH_KEYBOARD_LL
- Text file sequential reader (line-by-line on each PTT cycle)
- Direct text input with Speak button
- Voice manager: browse 147-voice Piper catalogue, download, remove
- libpiper P/Invoke wrapper with UTF-8 marshaling, streaming chunks
- BufferedWaveProvider streaming playback with trailing silence flush
- Sentence terminator auto-append (fixes espeak-ng final-word drop)
- Tray icon with minimize-to-tray

Architecture:
- Robovoice.Core: ITtsEngine, ISttSource interfaces, voice catalogue
- Robovoice.Tts.LibPiper: P/Invoke wrapper for libpiper.dll
- Robovoice.Stt.File: text file STT source (testing without mic server)
- Robovoice.Stt.Udp: UDP client stub (for future Linux mic server)
- Robovoice.App: WinForms UI, orchestrator, PTT hotkey, audio output
2026-08-10 11:27:28 +00:00

66 lines
1.9 KiB
C#

using System.Text.Json.Serialization;
namespace Robovoice.Core.Voices;
public sealed class VoiceInfo
{
public string Key { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public VoiceLanguage Language { get; set; } = new();
public string Quality { get; set; } = string.Empty;
public int NumSpeakers { get; set; }
public VoiceFiles Files { get; set; } = new();
public List<string> Aliases { get; set; } = new();
[JsonIgnore]
public string DisplayName =>
$"{Language.NameEnglish} ({Language.Code}) — {Name} [{Quality}]";
[JsonIgnore]
public long SizeBytes =>
Files.FirstOrDefault(f => f.Key.EndsWith(".onnx")).Value?.SizeBytes ?? 0;
[JsonIgnore]
public string SizeDisplay
{
get
{
double mb = SizeBytes / (1024.0 * 1024.0);
return mb >= 1024 ? $"{mb / 1024:F1} GB" : $"{mb:F0} MB";
}
}
[JsonIgnore]
public string OnnxFileKey => Files.Keys.FirstOrDefault(k => k.EndsWith(".onnx")) ?? "";
[JsonIgnore]
public string JsonFileKey => Files.Keys.FirstOrDefault(k => k.EndsWith(".onnx.json")) ?? "";
}
public sealed class VoiceLanguage
{
public string Code { get; set; } = string.Empty;
public string Family { get; set; } = string.Empty;
public string Region { get; set; } = string.Empty;
[JsonPropertyName("name_native")]
public string NameNative { get; set; } = string.Empty;
[JsonPropertyName("name_english")]
public string NameEnglish { get; set; } = string.Empty;
[JsonPropertyName("country_english")]
public string CountryEnglish { get; set; } = string.Empty;
}
public sealed class VoiceFiles : Dictionary<string, VoiceFile> { }
public sealed class VoiceFile
{
[JsonPropertyName("size_bytes")]
public long SizeBytes { get; set; }
[JsonPropertyName("md5_digest")]
public string Md5Digest { get; set; } = string.Empty;
}