ghuyfel / flutter_azure_tts

Flutter implementation of Microsoft Azure Cognitive Text-To-Speech API.
MIT License
34 stars 31 forks source link

Support for styles and roles #19

Closed alexobviously closed 2 days ago

alexobviously commented 1 year ago

I suggest making this part of 0.2.0 because the SDK constraint has changed.

yashpalzala commented 1 year ago

The ssml with style parameter does not contain mstts:express-as element. Thus, I doubt if style will work.

alexobviously commented 1 year ago

The ssml with style parameter does not contain mstts:express-as element. Thus, I doubt if style will work.

I actually tried mstts:express-as first, and it didn't work. This solution does work, and you can test it with something like dart example/lib/example.dart -v en- -s shouting,whispering (this will generate two audio files with different expressions for you to compare).

I don't fully understand every option in the SSML format and the (frankly weirdly structured) Azure API in general, but I believe the mstts tags are for inline expressions, e.g. you want to generate a paragraph with default expression, and have a sentence in the middle with a different style. I could be wrong, but anyway the way I've implemented it here definitely does work.

yashpalzala commented 1 year ago

I tried your ssml it does work. Also I was able to make this current ssml work with mstts tag and for your understanding in future this is how we can use mstts tag in current ssml, "<speak version='1.0' " "xmlns='http://www.w3.org/2001/10/synthesis' " "xmlns:mstts='https://www.w3.org/2001/mstts' " "xml:lang='${voice.locale}'>" "<voice xml:lang='${voice.locale}' " "xml:gender='${voice.gender}' " "name='${voice.shortName}'>" "<prosody rate='$speed'>" "<mstts:express-as style='$style' styledegree='$styleDegree'>" "$text" "<\/mstts:express-as>" "<\/prosody><\/voice><\/speak>" . Also you can add styleDegree in your current ssml it definitely helps in intensifying the style. If you can't, let me know I'll add that for you. 😄

alexobviously commented 1 year ago

Oh nice thanks, I didn't know about style degree! I added a commit, it's supported now. Try something like example.dart -s excited -d 0.01,0.5,1.0,2.0, it's pretty cool, and I definitely have a use for this in an app.

r.e. xml: vs mstts, I think I personally prefer the xml attribute method. In my opinion, it's a bit more concise and easier to read, and it has the same effect anyway. But I'll leave it up to @ghuyfel, I don't mind that much.

yashpalzala commented 1 year ago

Yes will surely try.

Actually I also had a use for style and styleDegree and I was just about to raise PR for both this parameters but then I saw your PR so then I didn't but I had completed the code and all, What a co-incidence!

And yeah regarding xml: vs mstts I don't mind any of them as long as it works.

ddikman commented 4 days ago

It would be great to get this merged

ghuyfel commented 4 days ago

Hi David, I have been very busy recently, I will have a look at the PR over the weekend. Thanks for the support


From: David Dikman @.> Sent: Wednesday, November 20, 2024 11:22:22 PM To: ghuyfel/flutter_azure_tts @.> Cc: Fel @.>; Mention @.> Subject: Re: [ghuyfel/flutter_azure_tts] Support for styles and roles (PR #19)

It would be great to get this merged

— Reply to this email directly, view it on GitHubhttps://github.com/ghuyfel/flutter_azure_tts/pull/19#issuecomment-2489566332, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZ7RDZ67WIMJACJI73MS632BT4Q5AVCNFSM6AAAAABSFQNPXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBZGU3DMMZTGI. You are receiving this because you were mentioned.Message ID: @.***>

ddikman commented 4 days ago

@ghuyfel no worries, sorry to rush :) I ended up doing a tiny version of this directly in our code base instead, so don't feel any pressure!

ghuyfel commented 2 days ago

Thanks a lot @alexobviously, well done