Organize the answer into a concise and natural spoken script, generate an MP3 in the current session workspace, and return it via QQ.
Dependencies
python3 -m pip install "edge-tts>=7.0,<8"
The system must also have ffmpeginstalled, used for default noise reduction and appending trailing silence.
Generate Audio
- Keep the read-aloud text natural, and remove Markdown syntax, URLs that should not be read aloud, file tags, and model or session metadata.
- The output must be located in the current working directory so that the QQ gateway can receive it. The default path is
.qq-voice/reply-<timestamp>.mp3 - Get the directory path of this Skill from the list of available Skills, then run:
python3 "<skill-dir>/scripts/voice_to_me.py" \
--text "要朗读的内容" \
--output "$PWD/.qq-voice/reply-$(date +%Y%m%d-%H%M%S).mp3"
Default persona configuration:xiaoyi(zh-CN-XiaoyiNeural)、+7Hz pitch and --rate 1.13(+13% speaking rate). Only use --voice xiaoxiao
| Parameter | Default Value | Description |
|---|---|---|
--voice |
xiaoyi |
Voice; use when the user explicitly prefers a mature voice xiaoxiao |
--rate |
1.13 |
Speaking rate, range 0.5–2.0 |
--tail-silence |
0.5 |
Seconds of silence at the end of the voice, range 0–5 |
--denoise |
On | Light high-pass, de-essing, and low-pass to suppress low-frequency rumble and high-frequency hiss. |
--no-denoise |
Turn off noise reduction | Use only when the user requests preserving the original voice. |
For longer text or text containing Shell special characters, save the read-aloud content to the session workspace, then use --text-file <path> instead of --text
By default, light noise reduction is enabled, and trailing silence is appended via MP3 stream copy to avoid re-encoding for pauses. Noise reduction consumes a small amount of extra CPU and re-encodes the audio; it may not necessarily eliminate the high-frequency texture of the synthesized voice itself, so use --no-denoise
Return via QQ
After successful generation, add the following tag on a separate new line in the final reply:
<qqvoice>/absolute/path/to/reply.mp3</qqvoice>
- Use the absolute path printed by the script. Do not place this tag in a Markdown code block.
- When replying with voice, no other text reply is needed.