Skip to content

When TTS, user input Chinese characters, then the backend parse these characters as None #565

@Kang-Jack

Description

@Kang-Jack

===env windows docker desktop============
docker image:
ghcr.io/speaches-ai/speaches:latest-cuda

=========issue===============

with same mode , i can get expected .mp3 file and result when my inputs only contains number characters , but get a empty .mp3 file when i use Chinese characters as input from log looks the input has be erased due to uncorrected json decode. the request and log shows below:

===============correct result when only numbers input=========================================
curl --request POST
--url http://127.0.0.1:8030/v1/audio/speech
--header 'Content-Type: application/json'
--data '{
"input": "1234567",
"model": "speaches-ai/piper-zh_CN-huayan-medium",
"voice": "huayan",
"sample_rate": 8000,
"speed":0.8,
"response_format": "mp3"
}'

log:

2025-11-04 14:53:24 2025-11-04 06:53:24,647:INFO:speaches.model_manager:_decrement_ref:64:Model speaches-ai/piper-zh_CN-huayan-medium is idle, scheduling offload in 300s
2025-11-04 14:53:24 INFO: 172.17.0.1:53484 - "POST /v1/audio/speech HTTP/1.1" 200 OK
2025-11-04 14:53:24 2025-11-04 06:53:24,907:INFO:speaches.executors.piper.utils:generate_audio:154:Generated audio for 7 characters in 0.25853770100002293s

========================empty result when use Chinese characters=============================
curl --request POST
--url http://127.0.0.1:8030/v1/audio/speech
--header 'Content-Type: application/json'
--data '{
"input": "你好,这是关于文字转语音的测试",
"model": "speaches-ai/piper-zh_CN-huayan-medium",
"voice": "huayan",
"sample_rate": 8000,
"speed":0.8,
"response_format": "mp3"
}
'
log:

2025-11-04 14:52:01 2025-11-04 06:52:01,145:DEBUG:speaches.executors.piper.model_manager:load_model:58:speaches-ai/piper-zh_CN-huayan-medium model already loaded
2025-11-04 14:52:01 2025-11-04 06:52:01,145:DEBUG:speaches.model_manager:_increment_ref:54:Model was set to expire in 300s, cancelling
2025-11-04 14:52:01 2025-11-04 06:52:01,145:DEBUG:speaches.model_manager:_increment_ref:56:Incremented ref count for speaches-ai/piper-zh_CN-huayan-medium, self.ref_count=1
2025-11-04 14:52:01 2025-11-04 06:52:01,145:DEBUG:speaches.model_manager:_decrement_ref:61:Decremented ref count for speaches-ai/piper-zh_CN-huayan-medium, self.ref_count=0
2025-11-04 14:52:01 2025-11-04 06:52:01,145:INFO:speaches.model_manager:_decrement_ref:64:Model speaches-ai/piper-zh_CN-huayan-medium is idle, scheduling offload in 300s
2025-11-04 14:52:01 INFO: 172.17.0.1:53182 - "POST /v1/audio/speech HTTP/1.1" 200 OK
2025-11-04 14:52:01 2025-11-04 06:52:01,162:INFO:speaches.executors.piper.utils:generate_audio:154:Generated audio for 0 characters in 0.01593830000001617s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions