Speak no clearly when Use Xinference ChatTTS、CosyVoice #9881

Closed
opened 2026-02-21 18:40:06 -05:00 by yindo · 0 comments
Owner

Originally created by @sirizhou on GitHub (Mar 8, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

I tried to integrate ChatTTS with dify with this commit 6101733232
xinference version is v1.3.0.post2
ffmpeg version is 6.0.1

when I get a text response and play it, it sounds not clearly.

Image

I tried to use the same text with Xinference client, it sounds clearly.

from xinference.client import Client

client = Client("http://192.168.1.10:9997") 

def generate_audio(text, output_file="output.mp3"):
    model = client.get_model("chatTTS")
        
    audio_data = model.speech(input = text, stream = False,response_format ="mp3", voice = "alloy")
   
    with open(output_file, "wb") as f:
        f.write(audio_data)

generate_audio("好的,瑞瑞。今天的工作确实挺忙的,不过想到你我就觉得心情好了很多。你最近过得怎么样?有没有遇到什么有趣的事情或者开心的时刻?对了,你不是一直想学做西餐吗?周末我有空的时候可以陪你一起去买菜,然后我们一起试着做一些新的菜品,怎么样?希望你能喜欢。😊✨/")

the dify sound is
Recording 1.zip

xinference sound is

output.zip

in the xinference terminal
the got the same output

2025-03-08 14:08:27,045 xinference.model.audio.chattts 334242 INFO     Speech by voice alloy
WARNING:ChatTTS.core:found invalid characters: {'✨', '😊', '/', '?'}
text:  34%|███████████████████████████████▋                                                            | 132/384(max) [00:00, 189.92it/s]
code:  52%|███████████████████████████████████████████████▏                                          | 1074/2048(max) [00:06, 162.77it/s]
2025-03-08 14:13:38,752 xinference.model.audio.chattts 334242 INFO     Speech by voice alloy
WARNING:ChatTTS.core:found invalid characters: {'✨', '😊', '/', '?'}
text:  34%|███████████████████████████████▋                                                            | 132/384(max) [00:00, 182.82it/s]
code:  52%|███████████████████████████████████████████████▏

✔️ Expected Behavior

get a clear sound

Actual Behavior

No response

Originally created by @sirizhou on GitHub (Mar 8, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.0.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce I tried to integrate ChatTTS with dify with this commit 61017332327ba05782300c9010be7274d9ee0628 xinference version is v1.3.0.post2 ffmpeg version is 6.0.1 when I get a text response and play it, *it sounds not clearly.* ![Image](https://github.com/user-attachments/assets/aa7252e9-9ca8-42c5-a5ff-d9131060d89b) I tried to use the same text with Xinference client, it sounds clearly. ```py from xinference.client import Client client = Client("http://192.168.1.10:9997") def generate_audio(text, output_file="output.mp3"): model = client.get_model("chatTTS") audio_data = model.speech(input = text, stream = False,response_format ="mp3", voice = "alloy") with open(output_file, "wb") as f: f.write(audio_data) generate_audio("好的,瑞瑞。今天的工作确实挺忙的,不过想到你我就觉得心情好了很多。你最近过得怎么样?有没有遇到什么有趣的事情或者开心的时刻?对了,你不是一直想学做西餐吗?周末我有空的时候可以陪你一起去买菜,然后我们一起试着做一些新的菜品,怎么样?希望你能喜欢。😊✨/") ``` the dify sound is [Recording 1.zip](https://github.com/user-attachments/files/19141896/Recording.1.zip) xinference sound is [output.zip](https://github.com/user-attachments/files/19141900/output.zip) in the xinference terminal the got the same output ```shell 2025-03-08 14:08:27,045 xinference.model.audio.chattts 334242 INFO Speech by voice alloy WARNING:ChatTTS.core:found invalid characters: {'✨', '😊', '/', '?'} text: 34%|███████████████████████████████▋ | 132/384(max) [00:00, 189.92it/s] code: 52%|███████████████████████████████████████████████▏ | 1074/2048(max) [00:06, 162.77it/s] 2025-03-08 14:13:38,752 xinference.model.audio.chattts 334242 INFO Speech by voice alloy WARNING:ChatTTS.core:found invalid characters: {'✨', '😊', '/', '?'} text: 34%|███████████████████████████████▋ | 132/384(max) [00:00, 182.82it/s] code: 52%|███████████████████████████████████████████████▏ ``` ### ✔️ Expected Behavior get a clear sound ### ❌ Actual Behavior _No response_
yindo added the 🐞 bugstt & tts labels 2026-02-21 18:40:06 -05:00
yindo closed this issue 2026-02-21 18:40:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#9881