Open lychees opened 1 year ago
I am trying to call this file from an javascript code. But is return the following error:
stdout: D:\Dev\Github\VITS_TXT_to_Audio Loading model...... 段落の視覚的な表現方法 Raw_Text: 段落の視覚的な表現方法 Cleaned_Text: file: output//00001.wav content: 段落の視覚的な表現方法 generate failed 'gbk' codec can't encode character '\u0283' in position 11: illegal multibyte sequence
my code is below:
import { Context, Random, Schema, segment } from 'koishi' const iconv = require("iconv-lite"); const BASE_URL = 'https://mm.cqu.cc/share/zhifubaodaozhang/mp3/{0}.mp3' export interface Config {} const fs = require('fs') const {promisify} = require("util") export const name = 'alipay-voice' export const Config: Schema<Config> = Schema.object({}) function delay(n){ return new Promise(function(resolve){ setTimeout(resolve,n*1000); }); } const encoding = 'cp936'; const binaryEncoding = 'binary'; function iconvDecode(str = '') { return iconv.decode(Buffer.from(str, binaryEncoding), encoding); } export function apply(ctx: Context) { ctx.command('say <t>') .action(async (_, t) => { console.log(t) let z = await fs.promises.writeFile('../VITS_TXT_to_Audio/model/input.txt', t); async function gen() { const { spawn } = require('node:child_process'); const ls = spawn('python', ['../VITS_TXT_to_Audio/txt_to_audio.py'], { cwd: "D:/Dev/Github/VITS_TXT_to_Audio", encoding: "utf8" } ); ls.stdout.on('data', (data) => { console.log(`stdout: ${iconvDecode(data)}`); }); } await gen(); // await delay(4); return segment.audio('file:///D:/Dev/Github/VITS_TXT_to_Audio/output/00001.wav'); }) }
I am trying to call this file from an javascript code. But is return the following error:
my code is below: