Text to Speech Speech to Text

tts.go 941B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package mysql
  2. const ttsCollection = `lnk_corpus_tts`
  3. type Tts struct {
  4. ID int64 `db:"id"`
  5. Text string `db:"text"` //翻译的文本
  6. UniqKey string `db:"uniq_key"` //唯一键值
  7. LanguageCode string `db:"language_code"` //'en-US','en-GB','zh-CN'
  8. VoiceName string `db:"voice_name"` //发音名称
  9. Speed float64 `db:"speed"`
  10. Pitch float64 `db:"pitch"`
  11. Url string `db:"url"`
  12. }
  13. func CreateCorpusTts(text, uniqKey, languageCode, voiceName, url string, speed, pitch float64) error {
  14. var tts = &Tts{
  15. Text: text,
  16. UniqKey: uniqKey,
  17. LanguageCode: languageCode,
  18. VoiceName: voiceName,
  19. Url: url,
  20. Speed: speed,
  21. Pitch: pitch,
  22. }
  23. _, err := db_session.Collection(ttsCollection).Insert(tts)
  24. if err != nil {
  25. return err
  26. }
  27. return nil
  28. }
  29. func GetByKey(uniqKey string) error {
  30. return nil
  31. }