TIDC / ssml-document

SSML document building parser for multiple service providers
5 stars 0 forks source link

role, style are not rendered in expressAs tag (azure tts) #1

Closed aguegu closed 1 year ago

aguegu commented 1 year ago
const doc = new Document({ language: 'en' });
const body = doc
  .voice('Jenny')
  .expressAs({ role: 'Girl', style: 'cheerful', styledegree: 2 })
  .say('hello')
  .up()
  .up()
  .render({ provider: ServiceProvider.Microsoft });

the expected xml is

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"
       xmlns:mstts="https://www.w3.org/2001/mstts" xml:lang="en">
    <voice name="Jenny">
        <mstts:express-as style="cheerful" styledegree="2" role="Girl">
          hello
        </mstts:express-as>
    </voice>
</speak>

but the real output is

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"
       xmlns:mstts="https://www.w3.org/2001/mstts" xml:lang="en">
    <voice name="Jenny">
        <mstts:express-as>
          hello
        </mstts:express-as>
    </voice>
</speak>

the attributes in express-as are missed.

I did not find example about how to use express-as, but the introduction said it is supported. Just not sure how to implement it.

ssml-document version 1.0.5592

https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/speech-synthesis-markup-voice#style-and-degree-example

Vinlic commented 1 year ago

@aguegu 嗨,你好,感谢你的使用 :D,我已经发布了ssml-document@1.0.57,这个版本支持expressAs函数的重载,你提供的示例代码也可以正常工作,此前他的使用方法是必须提供一个内容:expressAs(content: string, options?: IExpressAsOptions, compile?: boolean): Element;,但现在他已经兼容你的用法,retry。

aguegu commented 1 year ago

Hi. Thanks for the quick fix, well, improvement in this case.

Since I did not find the document about this. I just follow my instincts. :)