30 lines
976 B
Python
30 lines
976 B
Python
from chongming_request import Client
|
|||
|
|
import asyncio
|
||
|
|
import logging
|
||
|
|
|
||
|
|
async def test_tts():
|
||
|
|
async with Client() as client:
|
||
|
|
try:
|
||
|
|
result = await client.call(
|
||
|
|
worker_type="ip_sound_column",
|
||
|
|
subject="ip_sound_column.tts",
|
||
|
|
method="POST",
|
||
|
|
payload={
|
||
|
|
"command": "play_local_tts",
|
||
|
|
"volume": 5,
|
||
|
|
"play_count": 1,
|
||
|
|
"queue": False,
|
||
|
|
"sync_response": True,
|
||
|
|
"play_interval": 3,
|
||
|
|
"tts_pitch": 50,
|
||
|
|
"tts_speed": 50,
|
||
|
|
"tts_voice_name": "xiaoyan",
|
||
|
|
"tts_text": "你好,欢迎使用语音合成服务!",
|
||
|
|
}
|
||
|
|
)
|
||
|
|
print("TTS Response:", result)
|
||
|
|
except Exception as e:
|
||
|
|
print("Error during TTS call:", e)
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
asyncio.run(test_tts())
|