Skip to content

bestK/tosilk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tosilk Powered by Wechaty

tosilk is a online silk-v3-decoder server

You can convert between silk and MP3 through the interface of decoder and encoder

Demo (not long-term support)

https://tosilk.zeabur.app/docs

Quickly Usage

Use the following command to convert your MP3 file to Silk format:

decoder

curl -X POST -H "Content-Type: application/json" -d '{
  "base64": "<your_mp3_base64>",
  "url": "<your_mp3_url>"
}' "https://tosilk.zeabur.app/v1/decoder"

encoder

curl -X POST -H "Content-Type: application/json" -d '{
  "base64": "<your_mp3_base64>",
  "url": "<your_mp3_url>"
}' "https://tosilk.zeabur.app/v1/encoder"

in wechaty

const payload = { "url": await textToSpeechUrl(prompt) } // or payload = {"base64":"..."}
const api = await fetch('https://tosilk.zeabur.app/v1/encoder', {
  body: JSON.stringify(payload),
  method: 'post',
  headers: { "Content-Type": "application/json" }
})
const { data } = await api.json()

const sil = FileBox.fromBase64(data, `${new Date().getTime()}.sil`)
let voiceLength = Number(data.length / 1.8 / 1024 / 2).toFixed(0) * 1
if (voiceLength >= 60) {
  voiceLength = 59
}
voiceLength = voiceLength * 1000
sil.metadata = {
  voiceLength
};

await contact.say(sil)

About

convert your mp3 to silk online

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages