TTS命令
<p>[TOC]</p>
<table>
<thead>
<tr>
<th>4G喇叭</th>
<th>4G开关</th>
<th>WiFi喇叭</th>
<th>WiFi开关</th>
</tr>
</thead>
<tbody>
<tr>
<td><font color="green"><strong>&radic;</strong></font></td>
<td><font color="green"><strong>&radic;</strong></font></td>
<td><font color="gray"><strong>&ndash;</strong></font></td>
<td><font color="red"><strong>&times;</strong></font></td>
</tr>
</tbody>
</table>
<p>支持此功能的设备类型:<font color="green"><strong>&radic;</strong></font>-支持 <font color="red"><strong>&times;</strong></font>-不支持 <font color="gray"><strong>&ndash;</strong></font>-测试</p>
<h2>添加TTS语音播放(startTts)</h2>
<p><strong>简要描述</strong>
添加TTS语音播放到待播放队列。
!!!注意:WiFi喇叭需要在服务器文字转TTS音频文件后下发播放,因此需要在服务器端做TTS转换,WiFi喇叭此命令(startTts)为测试命令,生产环境建议自行生成TTS音频文件,再配合[添加网络音频播放(playUrl)命令](<a href="https://www.showdoc.com.cn/asopen/11558680252468434">https://www.showdoc.com.cn/asopen/11558680252468434</a> "添加网络音频播放(playUrl)命令")播放。详情请找我司技术支持指点。
自行生成TTS音频可参考[使用coqui-ai/TTS本地生成TTS音频](<a href="https://www.showdoc.com.cn/asopen/11558690575755815">https://www.showdoc.com.cn/asopen/11558690575755815</a> "使用coqui-ai/TTS本地生成TTS音频")</p>
<p><strong>命令参数</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必须</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>是</td>
<td>string</td>
<td>startTts</td>
</tr>
<tr>
<td>content</td>
<td>是</td>
<td>string</td>
<td>TTS内容,内容参数格式化参考下面TTS内容参数格式化(参数格式化只支持4G)</td>
</tr>
<tr>
<td>vol</td>
<td>否</td>
<td>int</td>
<td>播放音量,0~100</td>
</tr>
<tr>
<td>repeat</td>
<td>否</td>
<td>int</td>
<td>重复次数</td>
</tr>
<tr>
<td>firstPlay</td>
<td>否</td>
<td>bool</td>
<td>是否优先播放,true-是;false-否</td>
</tr>
<tr>
<td>frameId</td>
<td>否</td>
<td>string</td>
<td>帧ID</td>
</tr>
</tbody>
</table>
<p><strong>命令示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;startTts&quot;,
&quot;content&quot;: &quot;微信收款12345.67元,支付宝到账9876.64元&quot;,
&quot;vol&quot;: 50,
&quot;repeat&quot;: 2,
&quot;firstPlay&quot;: false,
&quot;frameId&quot;: &quot;1745456483900&quot;
}</code></pre>
<p><strong>应答参数说明</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>string</td>
<td>startTts</td>
</tr>
<tr>
<td>result</td>
<td>string</td>
<td>返回结果。ok-成功;其他-具体失败原因</td>
</tr>
<tr>
<td>imei</td>
<td>string</td>
<td>设备imei</td>
</tr>
<tr>
<td>frameId</td>
<td>string</td>
<td>同命令frameId</td>
</tr>
<tr>
<td>timestamp</td>
<td>int</td>
<td>秒级时间戳,WiFi款不支持</td>
</tr>
</tbody>
</table>
<p><strong>应答示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;startTts&quot;,
&quot;result&quot;: &quot;ok&quot;,
&quot;timestamp&quot;: 1745456483,
&quot;imei&quot;: &quot;864536072949900&quot;,
&quot;frameId&quot;: &quot;1745456483900&quot;
}</code></pre>
<p><strong>备注</strong>
无</p>
<h2>获取开机欢迎语音(getWelcome)</h2>
<p><strong>简要描述</strong>
获取开机欢迎语音。</p>
<p><strong>命令参数</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必须</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>是</td>
<td>string</td>
<td>getWelcome</td>
</tr>
<tr>
<td>frameId</td>
<td>否</td>
<td>string</td>
<td>帧ID</td>
</tr>
</tbody>
</table>
<p><strong>命令示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;getWelcome&quot;,
&quot;frameId&quot;: &quot;1745456483900&quot;
}</code></pre>
<p><strong>应答参数说明</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>string</td>
<td>getWelcome</td>
</tr>
<tr>
<td>result</td>
<td>string</td>
<td>返回结果。ok-成功;其他-具体失败原因</td>
</tr>
<tr>
<td>content</td>
<td>string</td>
<td>开机欢迎语音内容</td>
</tr>
<tr>
<td>enabled</td>
<td>bool</td>
<td>true-启动,false-不启动</td>
</tr>
<tr>
<td>imei</td>
<td>string</td>
<td>设备imei</td>
</tr>
<tr>
<td>frameId</td>
<td>string</td>
<td>同命令frameId</td>
</tr>
<tr>
<td>timestamp</td>
<td>int</td>
<td>秒级时间戳,WiFi款不支持</td>
</tr>
</tbody>
</table>
<p><strong>应答示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;getWelcome&quot;,
&quot;result&quot;: &quot;ok&quot;,
&quot;content&quot;: &quot;欢迎使用云喇叭&quot;,
&quot;enabled&quot;: true,
&quot;timestamp&quot;: 1745456483,
&quot;imei&quot;: &quot;864536072949900&quot;,
&quot;frameId&quot;: &quot;1745456483900&quot;
}</code></pre>
<p><strong>备注</strong>
无</p>
<h2>设置开机欢迎语音(setWelcome)</h2>
<p><strong>简要描述</strong>
设置开机欢迎语音。</p>
<p><strong>命令参数</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必须</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>是</td>
<td>string</td>
<td>setWelcome</td>
</tr>
<tr>
<td>content</td>
<td>是</td>
<td>string</td>
<td>开机欢迎语音内容</td>
</tr>
<tr>
<td>enabled</td>
<td>是</td>
<td>bool</td>
<td>true-启动,false-不启动</td>
</tr>
<tr>
<td>frameId</td>
<td>否</td>
<td>string</td>
<td>帧ID</td>
</tr>
</tbody>
</table>
<p><strong>命令示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setWelcome&quot;,
&quot;content&quot;: &quot;欢迎使用云喇叭&quot;,
&quot;enabled&quot;: true,
&quot;frameId&quot;: &quot;1745456483900&quot;
}</code></pre>
<p><strong>应答参数说明</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>string</td>
<td>setWelcome</td>
</tr>
<tr>
<td>result</td>
<td>string</td>
<td>返回结果。ok-成功;其他-具体失败原因</td>
</tr>
<tr>
<td>content</td>
<td>string</td>
<td>开机欢迎语音内容</td>
</tr>
<tr>
<td>enabled</td>
<td>bool</td>
<td>true-启动,false-不启动</td>
</tr>
<tr>
<td>imei</td>
<td>string</td>
<td>设备imei</td>
</tr>
<tr>
<td>frameId</td>
<td>string</td>
<td>同命令frameId</td>
</tr>
<tr>
<td>timestamp</td>
<td>int</td>
<td>秒级时间戳,WiFi款不支持</td>
</tr>
</tbody>
</table>
<p><strong>应答示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setWelcome&quot;,
&quot;result&quot;: &quot;ok&quot;,
&quot;content&quot;: &quot;欢迎使用云喇叭&quot;,
&quot;enabled&quot;: true,
&quot;timestamp&quot;: 1745456483,
&quot;imei&quot;: &quot;864536072949900&quot;,
&quot;frameId&quot;: &quot;1745456483900&quot;
}</code></pre>
<p><strong>备注</strong>
无</p>
<h2>TTS内容参数格式化(只支持4G)</h2>
<p>在tts语音内容里面添加[<strong>]的格式符号,实现个性化语音播报效果。具体[</strong>]格式说明如下:</p>
<p><strong>1. 原始格式(选择默认参数)</strong>
<code>您好,欢迎使用云喇叭。</code></p>
<p><strong>2. 设置发音人</strong>
发音人同时只能设置一个。
格式:<code>[m*] (*=51~55)</code>
参数:
51 – 许久
52 – 许多
53 – 晓萍
54 – 唐老鸭
55 – 许宝宝
比如选择许多(52)作为发音人:
<code>[m52]您好,欢迎使用云喇叭。</code></p>
<p><strong>3. 设置发音风格</strong>
格式:<code>[f*] (*=0/1/2)</code>
参数:
0 – 一字一顿
1 – 平铺直叙
2 – 有声有色
说明: 默认为平铺直叙风格。
<code>[f1]您好,欢迎使用云喇叭。</code></p>
<p><strong>4. 设置数字处理策略</strong>
格式: <code>[n*] (*=0/1/2)</code>
参数:
0 – 自动判断
1 – 数字作号码处理
2 – 数字作数值处理
说明: 默认为自动判断。
<code>[n1]您好,欢迎使用云喇叭。</code></p>
<p><strong>5.英文数字 0 的朗读设置</strong>
格式: <code>[o*] (*=0/1)</code>
参数:
0 – 英文数字 0 读做“0”
1 – 英文数字 0 读做“zero”
说明: 默认为英文数字 0 读做“zero”。
注意:0 只有作为号码朗读时,标记才会生效,0 处理为数值时,一律读作 zero。
<code>[o1]您好,欢迎使用云喇叭。</code></p>
<p><strong>6. 静音一段时间</strong>
格式: <code>[p*] (*=无符号整数)</code>
参数: * – 静音的时间长度,单位:毫秒(ms)
<code>[p2000]您好,欢迎使用云喇叭。</code></p>
<p><strong>7. 设置语速</strong>
格式: <code>[s*] (*=0~10)</code>
参数: * – 0-10
说明: 默认语速值为 5,语速的调节范围为默认语速的一半到两倍,即 0 的值比默认语速慢一半,10 的值比默认语速快一倍。
<code>[s5]您好,欢迎使用云喇叭。</code></p>
<p><strong>8. 设置语调</strong>
格式: <code>[t*] (*=0~10)</code>
参数: <em> – 语调值对应到参数设置的值为 6553</em> (值-5),即 0 对应 到-32765,5 对应到 0,10 对应到+32765
说明: 默认语调值为 5,语调的调节范围为默认语调基频下 64Hz 到上 128Hz。
<code>[t5]您好,欢迎使用云喇叭。</code></p>
<p><strong>9. 设置音量</strong>
格式: <code>[v*] (*=0~10)</code>
参数: <em> – 音量值对应到参数设置的值为 6553</em> (值-5),即 0 对应到-32765,5 对应到 0,10 对应到+32765。
说明: 音量的调节范围为静音到音频设备支持的最大值,默认值 5 为中间音 量。
<code>[v1]您好,欢迎使用云喇叭。</code></p>
<p><strong>10. 设置汉语号码中“1”的读法</strong>
格式: <code>[y*] (*=0/1)</code>
参数:
0 – 合成号码时“1”读成“yāo”
1 – 合成号码时“1”读成“yī”
说明: 默认合成号码时“1”读成“yāo”。
<code>[y1]您好,欢迎使用云喇叭。</code></p>