Files

30 lines
990 B
Go

// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
// SPDX-License-Identifier: GPL-3.0-or-later
package speech
import "testing"
func TestHardwareProtocolsMatchPython(t *testing.T) {
rate, pitch, volume := 99.0, 9.0, 9.0
voice := HardwareVoice{Rate: &rate, Pitch: &pitch, Volume: &volume}
for _, synth := range []string{"litetalk", "doubletalk", "tripletalk", "dectalk"} {
want := "\x019S\x0199P\x019VHello !\r"
if synth == "dectalk" {
want = "[:ra 650][:dv ap 180][:vo 100]Hello !\x01"
}
if got := string(hardware_bytes(synth, "Hello\n\x01é猫!", voice)); got != want {
t.Fatalf("%s: got %q, want %q", synth, got, want)
}
}
rate, pitch, volume = 0, 0, 0
if got := string(hardware_bytes("dectalk", "Low", voice)); got != "[:ra 75][:dv ap 50][:vo 0]Low\x01" {
t.Fatal(got)
}
rate, pitch, volume = 49.5, 4.5, 4.5
if got := string(hardware_bytes("litetalk", "Middle", voice)); got != "\x014S\x0150P\x014VMiddle\r" {
t.Fatal(got)
}
}