为什么会报错?
-
-
请手动下载action里面的jar手动导入,目前仓库的依赖有一些问题
-
是这样吗? -
不行,还是一样的报错
-
解决了
-
但是又有了新的问题
-
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&spd=5&text=${URLEncoder.encode(text, Charsets.UTF_8)}" val stream = URL(ttsURL).openStream() if (ffmpeg.exists() && 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编码器丢失") }
安卓端收听正常,iOS/PC无声音,但语言转文本可用