Skip to content

Commit

Permalink
Add ffmpeg tts source
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed May 22, 2024
1 parent af05083 commit 53242ea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/ffmpeg/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ func parseArgs(s string) *ffmpeg.Args {
args.Input = device.GetInput(s[i+1:])
case "virtual":
args.Input = virtual.GetInput(s[i+1:])
case "tts":
args.Input = virtual.GetInputTTS(s[i+1:])
}
} else {
args.Input = inputTemplate("file", s, query)
Expand Down
17 changes: 17 additions & 0 deletions internal/ffmpeg/virtual/virtual.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,20 @@ func GetInput(src string) string {

return input
}

func GetInputTTS(src string) string {
query, err := url.ParseQuery(src)
if err != nil {
return ""
}

input := `-re -f lavfi -i "flite=text='` + query.Get("text") + `'`

// ffmpeg -f lavfi -i flite=list_voices=1
// awb, kal, kal16, rms, slt
if voice := query.Get("voice"); voice != "" {
input += ":voice" + voice
}

return input + `"`
}

0 comments on commit 53242ea

Please sign in to comment.