Exemplo n.º 1
0
    def test_setAttrDifferentAttrs(self):
        """Tests multiple SetAttrCommands with different attributes of the same tag.
		"""
        xml = self.balancer.generateXml([
            speechXml.SetAttrCommand("prosody", "pitch", 50),
            speechXml.SetAttrCommand("prosody", "volume", 60), "text"
        ])
        self.assertEqual(xml, '<prosody pitch="50" volume="60">text</prosody>')
Exemplo n.º 2
0
    def test_setAttrDifferentTags(self):
        """Tests multiple SetAttrCommands with different tags.
		"""
        xml = self.balancer.generateXml([
            speechXml.SetAttrCommand("pitch", "val", 50),
            speechXml.SetAttrCommand("volume", "val", 60), "text"
        ])
        self.assertEqual(
            xml, '<pitch val="50"><volume val="60">text</volume></pitch>')
Exemplo n.º 3
0
    def test_setAttrInterspersedText(self):
        """Tests multiple SetAttrCommands interspersed with text.
		"""
        xml = self.balancer.generateXml([
            speechXml.SetAttrCommand("pitch", "val", 50), "t1",
            speechXml.SetAttrCommand("volume", "val", 60), "t2"
        ])
        self.assertEqual(
            xml,
            '<pitch val="50">t1</pitch><pitch val="50"><volume val="60">t2</volume></pitch>'
        )
Exemplo n.º 4
0
    def test_delSingleAttrOfMultipleAttrs(self):
        """Tests DelAttrCommand removing a single attribute from a tag which has multiple attributes.
		"""
        xml = self.balancer.generateXml([
            speechXml.SetAttrCommand("prosody", "pitch", 50),
            speechXml.SetAttrCommand("prosody", "volume", 60), "t1",
            speechXml.DelAttrCommand("prosody", "pitch"), "t2"
        ])
        self.assertEqual(
            xml,
            '<prosody pitch="50" volume="60">t1</prosody><prosody volume="60">t2</prosody>'
        )
Exemplo n.º 5
0
    def test_delAttrUnbalanced(self):
        """Tests DelAttrCommand removing an outer tag before an inner tag.
		"""
        xml = self.balancer.generateXml([
            speechXml.SetAttrCommand("pitch", "val", 50),
            speechXml.SetAttrCommand("volume", "val", 60), "t1",
            speechXml.DelAttrCommand("pitch", "val"), "t2"
        ])
        self.assertEqual(
            xml,
            '<pitch val="50"><volume val="60">t1</volume></pitch><volume val="60">t2</volume>'
        )
Exemplo n.º 6
0
	def _convertProsody(self, command, attr, default, base):
		if command.multiplier == 1 and base == default:
			# Returning to synth default.
			return speechXml.DelAttrCommand("prosody", attr)
		else:
			# Multiplication isn't supported, only addition/subtraction.
			# The final value must therefore be relative to the synthesizer's default.
			val = base * command.multiplier - default
			return speechXml.SetAttrCommand("prosody", attr, "%d%%" % val)
Exemplo n.º 7
0
 def test_setAttrThenDelAttr(self):
     xml = self.balancer.generateXml([
         speechXml.SetAttrCommand("pitch", "val", 50), "t1",
         speechXml.DelAttrCommand("pitch", "val"), "t2"
     ])
     self.assertEqual(xml, '<pitch val="50">t1</pitch>t2')
Exemplo n.º 8
0
 def test_setAttr(self):
     xml = self.balancer.generateXml(
         [speechXml.SetAttrCommand("pitch", "val", 50), "text"])
     self.assertEqual(xml, '<pitch val="50">text</pitch>')