Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Pico TTS. #2934

Merged
merged 3 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ New:
and `x := v`, which is still supported as a notation (#2881).
- Added `ref.make` and `ref.map`.
- Added `video.board`, `video.graph`, `video.info` (#2886).
- Added the `pico2wave` protocol in order to perform speech synthesis using
[Pico TTS](https://github.com/naggety/picotts) (#2934).

Changed:

Expand Down
28 changes: 26 additions & 2 deletions src/libs/protocols.liq
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,16 @@ def protocol.stereo(~rlog=_, ~maxtime=_, arg)
end
protocol.add(static=true, temporary=true, "stereo", protocol.stereo, doc="Convert a file to stereo (currently decodes to wav).", syntax="stereo:<uri>")

# Text2wave

let settings.protocol.text2wave = settings.make.protocol("text2wave")

let settings.protocol.text2wave.path = settings.make(
description="Path to the text2wave binary",
"text2wave"
)

# Register the text2wave: protocol using text2wav
# Register the text2wave: protocol using text2wave
# @flag hidden
def protocol.text2wave(~rlog=_, ~maxtime=_, arg) =
binary = settings.protocol.text2wave.path()
Expand All @@ -540,6 +542,26 @@ protocol.add(static=true,"text2wave",protocol.text2wave,
doc="Generate speech synthesis using text2wave. Result may be mono.",
syntax="text2wave:Text to read")

# Pico2wave

let settings.protocol.pico2wave = settings.make.protocol("pico2wave")

let settings.protocol.pico2wave.path = settings.make(
description="Path to the pico2wave binary",
"pico2wave"
)

# @flag hidden
def protocol.pico2wave(~rlog=_, ~maxtime=_, arg) =
binary = settings.protocol.pico2wave.path()
[process.uri(extname="wav", "#{binary} -w $(output) #{process.quote(arg)}")]
end
protocol.add(static=true,"pico2wave",protocol.pico2wave,
doc="Generate speech synthesis using pico2wave. Result may be mono.",
syntax="pico2wave:Text to read")

# GTTS

let settings.protocol.gtts = settings.make.protocol("gtts")

let settings.protocol.gtts.path = settings.make(
Expand All @@ -557,10 +579,12 @@ protocol.add(static=true,"gtts",protocol.gtts,
doc="Generate speech synthesis using Google translate's text-to-speech API. This requires the `gtts-cli` binary. Result may be mono.",
syntax="gtts:Text to read")

# Say

# Register the legacy say: protocol
# @flag hidden
def protocol.say(~rlog=_, ~maxtime=_, arg) =
["stereo:gtts:#{arg}", "stereo:text2wave:#{arg}"]
["stereo:pico2wave:#{arg}", "stereo:gtts:#{arg}", "stereo:text2wave:#{arg}"]
end
protocol.add(static=true,"say",protocol.say,
doc="Generate speech synthesis using text2wave. Result is always stereo.",
Expand Down