With this small program, you can speak to ChatGPT and get answers with a synthetic voice, like talking to a real person. Most of the code lines were generated by ChatGPT; I just did a little refinement.
Usage:
spk2ai.py [-h] [--config CONFIG]
Optional arguments:
-h, --help
: Show help message and exit--config CONFIG
: Specify the path of the config file
Config file template:
{
"speech_region": "<region>",
"speech_key": "<api key of Speech Service>",
"openai_api_key": "<api key of ChatGPT>",
"language": "zh-CN",
"voice": "Xiaoxiao"
}
In the config file you can specify a language and a voice of the speech synthesizer, see details in: