<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[为什么会报错?]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1619866805367-1.png" alt="1.png" class=" img-responsive img-markdown" /><br />
<img src="/assets/uploads/files/1619866805351-2.png" alt="2.png" class=" img-responsive img-markdown" /></p>
]]></description><link>https://mirai.mamoe.net/topic/186/为什么会报错</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 23:57:30 GMT</lastBuildDate><atom:link href="https://mirai.mamoe.net/topic/186.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 May 2021 11:00:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 为什么会报错? on Sun, 02 May 2021 08:45:17 GMT]]></title><description><![CDATA[<pre><code class="language-kotlin">suspend fun tts(text: String, group: Group) {
            val ffmpeg = File("ffmpeg.exe")
            val silkEncoder = File("silk_v3_encoder.exe")
            val ttsURL = "https://fanyi.baidu.com/gettts?lan=zh&amp;spd=5&amp;text=${URLEncoder.encode(text, Charsets.UTF_8)}"
            val stream = URL(ttsURL).openStream()

            if (ffmpeg.exists() &amp;&amp; silkEncoder.exists()) {
                val mp3 = File("mirai_${System.currentTimeMillis()}.mp3")
                val pcm = File("mirai_${System.currentTimeMillis()}.pcm")
                val silk = File("mirai_${System.currentTimeMillis()}.silk")

                mp3.writeBytes(stream.readAllBytes())

                try {
                    exeCmd("${ffmpeg.absolutePath} -i ${mp3.absolutePath} -f s16le -ar 24000 -ac 1 -acodec pcm_s16le -y ${pcm.absolutePath}")
                    exeCmd("${silkEncoder.absolutePath} ${pcm.absolutePath} ${silk.absolutePath} -Fs_API 24000 -tencent -quiet")
                } catch (e: IOException) {
                    group.sendMessage(e.toString())
                }
                val er = silk.toExternalResource()
                group.sendMessage(er.uploadAsVoice(group))
                mp3.delete()
                pcm.delete()
                stream.close()
                er.close()
                silk.delete()
            } else {
                group.sendMessage("ffmpeg或silk编码器丢失")
            }
</code></pre>
<p dir="auto">安卓端收听正常，iOS/PC无声音，但语言转文本可用</p>
]]></description><link>https://mirai.mamoe.net/post/887</link><guid isPermaLink="true">https://mirai.mamoe.net/post/887</guid><dc:creator><![CDATA[zhou2008]]></dc:creator><pubDate>Sun, 02 May 2021 08:45:17 GMT</pubDate></item><item><title><![CDATA[Reply to 为什么会报错? on Sun, 02 May 2021 08:43:17 GMT]]></title><description><![CDATA[<p dir="auto">但是又有了新的问题</p>
]]></description><link>https://mirai.mamoe.net/post/886</link><guid isPermaLink="true">https://mirai.mamoe.net/post/886</guid><dc:creator><![CDATA[zhou2008]]></dc:creator><pubDate>Sun, 02 May 2021 08:43:17 GMT</pubDate></item><item><title><![CDATA[Reply to 为什么会报错? on Sun, 02 May 2021 08:42:13 GMT]]></title><description><![CDATA[<p dir="auto">解决了</p>
]]></description><link>https://mirai.mamoe.net/post/885</link><guid isPermaLink="true">https://mirai.mamoe.net/post/885</guid><dc:creator><![CDATA[zhou2008]]></dc:creator><pubDate>Sun, 02 May 2021 08:42:13 GMT</pubDate></item><item><title><![CDATA[Reply to 为什么会报错? on Sat, 01 May 2021 13:29:19 GMT]]></title><description><![CDATA[<p dir="auto">不行，还是一样的报错</p>
]]></description><link>https://mirai.mamoe.net/post/878</link><guid isPermaLink="true">https://mirai.mamoe.net/post/878</guid><dc:creator><![CDATA[zhou2008]]></dc:creator><pubDate>Sat, 01 May 2021 13:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to 为什么会报错? on Sat, 01 May 2021 13:23:14 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1619875379560-3.png" alt="3.png" class=" img-responsive img-markdown" /><br />
是这样吗?</p>
]]></description><link>https://mirai.mamoe.net/post/877</link><guid isPermaLink="true">https://mirai.mamoe.net/post/877</guid><dc:creator><![CDATA[zhou2008]]></dc:creator><pubDate>Sat, 01 May 2021 13:23:14 GMT</pubDate></item><item><title><![CDATA[Reply to 为什么会报错? on Sat, 01 May 2021 13:21:36 GMT]]></title><description><![CDATA[<p dir="auto">请手动下载action里面的jar手动导入，目前仓库的依赖有一些问题</p>
]]></description><link>https://mirai.mamoe.net/post/876</link><guid isPermaLink="true">https://mirai.mamoe.net/post/876</guid><dc:creator><![CDATA[RainChan]]></dc:creator><pubDate>Sat, 01 May 2021 13:21:36 GMT</pubDate></item></channel></rss>