1 import ./make-test-python.nix (
8 meta.maintainers = with lib.maintainers; [ pluiedev ];
13 networking.firewall.enable = false;
14 networking.useDHCP = false;
22 url = "https://github.com/marytts/voice-bits1-hsmm/releases/download/v5.2/voice-bits1-hsmm-5.2.zip";
23 hash = "sha256-1nK+qZxjumMev7z5lgKr660NCKH5FDwvZ9sw/YYYeaA=";
29 name = "userdict-en_US.txt";
30 destination = "/userdict-en_US.txt";
32 amogus | @ - ' m @U - g @ s
33 Nixpkgs | n I k s - ' p { - k @ - dZ @ s
41 from xml.etree import ElementTree
42 from urllib.parse import urlencode
44 machine.wait_for_unit("marytts.service")
46 with subtest("Checking health of MaryTTS server"):
47 machine.wait_for_open_port(${toString port})
48 assert 'Mary TTS server' in machine.succeed("curl 'localhost:${toString port}/version'")
50 with subtest("Generating example MaryXML"):
52 'datatype': 'RAWMARYXML',
55 xml = machine.succeed(f"curl 'localhost:${toString port}/exampletext?{query}'")
56 root = ElementTree.fromstring(xml)
57 text = " ".join(root.itertext()).strip()
58 assert text == "Welcome to the world of speech synthesis!"
60 with subtest("Detecting custom voice"):
61 assert "bits1-hsmm" in machine.succeed("curl 'localhost:${toString port}/voices'")
63 with subtest("Finding user dictionary"):
65 'INPUT_TEXT': 'amogus',
67 'OUTPUT_TYPE': 'PHONEMES',
70 phonemes = machine.succeed(f"curl 'localhost:${toString port}/process?{query}'")
71 phonemes_tree = ElementTree.fromstring(phonemes)
72 print([i.get('ph') for i in phonemes_tree.iter('{http://mary.dfki.de/2002/MaryXML}t')])
73 assert ["@ - ' m @U - g @ s"] == [i.get('ph') for i in phonemes_tree.iter('{http://mary.dfki.de/2002/MaryXML}t')]
75 with subtest("Synthesizing"):
77 'INPUT_TEXT': 'Nixpkgs is a collection of over 100,000 software packages that can be installed with the Nix package manager.',
79 'OUTPUT_TYPE': 'AUDIO',
83 machine.succeed(f"curl 'localhost:${toString port}/process?{query}' -o ./audio.wav")
84 machine.copy_from_vm("./audio.wav")