Skip to content

Commit 5b9e59b

Browse files
committed
speak scripts for Windows
1 parent 3f7436e commit 5b9e59b

File tree

10 files changed

+33
-7
lines changed

10 files changed

+33
-7
lines changed

examples/talk-llama/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Example usage:
4242
## TTS
4343

4444
For best experience, this example needs a TTS tool to convert the generated text responses to voice.
45-
You can use any TTS engine that you would like - simply edit the [speak.sh](speak.sh) script to your needs.
46-
By default, it is configured to use MacOS's `say`, but you can use whatever you wish.
45+
You can use any TTS engine that you would like - simply edit the [speak](speak) script to your needs.
46+
By default, it is configured to use MacOS's `say` or Windows SpeechSynthesizer, but you can use whatever you wish.
4747

4848
## Discussion
4949

File renamed without changes.

examples/talk-llama/speak.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@powershell -ExecutionPolicy Bypass -F examples\talk\speak.ps1 %1 %2

examples/talk-llama/speak.ps1

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
2+
param(
3+
# voice options are David or Zira
4+
[Parameter(Mandatory=$true)][string]$voice,
5+
[Parameter(Mandatory=$true)][string]$text
6+
)
7+
8+
Add-Type -AssemblyName System.Speech;
9+
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;
10+
$speak.SelectVoice("Microsoft $voice Desktop");
11+
$speak.Rate="0";
12+
$speak.Speak($text);

examples/talk-llama/talk-llama.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct whisper_params {
4747
std::string language = "en";
4848
std::string model_wsp = "models/ggml-base.en.bin";
4949
std::string model_llama = "models/ggml-llama-7B.bin";
50-
std::string speak = "./examples/talk-llama/speak.sh";
50+
std::string speak = "./examples/talk-llama/speak";
5151
std::string prompt = "";
5252
std::string fname_out;
5353
std::string path_session = ""; // path to file for saving/loading model eval state

examples/talk/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ wget --quiet --show-progress -O models/ggml-gpt-2-117M.bin https://huggingface.c
3737
## TTS
3838

3939
For best experience, this example needs a TTS tool to convert the generated text responses to voice.
40-
You can use any TTS engine that you would like - simply edit the [speak.sh](speak.sh) script to your needs.
41-
By default, it is configured to use `espeak`, but you can use whatever you wish.
40+
You can use any TTS engine that you would like - simply edit the [speak](speak) script to your needs.
41+
By default, it is configured to use MacOS's `say` or `espeak` or Windows SpeechSynthesizer, but you can use whatever you wish.

examples/talk/speak.sh renamed to examples/talk/speak

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ say "$2"
1515
# Eleven Labs
1616
# To use it, install the elevenlabs module from pip (pip install elevenlabs)
1717
# It's possible to use the API for free with limited number of characters. To increase this limit register to https://beta.elevenlabs.io to get an api key and paste it after 'ELEVEN_API_KEY='
18-
#Keep the line commented to use the free version whitout api key
18+
#Keep the line commented to use the free version without api key
1919
#
2020
#export ELEVEN_API_KEY=your_api_key
2121
#wd=$(dirname $0)

examples/talk/speak.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@powershell -ExecutionPolicy Bypass -F examples\talk\speak.ps1 %1 %2

examples/talk/speak.ps1

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
2+
param(
3+
# voice options are David or Zira
4+
[Parameter(Mandatory=$true)][string]$voice,
5+
[Parameter(Mandatory=$true)][string]$text
6+
)
7+
8+
Add-Type -AssemblyName System.Speech;
9+
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;
10+
$speak.SelectVoice("Microsoft $voice Desktop");
11+
$speak.Rate="0";
12+
$speak.Speak($text);

examples/talk/talk.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct whisper_params {
3636
std::string language = "en";
3737
std::string model_wsp = "models/ggml-base.en.bin";
3838
std::string model_gpt = "models/ggml-gpt-2-117M.bin";
39-
std::string speak = "./examples/talk/speak.sh";
39+
std::string speak = "./examples/talk/speak";
4040
std::string fname_out;
4141
};
4242

0 commit comments

Comments
 (0)