mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix
This commit is contained in:
parent
1a2cdc8c0e
commit
b5bffff941
@ -105,8 +105,11 @@ type OutFormat = 'mp3' | 'amr' | 'wma' | 'm4a' | 'spx' | 'ogg' | 'wav' | 'flac'
|
||||
export async function decodeSilk(inputFilePath: string, outFormat: OutFormat = 'mp3') {
|
||||
const silk = await fsPromise.readFile(inputFilePath)
|
||||
const { data } = await decode(silk, 24000)
|
||||
const outFilePath = path.join(TEMP_DIR, path.basename(inputFilePath)) + `.${outFormat}`
|
||||
return convert(Readable.from(data), {
|
||||
const tmpPath = path.join(TEMP_DIR, path.basename(inputFilePath))
|
||||
const outFilePath = tmpPath + `.${outFormat}`
|
||||
const pcmFilePath = tmpPath + '.pcm'
|
||||
await fsPromise.writeFile(pcmFilePath, data)
|
||||
return convert(pcmFilePath, {
|
||||
input: [
|
||||
'-f s16le',
|
||||
'-ar 24000',
|
||||
|
Loading…
x
Reference in New Issue
Block a user