v0.2: streaming playback, model params, text input

- Stream audio directly to device via BufferedWaveProvider (no temp WAVs)
- Add Noise/Speed/NoiseW sliders with live value labels
- Sliders reinit engine on MouseUp (not Scroll) to avoid locking
- Add text input field with Speak button for direct synthesis
- Test button uses text input if non-empty
- Fix sentence terminator auto-append (espeak-ng final-word drop)
- Fix UTF-8 text marshaling (piper_synthesize_start keeps text ref)
- Fix voice catalogue language column (JSON snake_case mapping)
- Use piper_default_synthesize_options for model-specific defaults
- Fix nullable warnings in designer files
- Fix unused _playing field in AudioOutput
This commit is contained in:
2026-08-10 11:50:48 +00:00
parent 8585972a1e
commit f7ea07b78e
4 changed files with 128 additions and 13 deletions
+28 -1
View File
@@ -49,6 +49,13 @@ internal sealed partial class MainForm : Form
cmbOutput.SelectedIndexChanged += OnOutputChanged;
cmbVoice.SelectedIndexChanged += OnVoiceChanged;
trkNoise.Scroll += OnSliderScroll;
trkSpeed.Scroll += OnSliderScroll;
trkNoiseW.Scroll += OnSliderScroll;
trkNoise.MouseUp += OnSliderReleased;
trkSpeed.MouseUp += OnSliderReleased;
trkNoiseW.MouseUp += OnSliderReleased;
SetupTray();
await InitializeEngineAsync();
@@ -124,7 +131,12 @@ internal sealed partial class MainForm : Form
_audioOutput?.Dispose();
_tts?.DisposeAsync().AsTask().Wait();
_tts = new LibPiperTtsEngine(modelPath, _espeakDataPath);
_tts = new LibPiperTtsEngine(
modelPath,
_espeakDataPath,
noiseScale: trkNoise.Value / 1000.0f,
lengthScale: trkSpeed.Value / 100.0f,
noiseWScale: trkNoiseW.Value / 1000.0f);
_audioOutput = new AudioOutput();
_sttSource = new FileSttSource();
_orchestrator?.DisposeAsync().AsTask().Wait();
@@ -272,6 +284,21 @@ internal sealed partial class MainForm : Form
await InitializeEngineAsync();
}
private void OnSliderScroll(object? sender, EventArgs e)
{
lblNoiseVal.Text = $"{trkNoise.Value / 1000.0:F3}";
lblSpeedVal.Text = $"{trkSpeed.Value / 100.0:F2}";
lblNoiseWVal.Text = $"{trkNoiseW.Value / 1000.0:F3}";
}
private void OnSliderReleased(object? sender, MouseEventArgs e)
{
if (cmbVoice.SelectedItem is string name && VoiceCatalogue.IsVoiceInstalled(_voicesDir, name))
{
_ = InitializeEngineAsync();
}
}
private void OnPttKeyChanged(object? sender, EventArgs e)
{
SetupHotkey();