Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
180adb45dd | ||
|
|
5c0f08d49e | ||
|
|
571872dbe2 | ||
|
|
467bfbea55 | ||
|
|
5a3cbb6366 | ||
|
|
2351e418fd | ||
|
|
b987ff38a7 | ||
|
|
43899028e3 | ||
|
|
2c1ca8b2a3 | ||
|
|
139162c4e6 | ||
|
|
7da78ec045 | ||
|
|
11c70c7432 | ||
|
|
c2822edb1b | ||
|
|
cba7ed7b88 | ||
|
|
471a26f2a4 | ||
|
|
34d1b81ae4 | ||
|
|
f1b4d4b8b6 | ||
|
|
c05237143b | ||
|
|
c5846b832a | ||
|
|
7a38730c56 | ||
|
|
0b1e6f8711 | ||
|
|
8c38e925dd | ||
|
|
df70481934 | ||
|
|
e43c58a56e | ||
|
|
8dc9304a4c | ||
|
|
102424669b | ||
|
|
5210d075c1 | ||
|
|
30db974439 | ||
|
|
c2a558110b | ||
|
|
83ac18b83f | ||
|
|
6e36415746 | ||
|
|
fe7ffb535c | ||
|
|
80b7fccb50 | ||
|
|
2790ee9860 | ||
|
|
74ce2584cc | ||
|
|
8dd11541b4 | ||
|
|
d1317b49f0 | ||
|
|
a50d5a5028 | ||
|
|
33264554cd | ||
|
|
4a116e359a | ||
|
|
36bfb17eda | ||
|
|
697fb098c3 | ||
|
|
51a8e93df7 | ||
|
|
257fa59e70 | ||
|
|
7dbad85fc3 | ||
|
|
510894c793 | ||
|
|
a85058a3ac | ||
|
|
e54c7e4362 | ||
|
|
1f2ad303a0 | ||
|
|
d4a04096c8 | ||
|
|
dd45008e88 | ||
|
|
e9d9f54de6 | ||
|
|
3230397a82 | ||
|
|
840889ac9a | ||
|
|
d3e061b127 | ||
|
|
a428f67a2e | ||
|
|
b223e7b247 | ||
|
|
9296843508 | ||
|
|
f0c9e3e6bb | ||
|
|
22de1bf0c6 | ||
|
|
621f5434a7 | ||
|
|
81c8354cf8 | ||
|
|
3bc55a91e5 | ||
|
|
fc857f464c | ||
|
|
50aa6de96c | ||
|
|
10299194f8 | ||
|
|
d80d1ace3c | ||
|
|
f19f4e9a29 | ||
|
|
7e4ceef0e8 | ||
|
|
c1bc1f26cd | ||
|
|
70d385133d | ||
|
|
13b2eb5fe3 | ||
|
|
ff4b9d9e99 | ||
|
|
a22830f700 | ||
|
|
374c794fa9 | ||
|
|
d2adbd9c1e | ||
|
|
1dc4b8bf50 | ||
|
|
0eba72fc47 | ||
|
|
f2c87dcdab | ||
|
|
4a727ce14a | ||
|
|
6e15d43e63 | ||
|
|
dedc13b3b6 | ||
|
|
7cb206e531 | ||
|
|
4f80b39cd0 | ||
|
|
d5fa6bb46d | ||
|
|
332582baea | ||
|
|
2bd7ebc514 | ||
|
|
e5acc8bdbd | ||
|
|
7718bfd3ea | ||
|
|
002c5ad9db | ||
|
|
2c14847708 | ||
|
|
3647d69007 | ||
|
|
56a7ea1d8f | ||
|
|
863a7cd841 | ||
|
|
2e1709ab58 | ||
|
|
9c4efdc135 | ||
|
|
28675c976c | ||
|
|
afe3b9fe0b | ||
|
|
2e4d52170d | ||
|
|
0e2cc25571 | ||
|
|
abaa56e8f4 | ||
|
|
d0dc9f3212 | ||
|
|
67dcc411ad | ||
|
|
b11a087dc8 | ||
|
|
e068115eef | ||
|
|
0ec580539a | ||
|
|
e9feae12ad | ||
|
|
e183e3a7bb | ||
|
|
8a2b669da9 | ||
|
|
67d2b1c5ea | ||
|
|
f3b44424ef | ||
|
|
3b5c4b9b68 | ||
|
|
e452a926f2 | ||
|
|
b65291d44d | ||
|
|
b28ecaf43e |
No files matched your search
@@ -1,38 +1,82 @@
|
|||||||
# AllTalk TTS
|
# AllTalk TTS
|
||||||
AllTalk is an updated version of the Coqui_tts extension for Text Generation web UI. Features include:
|
AllTalk is an updated version of the Coqui_tts extension for Text Generation web UI. Features include:
|
||||||
|
|
||||||
- **Custom Start-up Settings:** Adjust your default start-up settings. [Screenshot](https://github.com/erew123/alltalk_tts#screenshots)
|
- **Can be run as a** [standalone](https://github.com/erew123/alltalk_tts/#-quick-setup-text-generation-webui--standalone-installation) **or part of** [Text-generation-webui](https://github.com/erew123/alltalk_tts/#-quick-setup-text-generation-webui--standalone-installation) **using the a quick setup utility**
|
||||||
- **Narrarator:** Use different voices for main character and narration. [Example Narration](https://vocaroo.com/18nrv7FR6wuA)
|
- **Model Finetuning:** Train the model specifically on a voice of your choosing for better reproduction.
|
||||||
- **Low VRAM mode:** Great for people with small GPU memory or if your VRAM is filled by your LLM. [Screenshot](https://github.com/erew123/alltalk_tts#screenshots)
|
|
||||||
- **DeepSpeed:** A 3-4x performance boost generating TTS. [DeepSpeed Windows/Linux Instructions](https://github.com/erew123/alltalk_tts?tab=readme-ov-file#deepspeed-installation-options) [Screenshot](https://github.com/erew123/alltalk_tts/assets/35898566/548619c8-5f1b-47d0-a73d-54d2fee3f3db)
|
|
||||||
- **Local/Custom models:** Use any of the XTTSv2 models (API Local and XTTSv2 Local).
|
- **Local/Custom models:** Use any of the XTTSv2 models (API Local and XTTSv2 Local).
|
||||||
- **Optional wav file maintenance:** Configurable deletion of old output wav files. [Screenshot](https://github.com/erew123/alltalk_tts#screenshots)
|
- **Bulk TTS Generator/Editor:** Generate hours of TTS into one big file or have something read back to you [demo](https://www.youtube.com/watch?v=hunvXn0mLzc).
|
||||||
- **Finetuning** Train the model specifically on a voice of your choosing for better reproduction.
|
- **DeepSpeed:** A 2-3x performance boost generating TTS. [Screenshot](https://github.com/erew123/screenshots/raw/main/deepspeed.jpg)
|
||||||
- **Documentation:** Fully documented with a built in webpage. [Screenshot](https://github.com/erew123/alltalk_tts#screenshots)
|
- **Low VRAM mode:** Great for people with small GPU memory or if your VRAM is filled by your LLM.
|
||||||
- **Console output** Clear command line output for any warnings or issues.
|
- **Custom Start-up Settings:** Adjust your default start-up settings. [Screenshot](https://github.com/erew123/screenshots/raw/main/settingsanddocs.jpg)
|
||||||
- **API Suite and 3rd Party support via JSON calls** Can be used with 3rd party applications via JSON calls.
|
- **Narrarator:** Use different voices for main character and narration. [Example Narration](https://vocaroo.com/18nrv7FR6wuA)
|
||||||
- **Can be run as a standalone app** Not just inside of text-generation-webui.
|
- **Optional wav file maintenance:** Configurable deletion of old output wav files. [Screenshot](https://github.com/erew123/screenshots/raw/main/settingsanddocs.jpg)
|
||||||
|
- **Documentation:** Fully documented with a built in webpage. [Screenshot](https://github.com/erew123/screenshots/raw/main/settingsanddocs.jpg)
|
||||||
|
- **Clear Console output:** Clear command line output for any warnings or issues.
|
||||||
|
- **API Suite and 3rd Party support via JSON calls:** Can be used with 3rd party applications via JSON calls.
|
||||||
|
- **SillyTavern integration:** Full integration with SillyTavern. [Screenshot](https://github.com/erew123/screenshots/raw/main/sillytavern.jpg)
|
||||||
|
|
||||||
## Index
|
## Index
|
||||||
|
|
||||||
- 🟩 [Installation](https://github.com/erew123/alltalk_tts?#-installation-on-text-generation-web-ui)
|
- 🟩 [Installation](https://github.com/erew123/alltalk_tts/#-quick-setup-text-generation-webui--standalone-installation)
|
||||||
- 🟪 [Updating & problems with updating](https://github.com/erew123/alltalk_tts?#-updating)
|
- 🟪 [Updating & problems with updating](https://github.com/erew123/alltalk_tts?#-updating)
|
||||||
- 🟫 [Screenshots](https://github.com/erew123/alltalk_tts#-screenshots)
|
- 🟫 [Screenshots](https://github.com/erew123/alltalk_tts#-screenshots)
|
||||||
- 🟨 [Help with problems](https://github.com/erew123/alltalk_tts?#-help-with-problems)
|
- 🟨 [Help with problems](https://github.com/erew123/alltalk_tts?#-help-with-problems)
|
||||||
- ⚫ [Finetuning a model](https://github.com/erew123/alltalk_tts?#-finetuning-a-model)
|
- ⚫ [Finetuning a model](https://github.com/erew123/alltalk_tts?#-finetuning-a-model)
|
||||||
- 🔵🟢🟡 [DeepSpeed Installation (Windows & Linux)](https://github.com/erew123/alltalk_tts?#-deepspeed-installation-options)
|
- 🔵🟢🟡 [DeepSpeed Installation (Windows & Linux)](https://github.com/erew123/alltalk_tts?#-deepspeed-installation-options)
|
||||||
- 🟦 [Running AllTalk as a standalone app](https://github.com/erew123/alltalk_tts?#-running-alltalk-as-a-standalone-app)
|
- ⬜ [AllTalk TTS Generator](https://github.com/erew123/alltalk_tts?#-alltalk-tts-generator)
|
||||||
- 🟠 [API Suite and JSON-CURL](https://github.com/erew123/alltalk_tts?#-api-suite-and-json-curl)
|
- 🟠 [API Suite and JSON-CURL](https://github.com/erew123/alltalk_tts?#-api-suite-and-json-curl)
|
||||||
- 🔴 [Future to-do list & Upcoming updates](https://github.com/erew123/alltalk_tts?#-future-to-do-list)
|
- 🔴 [Future to-do list & Upcoming updates](https://github.com/erew123/alltalk_tts?#-future-to-do-list)
|
||||||
|
|
||||||
## 🔄 Updates
|
## 🔄 Updates & Bug fixes
|
||||||
Please check the below link to find a list of all recent updates and changes.
|
Please check the below link to find a list of all recent updates and changes.
|
||||||
#### 🔄 **Updates list & bug fixes list** can be found [here](https://github.com/erew123/alltalk_tts/issues/25)
|
#### 🔄 **Updates list & bug fixes list** can be found [here](https://github.com/erew123/alltalk_tts/issues/25)
|
||||||
|
|
||||||
## 🟩 Installation on Text generation web UI
|
## 🟩 Quick Setup (Text-generation-webui & Standalone Installation)
|
||||||
|
For Windows 10/11 and Linux machines there is a quick setup script. Click to expand the correct section below:
|
||||||
|
<details>
|
||||||
|
<summary>QUICK SETUP - Text-Generation-webui</summary><br>
|
||||||
|
|
||||||
|
If you wish to see this as a video, please go [here](https://www.youtube.com/watch?v=icn2XS5rUH8)
|
||||||
|
1) To download the AllTalk setup you can either:
|
||||||
|
- A) On this page select **CODE** > **Download ZIP** then extract it to the text-generation-webui extensions folder<br>e.g. `\text-generation-webui\extensions\alltalk_tts\`<br><br>
|
||||||
|
- B) Go to a terminal/console, move into the `\text-generation-webui\extensions\` folder<br>and `git clone https://github.com/erew123/alltalk_tts`<br><br>
|
||||||
|
3) In a terminal/command prompt, in the text-generation-webui folder you will start its Python environment with either `cmd_windows.bat` or `./cmd_linux.sh`
|
||||||
|
4) Move into the AllTalk folder e.g. `cd extensions` then `cd alltalk_tts`
|
||||||
|
5) Start the AllTalk setup script `atsetup.bat` or `./atsetup.sh`
|
||||||
|
6) Follow the on-screen prompts and install the correct requirements files that you need. It's recommended to test AllTalk works before installing DeepSpeed.
|
||||||
|
|
||||||
|
Any time you need to make changes to AllTalk, or use Finetuning etc, always start the Text-generation-webui Python environment first.
|
||||||
|
|
||||||
|
Please read the `🟩 Other installation notes` (also additional voices are available there).
|
||||||
|
|
||||||
|
Finetuning & DeepSpeed have other installation requirements (depending on your OS) so please read any instructions in the setup utility and refer back here to this page for detailed instructions (as needed).<br><br>
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>QUICK SETUP - Standalone Installation</summary><br>
|
||||||
|
|
||||||
|
If you wish to see this as a video, please go [here](https://www.youtube.com/watch?v=AQYCccDRbaY)
|
||||||
|
1) To download the AllTalk setup you can either:
|
||||||
|
- A) On this page select **CODE** > **Download ZIP** then extract it to the folder of your choice<br>e.g. `C:\myfiles\alltalk_tts\`<br><br>
|
||||||
|
- B) Go to a terminal/console, move into the folder of your choice e.g `C:\myfiles\` folder<br>and `git clone https://github.com/erew123/alltalk_tts`<br><br>
|
||||||
|
4) In a terminal/command prompt, move into the AllTalk folder e.g. `cd alltalk_tts`
|
||||||
|
5) Start the AllTalk setup script `atsetup.bat` or `./atsetup.sh`
|
||||||
|
6) Follow the on-screen prompts and install the correct requirements files that you need. It's recommended to test AllTalk works before installing DeepSpeed.
|
||||||
|
|
||||||
|
DeepSpeed on Windows machines will be installed as standard. Linux machines have other requirements which are detailed within the setup utility and on this page.
|
||||||
|
|
||||||
|
Please read the `🟩 Other installation notes` (also additional voices are available there).
|
||||||
|
|
||||||
|
Finetuning has other installation requirements so please read any instructions in the setup utility and refer back here to this page for detailed instructions.<br><br>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 🟩 Manual Installation - As part of Text generation web UI
|
||||||
|
On Mac's or if you wish to perform a manual installation. Click to expand the correct section below:
|
||||||
|
<details>
|
||||||
|
<summary>MANUAL INSTALLATION - Text-Generation-webui</summary><br>
|
||||||
|
|
||||||
This has been tested on the current Dec 2023 release of Text generation webUI. If you have not updated it for a while, you may wish to update Text generation webUI, [instructions here](https://github.com/oobabooga/text-generation-webui?tab=readme-ov-file#how-to-install)
|
This has been tested on the current Dec 2023 release of Text generation webUI. If you have not updated it for a while, you may wish to update Text generation webUI, [instructions here](https://github.com/oobabooga/text-generation-webui?tab=readme-ov-file#how-to-install)
|
||||||
|
|
||||||
If you want to watch a video of how to do the below [link here](https://youtu.be/9BPKuwaav5w)
|
- If you want to watch a video of how to do the below [link here](https://youtu.be/9BPKuwaav5w)<br>
|
||||||
|
|
||||||
1) In a command prompt/terminal window you need to move into your Text generation webUI folder:<br><br>
|
1) In a command prompt/terminal window you need to move into your Text generation webUI folder:<br><br>
|
||||||
`cd text-generation-webui`
|
`cd text-generation-webui`
|
||||||
@@ -56,10 +100,64 @@ If you want to watch a video of how to do the below [link here](https://youtu.be
|
|||||||
7) **(Optional DeepSpeed)** If you have an Nvidia Graphics card on a system running Linux or Windows and wish to use **DeepSpeed** please follow these instructions [here](https://github.com/erew123/alltalk_tts?#-deepspeed-installation-options). **However**, I would highly reccommend before you install DeepSpeed, you start text-generation-webui up, confirm AllTalk starts correctly and everything is working, as DeepSpeed can add another layer of complications troubleshooting any potential start-up issues. If necessary you can `pip uninstall deepspeed`.
|
7) **(Optional DeepSpeed)** If you have an Nvidia Graphics card on a system running Linux or Windows and wish to use **DeepSpeed** please follow these instructions [here](https://github.com/erew123/alltalk_tts?#-deepspeed-installation-options). **However**, I would highly reccommend before you install DeepSpeed, you start text-generation-webui up, confirm AllTalk starts correctly and everything is working, as DeepSpeed can add another layer of complications troubleshooting any potential start-up issues. If necessary you can `pip uninstall deepspeed`.
|
||||||
|
|
||||||
8) You can now start move back to the main Text generation webUI folder `cd ..` (a few times), start Text generation webUI with whichever **one** of the startup scripts is correct for your OS (`start_windows.bat`,`./start_linux.sh`, `start_macos.sh` or `start_wsl.bat`) and load the AllTalk extension in the Text generation webUI **session** tab.<br><br> Starting Text-generation-webui with its correct start-up script is $\textcolor{red}{\textsf{VERY IMPORTANT}}$.
|
8) You can now start move back to the main Text generation webUI folder `cd ..` (a few times), start Text generation webUI with whichever **one** of the startup scripts is correct for your OS (`start_windows.bat`,`./start_linux.sh`, `start_macos.sh` or `start_wsl.bat`) and load the AllTalk extension in the Text generation webUI **session** tab.<br><br> Starting Text-generation-webui with its correct start-up script is $\textcolor{red}{\textsf{VERY IMPORTANT}}$.
|
||||||
|
|
||||||
10) Please read the note below about start-up times and also the note about ensuring your character cards are set up [correctly](https://github.com/erew123/alltalk_tts#the-one-thing-i-cant-easily-work-around)
|
|
||||||
|
|
||||||
11) Some extra voices downloadable [here](https://drive.google.com/file/d/1bYdZdr3L69kmzUN3vSiqZmLRD7-A3M47/view?usp=drive_link)
|
Any time you need to make changes to AllTalk, or use Finetuning etc, always start the Text-generation-webui Python environment first.
|
||||||
|
|
||||||
|
Please read the `🟩 Other installation notes` (also additional voices are available there).
|
||||||
|
|
||||||
|
Finetuning & DeepSpeed have other installation requirements (depending on your OS) so please read any instructions in the setup utility and refer back here to this page for detailed instructions (as needed).<br><br>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 🟩 Manual Installation - As a Standalone Application
|
||||||
|
On Mac's or if you wish to perform a manual installation. Click to expand the correct section below:
|
||||||
|
<details>
|
||||||
|
<summary>MANUAL INSTALLATION - I want to run AllTalk as a standalone when installed with Text-generation-webui</summary><br>
|
||||||
|
|
||||||
|
If you already have AllTalk as a extension of Text-generation-webui, and wish to run it as standalone, load Text-generation-webui's Python environment `cmd_windows.bat`, `./cmd_linux.sh`, `cmd_macos.sh` or `cmd_wsl.bat`, move into the AllTalk folder `cd extensions` > `cd alltalk_tts` and start AllTalk with `python script.py`. There is nothing beyond this you would need to do.
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>MANUAL INSTALLATION - I wish to do a custom install of AllTalk</summary><br>
|
||||||
|
|
||||||
|
AllTalk will run as a standalone app, as long as you install its requirements files into whatever Python environment you are using. You can follow the steps to install the AllTalk's requirements into whatever Python environment you wish. Because I dont know what Python environment you are wanting to use, I can only give you a loose set of installation instructions.
|
||||||
|
|
||||||
|
Please note, at time of writing, the TTS engine requires Python **3.9.x** to **3.11.x** [TTS Engine details here](https://pypi.org/project/TTS/). AllTalk and its requirements are tested on Python **3.11.x**.
|
||||||
|
|
||||||
|
#### 🟩 A very quick understanding of Python Environments.
|
||||||
|
Different Python applications have different requirements, some of those requirement’s conflict with other Python applications requirements. To work around this problem, you can create different Python environments that remain separated from one another. A simple way of looking at Python environments, is just like how your house has different rooms for specific purposes (Kitchen, Bathroom, Bedroom etc). You can create a Python environment that is built/customised specifically for your current applications needs/purposes and will **not** interfere with any other Python applications environments/installations. <br><br>If you are adept at managing Python environments, have an existing Python environment and know that you won’t cause any conflicts by installing AllTalk's requirements within that Python environment, then load up your Python environment and install the requirements. For everyone else, here is a basic guide on installing AllTalk in its own custom Python environment (there will be small variations between OS's, but the principle is the same).
|
||||||
|
|
||||||
|
**Note:** A standard VENV can cause module path issues, hence Conda is the correct method to create a Python environment for AllTalk.
|
||||||
|
|
||||||
|
#### 🟩 Building a custom Python Environment with Miniconda
|
||||||
|
1) Open a terminal/command prompt, and confirm that both `python --version` and `pip` both work. Neither of them should give an error message. If they do you may need to install Python (and maybe Pip).<br><br>[Python Website](https://www.python.org/downloads/)<br>[Pip Website](https://pip.pypa.io/en/stable/installation/)<br><br>Once you have those working you can now continue on.<br><br>
|
||||||
|
|
||||||
|
2) Assuming you don't already have Miniconda installed, we will need to download and install Minoconda as this is what we will use to build our custom Python environment.<br><br>[Miniconda Website](https://docs.conda.io/projects/miniconda/en/latest/)<br><br>Download the Miniconda version that is correct for your OS and then install it. Miniconda will create some items in your Start Menu or Application Launcher called something like `Anaconda Prompt`<br><br> You will start the `Anaconda Prompt` and your prompt in your terminal/command prompt will say something like: <br><br>`(base) C:\users\myaccount\>`<br><br> The important bit is that it has the `(base)`, the location after that doesn't matter. `(base)` signifies we are in the base conda Python environment and can now create custom Python environments with Conda.<br><br>
|
||||||
|
|
||||||
|
3) In your Anaconda Prompt command prompt/terminal, move into the folder where you want to download AllTalk to and then git clone this repository. For simplicity I am going to assume that location is `c:\myfiles\`. So you will:<br><br>`cd myfiles`<br><br>`git clone https://github.com/erew123/alltalk_tts`<br><br>
|
||||||
|
|
||||||
|
4) Now we will create our custom Conda Python 3.11.5 environment and give it the name alltalkenv by typing the following at the prompt:<br><br>`conda create --name alltalkenv python=3.11.5`<br><br>You will be prompted if you want to continue and you say yes.<br><br>Once that process has completed, we now need to change from the `(base)` Conda Python environment, to our newly created `(alltalkenv)` environment. So type the following:<br><br>`conda activate alltalkenv`<br><br>Your prompt should now change from `(base) C:\myfiles\>` to `(alltalkenv) C:\myfiles\>`<br><br>
|
||||||
|
|
||||||
|
5) **If you are NOT using an Nvidia card and CUDA, skip to step 6**. To force PyTorch to install with CUDA, perform the following:<br><br>`pip cache purge` (Clear the current Pip cache)<br><br>`pip uninstall torch torchaudio` (Uninstall Torch and Torchaudio from the `alltalkenv` environment)<br><br>
|
||||||
|
You can now either install the CUDA 11.8 or 12.1 version of Torch and Torchaudio with **one** of the following<br><br>**CUDA 11.8** > `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118`<br><br>**CUDA 12.1** > `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121`<br><br>
|
||||||
|
|
||||||
|
6) Move into the alltalk_tts folder and install one of the two requirements files. Whichever one of the two is correct for your machine type:<br><br>`cd alltalk_tts`<br><br>
|
||||||
|
**Nvidia graphics card machines** - `pip install -r requirements_nvidia.txt`<br><br>
|
||||||
|
**Other machines (mac, amd etc)** - `pip install -r requirements_other.txt`<br><br>
|
||||||
|
|
||||||
|
7) Start AllTalk with `python script.py`<br><br>
|
||||||
|
|
||||||
|
🟩 Anytime you wish to use AllTalk, update its requirements, install some other requirements such as DeepSpeed, you will need to start its Conda Python Environment in the terminal/prompt, which you will do with `conda activate alltalkenv` as long as the Conda executable is accessible at the command prompt/terminal you are in.<br><br>It is fully possible to create a batch file or script file that you can use as a launcher from your Start Menu/Application Launcher that will start the environment and AllTalk for you.
|
||||||
|
|
||||||
|
Deepspeed and other such things can be installed. Please read the relevant instructions for those items, however, make the relevant changes to load your correct Python environment when installing any requirements files and starting AllTalk.<br><br>
|
||||||
|
|
||||||
|
Any time you need to make changes to AllTalk, or use Finetuning etc, always start your Python environment first.
|
||||||
|
|
||||||
|
Please read the `🟩 Other installation notes` (also additional voices are available there).
|
||||||
|
|
||||||
|
Finetuning & DeepSpeed have other installation requirements (depending on your OS) so please read any instructions in the setup utility and refer back here to this page for detailed instructions (as needed).<br><br>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
#### 🟩 Other installation notes
|
#### 🟩 Other installation notes
|
||||||
On first startup, AllTalk will download the Coqui XTTSv2 2.0.2 model to its **models** folder (1.8GB space required). Check the command prompt/terminal window if you want to know what its doing. After it says "Model Loaded" the Text generation webUI is usually available on its IP address a few seconds later, for you to connect to in your browser.
|
On first startup, AllTalk will download the Coqui XTTSv2 2.0.2 model to its **models** folder (1.8GB space required). Check the command prompt/terminal window if you want to know what its doing. After it says "Model Loaded" the Text generation webUI is usually available on its IP address a few seconds later, for you to connect to in your browser.
|
||||||
@@ -68,7 +166,11 @@ Once the extension is loaded, please find all documentation and settings on the
|
|||||||
|
|
||||||
**Where to find voices** https://aiartes.com/voiceai or https://commons.wikimedia.org/ or interviews on youtube etc. Instructions on how to cut down and prepare a voice sample are within the built in documentation.
|
**Where to find voices** https://aiartes.com/voiceai or https://commons.wikimedia.org/ or interviews on youtube etc. Instructions on how to cut down and prepare a voice sample are within the built in documentation.
|
||||||
|
|
||||||
#### 🟩 The one thing I cant easily work around
|
Please read the note below about start-up times and also the note about ensuring your character cards are set up [correctly](https://github.com/erew123/alltalk_tts#-a-note-on-character-cards--greeting-messages)
|
||||||
|
|
||||||
|
Some extra voices for AllTalk are downloadable [here](https://drive.google.com/file/d/1bYdZdr3L69kmzUN3vSiqZmLRD7-A3M47/view?usp=drive_link)
|
||||||
|
|
||||||
|
#### 🟩 A note on Character Cards & Greeting Messages
|
||||||
Messages intended for the Narrator should be enclosed in asterisks `*` and those for the character inside quotation marks `"`. However, AI systems often deviate from these rules, resulting in text that is neither in quotes nor asterisks. Sometimes, text may appear with only a single asterisk, and AI models may vary their formatting mid-conversation. For example, they might use asterisks initially and then switch to unmarked text. A properly formatted line should look like this:
|
Messages intended for the Narrator should be enclosed in asterisks `*` and those for the character inside quotation marks `"`. However, AI systems often deviate from these rules, resulting in text that is neither in quotes nor asterisks. Sometimes, text may appear with only a single asterisk, and AI models may vary their formatting mid-conversation. For example, they might use asterisks initially and then switch to unmarked text. A properly formatted line should look like this:
|
||||||
|
|
||||||
`"`Hey! I'm so excited to finally meet you. I've heard so many great things about you and I'm eager to pick your brain about computers.`"` `*`She walked across the room and picked up her cup of coffee`*`
|
`"`Hey! I'm so excited to finally meet you. I've heard so many great things about you and I'm eager to pick your brain about computers.`"` `*`She walked across the room and picked up her cup of coffee`*`
|
||||||
@@ -78,21 +180,33 @@ Most narrator/character systems switch voices upon encountering an asterisk or q
|
|||||||
With improvements to the splitter/processor, I'm confident it's functioning well. You can monitor what AllTalk identifies as Narrator lines on the command line and adjust its behavior if needed (Text Not Inside - Function).
|
With improvements to the splitter/processor, I'm confident it's functioning well. You can monitor what AllTalk identifies as Narrator lines on the command line and adjust its behavior if needed (Text Not Inside - Function).
|
||||||
|
|
||||||
## 🟪 Updating
|
## 🟪 Updating
|
||||||
|
<details>
|
||||||
|
<summary>UPDATING - I am using Text-Generation-webui</summary><br>
|
||||||
This is pretty much a repeat of the installation process.
|
This is pretty much a repeat of the installation process.
|
||||||
|
|
||||||
1) In a command prompt/terminal window you need to move into your Text generation webUI folder:<br><br>
|
1) In a command prompt/terminal window you need to move into your Text generation webUI folder:<br><br>
|
||||||
`cd text-generation-webui` and start the Python environment for your OS with whichever **one** of the below is correct for your OS:<br><br>
|
`cd text-generation-webui` and start the Python environment for your OS with whichever **one** of the below is correct for your OS:<br><br>
|
||||||
`cmd_windows.bat`, `./cmd_linux.sh`, `cmd_macos.sh` or `cmd_wsl.bat`<br>
|
`cmd_windows.bat`, `./cmd_linux.sh`, `cmd_macos.sh` or `cmd_wsl.bat`<br>
|
||||||
|
|
||||||
2) Move into your extensions and alltalk_tts folder:<br><br>
|
2) Move into your extensions and alltalk_tts folder e.g. `cd extensions` then `cd alltalk_tts`
|
||||||
`cd extensions` then `cd alltalk_tts`
|
|
||||||
|
|
||||||
3) At the command prompt/terminal, type:<br><br>
|
3) At the command prompt/terminal, type `git pull`
|
||||||
`git pull`
|
|
||||||
|
|
||||||
4) Install the correct requirements for your machine:<br><br>
|
4) Install the correct requirements for your machine:<br><br>
|
||||||
**Nvidia graphics card machines** - `pip install -r requirements_nvidia.txt`<br><br>
|
**Nvidia graphics card machines** - `pip install -r requirements_nvidia.txt`<br><br>
|
||||||
**Other machines (mac, amd etc)** - `pip install -r requirements_other.txt`
|
**Other machines (mac, amd etc)** - `pip install -r requirements_other.txt`<br><br>
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>UPDATING - I am running as a Standalone Application</summary><br>
|
||||||
|
|
||||||
|
1) In a command prompt/terminal window you need to move into your `alltalk_tts` folder and run `start_environment.bat` or `/start_environment.sh` to load the Python environment.
|
||||||
|
|
||||||
|
2) At the command prompt/terminal, type `git pull` and wait for it to complete the download.
|
||||||
|
|
||||||
|
3) Install the correct requirements for your machine:<br><br>
|
||||||
|
**Nvidia graphics card machines** - `pip install -r requirements_nvidia.txt`<br><br>
|
||||||
|
**Other machines (mac, amd etc)** - `pip install -r requirements_other.txt`<br><br>
|
||||||
|
</details>
|
||||||
|
|
||||||
#### 🟪 Updating "git pull" error
|
#### 🟪 Updating "git pull" error
|
||||||
|
|
||||||
@@ -145,15 +259,16 @@ Assuming its all working fine and you are happy, you can delete the old alltalk_
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
## 🟫 Screenshots
|
## 🟫 Screenshots
|
||||||
| |  |
|
| |  |  | |
|
||||||
|:---:|:---:|
|
|:---:|:---:|:---:|:---:|
|
||||||
| |  |
|
| |  |  ||
|
||||||
| |  |
|
|
||||||
|
|
||||||
## 🟨 Help with problems
|
## 🟨 Help with problems
|
||||||
|
|
||||||
#### 🔄 **Minor updates/bug fixes list** can be found [here](https://github.com/erew123/alltalk_tts/issues/25)
|
#### 🔄 **Minor updates/bug fixes list** can be found [here](https://github.com/erew123/alltalk_tts/issues/25)
|
||||||
|
|
||||||
#### 🟨 How to make a diagnostics report file
|
#### 🟨 How to make a diagnostics report file
|
||||||
|
If you are on a Windows machine or a Linux machine, you should be able to use the `atsetup.bat` or `./atsetup.sh` utility to create a diagnositcs file. If you are unable to use the `atsetup` utility, please follow the instructions below.
|
||||||
<details>
|
<details>
|
||||||
<summary>Click to expand</summary>
|
<summary>Click to expand</summary>
|
||||||
|
|
||||||
@@ -283,6 +398,7 @@ If you have a voice that the model doesnt quite reproduce correctly, or indeed y
|
|||||||
- To install a few portions of the Nvidia CUDA 11.8 Toolkit (this will not impact text-generation-webui's cuda setup.
|
- To install a few portions of the Nvidia CUDA 11.8 Toolkit (this will not impact text-generation-webui's cuda setup.
|
||||||
- 18GB of disk space free (most of this is used temporarily)
|
- 18GB of disk space free (most of this is used temporarily)
|
||||||
- At least 2 minutes of good quality speech from your chosen speaker in mp3, wav or flacc format, in one or more files (have tested as far as 20 minutes worth of audio).
|
- At least 2 minutes of good quality speech from your chosen speaker in mp3, wav or flacc format, in one or more files (have tested as far as 20 minutes worth of audio).
|
||||||
|
- As a side note, many people seem to think that the Whisper v2 model (used on Step 1) is giving better results at generating training datasets, so you may prefer to try that, as opposed to the Whisper 3 model.
|
||||||
|
|
||||||
#### ⚫ How will this work/How complicated is it?
|
#### ⚫ How will this work/How complicated is it?
|
||||||
Everything has been done to make this as simple as possible. At its simplest, you can literally just download a large chunk of audio from an interview, and tell the finetuning to strip through it, find spoken parts and build your dataset. You can literally click 4 buttons, then copy a few files and you are done. At it's more complicated end you will clean up the audio a little beforehand, but its still only 4x buttons and copying a few files.
|
Everything has been done to make this as simple as possible. At its simplest, you can literally just download a large chunk of audio from an interview, and tell the finetuning to strip through it, find spoken parts and build your dataset. You can literally click 4 buttons, then copy a few files and you are done. At it's more complicated end you will clean up the audio a little beforehand, but its still only 4x buttons and copying a few files.
|
||||||
@@ -291,8 +407,8 @@ Everything has been done to make this as simple as possible. At its simplest, yo
|
|||||||
I would suggest that if its in an interview format, you cut out the interviewer speaking in audacity or your chosen audio editing package. You dont have to worry about being perfect with your cuts, the finetuning Step 1 will go and find spoken audio and cut it out for you. Is there is music over the spoken parts, for best quality you would cut out those parts, though its not 100% necessary. As always, try to avoid bad quality audio with noises in it (humming sounds, hiss etc). You can try something like [Audioenhancer](https://audioenhancer.ai/) to try clean up noisier audio. There is no need to down-sample any of the audio, all of that is handled for you. Just give the finetuning some good quality audio to work with.
|
I would suggest that if its in an interview format, you cut out the interviewer speaking in audacity or your chosen audio editing package. You dont have to worry about being perfect with your cuts, the finetuning Step 1 will go and find spoken audio and cut it out for you. Is there is music over the spoken parts, for best quality you would cut out those parts, though its not 100% necessary. As always, try to avoid bad quality audio with noises in it (humming sounds, hiss etc). You can try something like [Audioenhancer](https://audioenhancer.ai/) to try clean up noisier audio. There is no need to down-sample any of the audio, all of that is handled for you. Just give the finetuning some good quality audio to work with.
|
||||||
|
|
||||||
#### ⚫ Important requirements CUDA 11.8
|
#### ⚫ Important requirements CUDA 11.8
|
||||||
As mentioned you must have a small portion of the Nvidia CUDA Toolkit **11.8** installed. Not higher or lower versions. Specifically **11.8**. You do not have to uninstall any other versions, change any graphics drivers, reinstall torch or anything like that. To keep the download+install as small as possible, you will need to:
|
As mentioned you must have a small portion of the Nvidia CUDA Toolkit **11.8** installed. Not higher or lower versions. Specifically **11.8**. You do not have to uninstall any other versions, change any graphics drivers, reinstall torch or anything like that. This requirement is for Step1 of Finetuning. To keep the download+install as small as possible, you will need to:
|
||||||
- Download the **xxx (network)** install of the Nvidia Cuda Toolkit 11.8 from [here](https://developer.nvidia.com/cuda-11-8-0-download-archive)
|
- Download the **xxx (network)** install of the Nvidia CUDA Toolkit 11.8 from [here](https://developer.nvidia.com/cuda-11-8-0-download-archive)
|
||||||
- Run the installer. At minimum, you need to [minimally] install the `nvcc` compiler and the `CUBLAS` development and runtime libraries:
|
- Run the installer. At minimum, you need to [minimally] install the `nvcc` compiler and the `CUBLAS` development and runtime libraries:
|
||||||
- Select **Custom Advanced** as your installation type.
|
- Select **Custom Advanced** as your installation type.
|
||||||
- Uncheck all the checkboxes in the list.
|
- Uncheck all the checkboxes in the list.
|
||||||
@@ -311,6 +427,8 @@ As mentioned you must have a small portion of the Nvidia CUDA Toolkit **11.8** i
|
|||||||
- When you have made the changes, open a **new** terminal/command prompt (in order to load the new search paths) and `nvcc --version`. It should report back `Cuda compilation tools, release 11.8.` at which point, you are good to go.
|
- When you have made the changes, open a **new** terminal/command prompt (in order to load the new search paths) and `nvcc --version`. It should report back `Cuda compilation tools, release 11.8.` at which point, you are good to go.
|
||||||
- If it doesn't report that, check you have correctly set the search environment paths, dont have overlapping other versions of cuda paths etc.
|
- If it doesn't report that, check you have correctly set the search environment paths, dont have overlapping other versions of cuda paths etc.
|
||||||
|
|
||||||
|
**Note:** Its also important that your Torch and Torchaudio have cuda installed (of any version). If you run the AllTalk diagnostics you can see your Torch and Torchaudio versions listed there. Cuda 11.8 will be listed as `cu118` and Cuda 12.1 as `cu121`. This Torch and Torchaudio is seperate to the above requirement to have the Nvidia CUDA Toolkit installed, so dont confuse the two different requirements. If you dont have Cuda installed on Torch and Torchaudio, Step 2 of Finetuning will fail.
|
||||||
|
|
||||||
#### ⚫ Starting Finetuning
|
#### ⚫ Starting Finetuning
|
||||||
**NOTE:** Please make sure you have started AllTalk at least once after updating, so that it downloads the additional files needed for finetuning.
|
**NOTE:** Please make sure you have started AllTalk at least once after updating, so that it downloads the additional files needed for finetuning.
|
||||||
|
|
||||||
@@ -358,6 +476,8 @@ If you've compacted and moved your model, its highly unlikely you would want to
|
|||||||
|
|
||||||
➡️DeepSpeed requires an Nvidia Graphics card!⬅️
|
➡️DeepSpeed requires an Nvidia Graphics card!⬅️
|
||||||
|
|
||||||
|
- #### DeepSpeed Installation for Text generation webUI
|
||||||
|
|
||||||
1) Preferably use your built in package manager to install CUDA tools. Alternatively download and install the Nvidia Cuda Toolkit for Linux [Nvidia Cuda Toolkit 11.8 or 12.1](https://developer.nvidia.com/cuda-toolkit-archive)<br><br>
|
1) Preferably use your built in package manager to install CUDA tools. Alternatively download and install the Nvidia Cuda Toolkit for Linux [Nvidia Cuda Toolkit 11.8 or 12.1](https://developer.nvidia.com/cuda-toolkit-archive)<br><br>
|
||||||
2) Open a terminal console.<br><br>
|
2) Open a terminal console.<br><br>
|
||||||
3) Install libaio-dev (however your Linux version installs things) e.g. `sudo apt install libaio-dev`<br><br>
|
3) Install libaio-dev (however your Linux version installs things) e.g. `sudo apt install libaio-dev`<br><br>
|
||||||
@@ -369,14 +489,36 @@ If you've compacted and moved your model, its highly unlikely you would want to
|
|||||||
`export CUDA_HOME=/etc/alternatives/cuda`<br><br>
|
`export CUDA_HOME=/etc/alternatives/cuda`<br><br>
|
||||||
**every** time you run `./cmd_linux.sh`.<br> <br>
|
**every** time you run `./cmd_linux.sh`.<br> <br>
|
||||||
If you try to start DeepSpeed with the CUDA_HOME path set incorrectly, expect an error similar to `[Errno 2] No such file or directory: /home/yourname/text-generation-webui/installer_files/env/bin/nvcc`<br> <br>
|
If you try to start DeepSpeed with the CUDA_HOME path set incorrectly, expect an error similar to `[Errno 2] No such file or directory: /home/yourname/text-generation-webui/installer_files/env/bin/nvcc`<br> <br>
|
||||||
9) Now install deepspeed with pip install deepspeed<br><br>
|
8) Now install deepspeed with pip install deepspeed<br><br>
|
||||||
10) You can now start Text generation webUI `python server.py` ensuring to activate your extensions.<br><br>
|
9) You can now start Text generation webUI `python server.py` ensuring to activate your extensions.<br><br>
|
||||||
Just to reiterate, starting Text-generation-webUI with `./start_linux.sh` will overwrite the CUDA_HOME variable unless you have permanently changed it, hence always starting it with `./cmd_linux.sh` **then** setting the environment variable manually (step 7) and **then** `python server.py`, which is how you would need to run it each time, unless you permanently set the environment variable for CUDA_HOME within Text-generation-webUI's standard Python environment.
|
Just to reiterate, starting Text-generation-webUI with `./start_linux.sh` will overwrite the CUDA_HOME variable unless you have permanently changed it, hence always starting it with `./cmd_linux.sh` **then** setting the environment variable manually (step 7) and **then** `python server.py`, which is how you would need to run it each time, unless you permanently set the environment variable for CUDA_HOME within Text-generation-webUI's standard Python environment.
|
||||||
<br><br>
|
<br><br>
|
||||||
**Removal** - If it became necessary to uninstall DeepSpeed, you can do so with `./cmd_linux.sh` and then `pip uninstall deepspeed`<br><br>
|
**Removal** - If it became necessary to uninstall DeepSpeed, you can do so with `./cmd_linux.sh` and then `pip uninstall deepspeed`<br><br>
|
||||||
|
|
||||||
|
- #### DeepSpeed Installation for standalone alltalk_tts app
|
||||||
|
|
||||||
|
1) Preferably use your built in package manager to install CUDA tools. Alternatively download and install the Nvidia Cuda Toolkit for Linux [Nvidia Cuda Toolkit 11.8 or 12.1](https://developer.nvidia.com/cuda-toolkit-archive)<br><br>
|
||||||
|
2) Open a terminal console.<br><br>
|
||||||
|
3) Install libaio-dev (however your Linux version installs things) e.g. `sudo apt install libaio-dev` If you are using an RPM based distribution the package will probably be named `libaio-devel`.<br><br>
|
||||||
|
4) Navigate to your alltalk_tts folder e.g. `cd alltext_tts`<br><br>
|
||||||
|
5) Start the alltalk_tts Python environment `conda activate alltalkenv`<br><br>
|
||||||
|
6) You will need to set the **CUDA_HOME** environment variable. Details to change it each time are on the next step. Below is a link to Conda's manual and changing environment variables permanently though its possible changing it permanently could affect other extensions, you would have to test.<br> <br>
|
||||||
|
[Conda manual - Environment variables](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#set-env-vars)<br><br>
|
||||||
|
7) Set the environment path for CUDA_HOME e.g. `export CUDA_HOME=/usr/local/cuda-12.1/bin` or `export CUDA_HOME=/etc/alternative/cuda`. Verify the path on your Linux distro before setting this variable.<br>
|
||||||
|
If you try to start DeepSpeed with the CUDA_HOME path set incorrectly, expect an error similar to `[Errno 2] No such file or directory` or `CUDA_HOME does not exist`<br> <br>
|
||||||
|
If you set the `env` variable and you receive an error of `[Errno 2] No such file or directory: '/usr/local/cuda-12.1/bin/bin/nvcc'` with a double `bin/bin` path, you can remove the env variable with `unset CUDA_HOME` and add the path to your linux PATH env variable with: `export PATH=$PATH:/usr/local/cuda-12.1/bin`. (Verify the path on your Linux distro before setting this variable.) However if you are using other applications that use CUDA, you will want to verify that configuring the path did not break those applications. <br><br>
|
||||||
|
8) Now install deepspeed with `pip install deepspeed`<br><br>
|
||||||
|
9) You can now start the alltalk_tts webUI with `python script.py`<br><br>
|
||||||
|
<br><br>
|
||||||
|
**Removal** - If it became necessary to uninstall DeepSpeed, you can do so by entering your `alltalkenv` enviroment `conda activate alltalkenv` and then running `pip uninstall deepspeed`<br><br>
|
||||||
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
#### 🟢🟡 Windows Installation
|
#### 🟢🟡 Windows Installation
|
||||||
|
<details>
|
||||||
|
<summary>Click to Expand: Windows DeepSpeed options</summary><br>
|
||||||
|
|
||||||
DeepSpeed v11.2 will work on the current default text-generation-webui Python 3.11 environment! You have 2x options for how to setup DeepSpeed on Windows. A quick way (🟢Option 1) and a long way (🟡Option 2).
|
DeepSpeed v11.2 will work on the current default text-generation-webui Python 3.11 environment! You have 2x options for how to setup DeepSpeed on Windows. A quick way (🟢Option 1) and a long way (🟡Option 2).
|
||||||
|
|
||||||
Thanks to [@S95Sedan](https://github.com/S95Sedan) - They managed to get DeepSpeed 11.2 working on Windows via making some edits to the original Microsoft DeepSpeed v11.2 installation. The original post is [here](https://github.com/oobabooga/text-generation-webui/issues/4734#issuecomment-1843984142).
|
Thanks to [@S95Sedan](https://github.com/S95Sedan) - They managed to get DeepSpeed 11.2 working on Windows via making some edits to the original Microsoft DeepSpeed v11.2 installation. The original post is [here](https://github.com/oobabooga/text-generation-webui/issues/4734#issuecomment-1843984142).
|
||||||
@@ -501,31 +643,44 @@ def get_shm_size():
|
|||||||
<br><br>
|
<br><br>
|
||||||
**Removal** - If it became necessary to uninstall DeepSpeed, you can do so with `cmd_windows.bat` and then `pip uninstall deepspeed`<br><br>
|
**Removal** - If it became necessary to uninstall DeepSpeed, you can do so with `cmd_windows.bat` and then `pip uninstall deepspeed`<br><br>
|
||||||
</details>
|
</details>
|
||||||
|
</details>
|
||||||
|
|
||||||
## 🟦 Running AllTalk as a standalone app
|
## ⬜ AllTalk TTS Generator
|
||||||
AllTalk will run as a standalone app, as long as you install its requirements files into whatever Python environment you are using. You can follow the steps to install the AllTalk's requirements into whatever Python environment you wish. Because I dont know what Python environment you are wanting to use, I can only give you a loose set of installation instructions.
|
AllTalk TTS Generator is the solution for converting large volumes of text into speech using the voice of your choice. Whether you're creating audio content or just want to hear text read aloud, the TTS Generator is equipped to handle it all efficiently. Please see here for a quick [demo](https://www.youtube.com/watch?v=hunvXn0mLzc)<br><br>The link to open the TTS generator can be found on the built-in Settings and Documentation page.<br><br>**DeepSpeed** is **highly** recommended to speed up generation. **Low VRAM** would be best turned off and your LLM model unloaded from your GPU VRAM (unload your model). **No Playback** will reduce memory overhead on very large generations (15,000 words or more). Splitting **Export to Wav** into smaller groups will also reduce memory overhead at the point of exporting your wav files (so good for low memory systems).
|
||||||
|
|
||||||
Please note, at time of writing, the TTS engine requires Python **3.9.x** to **3.11.x** [TTS Engine details here](https://pypi.org/project/TTS/). AllTalk and its requirements are tested on Python 3.11.x.
|
#### ⬜ Estimated Throughput
|
||||||
|
This will vary by system for a multitude of reasons, however, while generating a 58,000 word document to TTS, with DeepSpeed enabled, LowVram disabled, splitting size 2 and on an Nvidia RTX 4070, throughput was around 1,000 words per minute. Meaning, this took 1 hour to generate the TTS. Exporting to combined wavs took about 2-3 minutes total.
|
||||||
|
|
||||||
#### 🟦 (Option 1) I already have AllTalk installed as an extension of Text-generation-webui
|
#### ⬜ Quick Start
|
||||||
If you already have AllTalk as a extension of Text-generation-webui, and wish to run it as standalone, load Text-generation-webui's Python environment `cmd_windows.bat`, `./cmd_linux.sh`, `cmd_macos.sh` or `cmd_wsl.bat`, move into the AllTalk folder `cd extensions` > `cd alltalk_tts` and start AllTalk with `python script.py`. There is nothing beyond this you would need to do.
|
- **Text Input:** Enter the text you wish to convert into speech in the 'Text Input' box.
|
||||||
|
- **Generate TTS:** Hit this to start the text-to-speech conversion.
|
||||||
#### 🟦 (Option 2) I wish to do a custom install of AllTalk
|
- **Pause/Resume:** Used to pause and resume the playback of the initial generation of wavs or the stream.
|
||||||
1) In your chosen disk location git clone this repository:<br><br>
|
- **Stop Playback:** This will stop the current audio playing back. It does not stop the text from being generated however.
|
||||||
`git clone https://github.com/erew123/alltalk_tts`
|
Once you have sent text off to be generated, either as a stream or wav file generation, the TTS server will remain busy until this process has competed. As such, think carefully as to how much you want to send to the server.
|
||||||
|
If you are generating wav files and populating the queue, you can generate one lot of text to speech, then input your next lot of text and it will continue adding to the list.
|
||||||
2) Move into the **alltalk_tts** folder:<br><br>
|
#### ⬜ TTS Generation Modes
|
||||||
`cd alltalk_tts`
|
- **Wav Chunks:** Perfect for creating audio books, or anything you want to keep long term. Breaks down your text into manageable wav files and queues them up. Generation begins automatically, and playback will start after a few chunks have been prepared ahead. You can set the volume to 0 if you don’t want to hear playback. With Wav chunks, you can edit and/or regenerate portions of the TTS as needed.
|
||||||
|
- **Streaming:** For immediate playback without the ability to save. Ideal for on-the-fly speech generation and listening. This will not generate wav files and it will play back through your browser. You cannot stop the server generating the TTS once it has been sent.<br><br>
|
||||||
3) If you have a custom Python environment, now is the time to load it!
|
With wav chunks you can either playback “In Browser” which is the web page you are on, or “On Server” which is through the console/terminal where AllTalk is running from, or "No Playback". Only generation “In Browser” can play back smoothly and populate the Generated TTS List. Setting the Volume will affect the volume level played back both “In Browser” and “On Server”.<br><br>
|
||||||
|
For generating **large amounts of TTS**, it's recommended to select the **No Playback** option. This setting minimizes the memory usage in your web browser by avoiding the loading and playing of audio files directly within the browser, which is particularly beneficial for handling extensive audio generations. The definition of large will vary depending on your system RAM availability (will update when I have more information as to guidelines). Once the audio is generated, you can export your list to JSON (for safety) and use the **Play List** option to play back your audio.
|
||||||
4) Install one of the two requirements files. Whichever one of the two is correct for your machine type:<br><br>
|
#### ⬜ Playback and List Management
|
||||||
**Nvidia graphics card machines** - `pip install -r requirements_nvidia.txt`<br><br>
|
- **Playback Controls:** Utilize 'Play List' to start from the beginning or 'Stop Playback' to halt at any time.
|
||||||
**Other machines (mac, amd etc)** - `pip install -r requirements_other.txt`
|
- **Custom Start:** Jump into your list at a specific ID to hear a particular section.
|
||||||
|
- **Regeneration and Editing:** If a chunk isn't quite right, you can opt to regenerate it or edit the text directly. Click off the text to save changes and hit regenerate for the specific line.
|
||||||
5) Start AllTalk with `python script.py`
|
- **Export/Import List:** Save your TTS list as a JSON file or import one. Note: Existing wav files are needed for playback. Exporting is handy if you want to take your files away into another program and have a list of which wav is which, or if you keep your audio files, but want to come back at a later date, edit one or two lines, regenerate the speech and re-combine the wav’s into one new long wav.
|
||||||
|
#### ⬜ Exporting Your Audio
|
||||||
Deepspeed and other such things can be installed. Please read the relevant instructions for those items, however, make the relevant changes to load your correct Python environment when installing any requirements files and starting AllTalk.
|
- **Export to WAV:** Combine all generated TTS from the list, into one single WAV file for easy download and distribution. Its always recommended to export your list to a JSON before exporting, so that you have a backup, should something go wrong. You can simply re-import the list and try exporting again.<br><br>When exporting, there is a file size limit of 1GB and as such you have the option to choose how many files to include in each block of audio exported. 600 is just on the limit of 1GB, depending on the average file size, so 500 or less is a good amount to work with. You can combine the generated files after if you wish, in Audacity or similar.<br><br>Additionally, lower export batches will lower the memory requirements, so if your system is low on memory (maybe 8 or 16GB system), you can use smaller export batches to keep the memory requirement down.
|
||||||
|
#### ⬜ Customization and Preferences
|
||||||
|
- **Character Voice:** Choose the voice that will read your text.
|
||||||
|
- **Language:** Select the language of your text.
|
||||||
|
- **Chunk Sizes:** Decide the size of text chunks for generation. Smaller sizes are recommended for better TTS quality.
|
||||||
|
#### ⬜ Interface and Accessibility
|
||||||
|
- **Dark/Light Mode:** Switch between themes for your visual comfort.
|
||||||
|
- **Word Count and Generation Queue:** Keep track of the word count and the generation progress.
|
||||||
|
#### ⬜ Notes on Usage
|
||||||
|
- For seamless TTS generation, it's advised to keep text chunks under 250 characters, which you can control with the Chunk sizes.
|
||||||
|
- Generated audio can be played back from the list, which also highlights the currently playing chunk.
|
||||||
|
- The TTS Generator remembers your settings, so you can pick up where you left off even after refreshing the page.
|
||||||
|
|
||||||
## 🟠 API Suite and JSON-CURL
|
## 🟠 API Suite and JSON-CURL
|
||||||
### 🟠Overview
|
### 🟠Overview
|
||||||
@@ -549,6 +704,22 @@ Retrieve a list of available voices for generating speech.
|
|||||||
|
|
||||||
JSON return: `{"voices": ["voice1.wav", "voice2.wav", "voice3.wav"]}`
|
JSON return: `{"voices": ["voice1.wav", "voice2.wav", "voice3.wav"]}`
|
||||||
|
|
||||||
|
#### 🟠 Current Settings Endpoint<br>
|
||||||
|
Retrieve a list of available voices for generating speech.
|
||||||
|
|
||||||
|
- URL: `http://127.0.0.1:7851/api/currentsettings`<br> - Method: `GET`<br>
|
||||||
|
|
||||||
|
`curl -X GET "http://127.0.0.1:7851/api/currentsettings"`
|
||||||
|
|
||||||
|
JSON return: ```{"models_available":[{"name":"Coqui","model_name":"API TTS"},{"name":"Coqui","model_name":"API Local"},{"name":"Coqui","model_name":"XTTSv2 Local"}],"current_model_loaded":"XTTSv2 Local","deepspeed_available":true,"deepspeed_status":true,"low_vram_status":true,"finetuned_model":false}```
|
||||||
|
|
||||||
|
`name & model_name` = listing the currently available models.<br>
|
||||||
|
`current_model_loaded` = what model is currently loaded into VRAM.<br>
|
||||||
|
`deepspeed_available` = was DeepSpeed detected on startup and available to be activated.<br>
|
||||||
|
`deepspeed_status` = If DeepSpeed was detected, is it currently activated.<br>
|
||||||
|
`low_vram_status` = Is Low VRAM currently enabled.<br>
|
||||||
|
`finetuned_model` = Was a finetuned model detected. (XTTSv2 FT).<br>
|
||||||
|
|
||||||
#### 🟠 Preview Voice Endpoint
|
#### 🟠 Preview Voice Endpoint
|
||||||
Generate a preview of a specified voice with hardcoded settings.
|
Generate a preview of a specified voice with hardcoded settings.
|
||||||
|
|
||||||
@@ -593,12 +764,12 @@ Generate a preview of a specified voice with hardcoded settings.
|
|||||||
|
|
||||||
JSON return `{"status": "lowvram-success"}`
|
JSON return `{"status": "lowvram-success"}`
|
||||||
|
|
||||||
### 🟠 TTS Generation Endpoint
|
### 🟠 TTS Generation Endpoint (Standard Generation)
|
||||||
|
|
||||||
- URL: `http://127.0.0.1:7851/api/tts-generate`<br> - Method: `POST`<br> - Content-Type: `application/x-www-form-urlencoded`<br>
|
- URL: `http://127.0.0.1:7851/api/tts-generate`<br> - Method: `POST`<br> - Content-Type: `application/x-www-form-urlencoded`<br>
|
||||||
|
|
||||||
### 🟠 Example command lines
|
### 🟠 Example command lines (Standard Generation)
|
||||||
Standard TTS speech Example (standard text) generating a time-stamped file<br>
|
Standard TTS generation supports Narration and will generate a wav file/blob. Standard TTS speech Example (standard text) generating a time-stamped file<br>
|
||||||
|
|
||||||
`curl -X POST "http://127.0.0.1:7851/api/tts-generate" -d "text_input=All of this is text spoken by the character. This is text not inside quotes, though that doesnt matter in the slightest" -d "text_filtering=standard" -d "character_voice_gen=female_01.wav" -d "narrator_enabled=false" -d "narrator_voice_gen=male_01.wav" -d "text_not_inside=character" -d "language=en" -d "output_file_name=myoutputfile" -d "output_file_timestamp=true" -d "autoplay=true" -d "autoplay_volume=0.8"`<br>
|
`curl -X POST "http://127.0.0.1:7851/api/tts-generate" -d "text_input=All of this is text spoken by the character. This is text not inside quotes, though that doesnt matter in the slightest" -d "text_filtering=standard" -d "character_voice_gen=female_01.wav" -d "narrator_enabled=false" -d "narrator_voice_gen=male_01.wav" -d "text_not_inside=character" -d "language=en" -d "output_file_name=myoutputfile" -d "output_file_timestamp=true" -d "autoplay=true" -d "autoplay_volume=0.8"`<br>
|
||||||
|
|
||||||
@@ -701,8 +872,32 @@ Example JSON TTS Generation Response:
|
|||||||
|
|
||||||
`{"status":"generate-success","output_file_path":"C:\\text-generation-webui\\extensions\\alltalk_tts\\outputs\\myoutputfile_1704141936.wav","output_file_url":"http://127.0.0.1:7851/audio/myoutputfile_1704141936.wav","output_cache_url":"http://127.0.0.1:7851/audiocache/myoutputfile_1704141936.wav"}`
|
`{"status":"generate-success","output_file_path":"C:\\text-generation-webui\\extensions\\alltalk_tts\\outputs\\myoutputfile_1704141936.wav","output_file_url":"http://127.0.0.1:7851/audio/myoutputfile_1704141936.wav","output_cache_url":"http://127.0.0.1:7851/audiocache/myoutputfile_1704141936.wav"}`
|
||||||
|
|
||||||
|
### 🟠 Example command lines (Streaming Generation)
|
||||||
|
Streaming TTS generation does NOT support Narration and will generate an audio stream. Streaming TTS speech JavaScript Example:<br>
|
||||||
|
|
||||||
|
- URL: `http://localhost:7851/api/tts-generate-streaming`<br> - Method: `POST`<br> - Content-Type: `application/x-www-form-urlencoded`<br><br>
|
||||||
|
|
||||||
|
```
|
||||||
|
// Example parameters
|
||||||
|
const text = "Here is some text";
|
||||||
|
const voice = "female_01.wav";
|
||||||
|
const language = "en";
|
||||||
|
const outputFile = "stream_output.wav";
|
||||||
|
// Encode the text for URL
|
||||||
|
const encodedText = encodeURIComponent(text);
|
||||||
|
// Create the streaming URL
|
||||||
|
const streamingUrl = `http://localhost:7851/api/tts-generate-streaming?text=${encodedText}&voice=${voice}&language=${language}&output_file=${outputFile}`;
|
||||||
|
// Create and play the audio element
|
||||||
|
const audioElement = new Audio(streamingUrl);
|
||||||
|
audioElement.play(); // Play the audio stream directly
|
||||||
|
```
|
||||||
|
- **Text (text):** This is the actual text you want to convert to speech. It should be a string and must be URL-encoded to ensure that special characters (like spaces and punctuation) are correctly transmitted in the URL. Example: `Hello World` becomes `Hello%20World` when URL-encoded.<br>
|
||||||
|
- **Voice (voice):** This parameter specifies the voice type to be used for the TTS. The value should match one of the available voice options in AllTalks voices folder. This is a string representing the file, like `female_01.wav`.<br>
|
||||||
|
- **Language (language):** This setting determines the language in which the text should be spoken. A two-letter language code (like `en` for English, `fr` for French, etc.).<br>
|
||||||
|
- **Output File (output_file):** This parameter names the output file where the audio will be streamed. It should be a string representing the file name, such as `stream_output.wav`. AllTalk will not save this as a file in its outputs folder.<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
### 🔴 Future to-do list
|
### 🔴 Future to-do list
|
||||||
- Voice output within the command prompt/terminal (TBD).
|
|
||||||
- Correct a few spelling mistakes in the documentation.
|
|
||||||
- Possibly add some additional TTS engines (TBD).
|
- Possibly add some additional TTS engines (TBD).
|
||||||
|
- Tagging support within text.
|
||||||
- Have a break!
|
- Have a break!
|
||||||
@@ -0,0 +1,503 @@
|
|||||||
|
@echo off
|
||||||
|
cd /D "%~dp0"
|
||||||
|
|
||||||
|
set PATH=%PATH%;%SystemRoot%\system32
|
||||||
|
|
||||||
|
:: Generate the ESC character
|
||||||
|
for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
|
||||||
|
|
||||||
|
:: Standard Colors
|
||||||
|
set "BLACK=%ESC%[30m"
|
||||||
|
set "RED=%ESC%[31m"
|
||||||
|
set "GREEN=%ESC%[32m"
|
||||||
|
set "YELLOW=%ESC%[33m"
|
||||||
|
set "BLUE=%ESC%[34m"
|
||||||
|
set "MAGENTA=%ESC%[35m"
|
||||||
|
set "CYAN=%ESC%[36m"
|
||||||
|
set "WHITE=%ESC%[37m"
|
||||||
|
set "L_BLACK=%ESC%[90m"
|
||||||
|
set "L_RED=%ESC%[91m"
|
||||||
|
set "L_GREEN=%ESC%[92m"
|
||||||
|
set "L_YELLOW=%ESC%[93m"
|
||||||
|
set "L_BLUE=%ESC%[94m"
|
||||||
|
set "L_MAGENTA=%ESC%[95m"
|
||||||
|
set "L_CYAN=%ESC%[96m"
|
||||||
|
set "L_WHITE=%ESC%[97m"
|
||||||
|
set "RESET=%ESC%[0m"
|
||||||
|
|
||||||
|
@rem Check if curl is available
|
||||||
|
curl --version >nul 2>&1
|
||||||
|
if "%ERRORLEVEL%" NEQ "0" (
|
||||||
|
echo curl is not available on this system. Please install curl then re-run the script https://curl.se/
|
||||||
|
echo or perform a manual installation of a Conda Python environment.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
:MainMenu
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo %L_BLUE%ALLTALK WINDOWS SETUP UTILITY%RESET%
|
||||||
|
echo.
|
||||||
|
echo INSTALLATION TYPE
|
||||||
|
echo 1) I am using AllTalk as part of %L_GREEN%Text-generation-webui%RESET%
|
||||||
|
echo 2) I am using AllTalk as a %L_GREEN%Standalone Application%RESET%
|
||||||
|
echo.
|
||||||
|
echo 9) %L_RED%Exit/Quit%RESET%
|
||||||
|
echo.
|
||||||
|
set /p UserOption=" Enter your choice: "
|
||||||
|
|
||||||
|
if "%UserOption%"=="1" goto WebUIMenu
|
||||||
|
if "%UserOption%"=="2" goto StandaloneMenu
|
||||||
|
if "%UserOption%"=="9" goto End
|
||||||
|
goto MainMenu
|
||||||
|
|
||||||
|
:WebUIMenu
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo %L_BLUE%TEXT-GENERATION-WEBUI SETUP%RESET%
|
||||||
|
echo.
|
||||||
|
echo Please ensure you have started your Text-generation-webui Python
|
||||||
|
echo environment. If you have NOT done this, please run %L_GREEN%cmd_windows.bat%RESET%
|
||||||
|
echo in the %L_GREEN%text-generation-webui%RESET% folder and then re-run this script.
|
||||||
|
echo.
|
||||||
|
echo BASE REQUIREMENTS
|
||||||
|
echo 1) Install the requirements for a %L_GREEN%Nvidia machine%RESET%.
|
||||||
|
echo 2) Install the requirements for a %L_GREEN%AMD or MAC machine%RESET%.
|
||||||
|
echo.
|
||||||
|
echo OPTIONAL
|
||||||
|
echo 3) Install the Finetuning requirements.
|
||||||
|
echo 4) Install DeepSpeed v11.2 for CUDA %L_GREEN%11.8%RESET% and Python-3.11.x.
|
||||||
|
echo 5) Install DeepSpeed v11.2 for CUDA %L_GREEN%12.1%RESET% and Python-3.11.x.
|
||||||
|
echo 6) Uninstall DeepSpeed.
|
||||||
|
echo.
|
||||||
|
echo. OTHER
|
||||||
|
echo 7) Generate a diagnostics file.
|
||||||
|
echo.
|
||||||
|
echo 9) %L_RED%Exit/Quit%RESET%
|
||||||
|
echo.
|
||||||
|
set /p WebUIOption="Enter your choice: "
|
||||||
|
if "%WebUIOption%"=="1" goto InstallNvidiaTextGen
|
||||||
|
if "%WebUIOption%"=="2" goto InstallOtherTextGen
|
||||||
|
if "%WebUIOption%"=="3" goto InstallFinetuneTextGen
|
||||||
|
if "%WebUIOption%"=="4" goto InstallDeepSpeed118TextGen
|
||||||
|
if "%WebUIOption%"=="5" goto InstallDeepSpeed121TextGen
|
||||||
|
if "%WebUIOption%"=="6" goto UnInstallDeepSpeed
|
||||||
|
if "%WebUIOption%"=="7" goto GenerateDiagsTextGen
|
||||||
|
if "%WebUIOption%"=="9" goto End
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:StandaloneMenu
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo %L_BLUE%ALLTALK STANDALONE APPLICATION SETUP%RESET%
|
||||||
|
echo.
|
||||||
|
echo BASE REQUIREMENTS
|
||||||
|
echo 1) Install AllTalk as a Standalone Application
|
||||||
|
echo.
|
||||||
|
echo OPTIONAL
|
||||||
|
echo 2) Delete AllTalk's custom Python environment
|
||||||
|
echo 3) Install the Finetuning requirements
|
||||||
|
echo.
|
||||||
|
echo. OTHER
|
||||||
|
echo 4) Generate a diagnostics file
|
||||||
|
echo.
|
||||||
|
echo 9) %L_RED%Exit/Quit%RESET%
|
||||||
|
echo.
|
||||||
|
set /p StandaloneOption="Enter your choice: "
|
||||||
|
if "%StandaloneOption%"=="1" goto InstallCustomStandalone
|
||||||
|
if "%StandaloneOption%"=="2" goto DeleteCustomStandalone
|
||||||
|
if "%StandaloneOption%"=="3" goto InstallFinetuneStandalone
|
||||||
|
if "%StandaloneOption%"=="4" goto GenerateDiagsStandalone
|
||||||
|
if "%StandaloneOption%"=="9" goto End
|
||||||
|
goto StandaloneMenu
|
||||||
|
|
||||||
|
:InstallNvidiaTextGen
|
||||||
|
pip install -r requirements_nvidia.txt
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo There was an error installing the Nvidia requirements.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
echo.
|
||||||
|
Echo Nvidia machine requirements installed successfully.
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:InstallOtherTextGen
|
||||||
|
pip install -r requirements_other.txt
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo There was an error installing the Other requirements.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
echo.
|
||||||
|
Echo Other machine requirements installed successfully.
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:InstallFinetuneTextGen
|
||||||
|
pip install -r requirements_finetune.txt
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo There was an error installing the Finetune requirements.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
Echo Finetune requirements installed successfully. Please ensure you have installed CUDA 11.8.
|
||||||
|
Echo Finetune needs access to %L_GREEN%cublas64_11.dll%RESET% and will error if this is not setup correctly.
|
||||||
|
Echo Please see here for details %L_GREEN%https://github.com/erew123/alltalk_tts#-finetuning-a-model%RESET%
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:InstallDeepSpeed118TextGen
|
||||||
|
echo Downloading DeepSpeed...
|
||||||
|
curl -LO https://github.com/erew123/alltalk_tts/releases/download/deepspeed/deepspeed-0.11.2+cuda118-cp311-cp311-win_amd64.whl
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo Failed to download DeepSpeed wheel file.
|
||||||
|
echo Please check your internet connection or try again later.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
echo DeepSpeed wheel file downloaded successfully.
|
||||||
|
echo Installing DeepSpeed...
|
||||||
|
pip install deepspeed-0.11.2+cuda118-cp311-cp311-win_amd64.whl
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo Failed to install DeepSpeed.
|
||||||
|
echo Please check if the wheel file is compatible with your system.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
echo.
|
||||||
|
Echo DeepSpeed installed successfully.
|
||||||
|
Echo.
|
||||||
|
del deepspeed-0.11.2+cuda118-cp311-cp311-win_amd64.whl
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:InstallDeepSpeed121TextGen
|
||||||
|
echo Downloading DeepSpeed...
|
||||||
|
curl -LO https://github.com/erew123/alltalk_tts/releases/download/deepspeed/deepspeed-0.11.2+cuda121-cp311-cp311-win_amd64.whl
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo Failed to download DeepSpeed wheel file.
|
||||||
|
echo Please check your internet connection or try again later.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
echo DeepSpeed wheel file downloaded successfully.
|
||||||
|
echo Installing DeepSpeed...
|
||||||
|
pip install deepspeed-0.11.2+cuda121-cp311-cp311-win_amd64.whl
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo Failed to install DeepSpeed.
|
||||||
|
echo Please check if the wheel file is compatible with your system.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
echo.
|
||||||
|
Echo DeepSpeed installed successfully.
|
||||||
|
Echo.
|
||||||
|
del deepspeed-0.11.2+cuda121-cp311-cp311-win_amd64.whl
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:UnInstallDeepSpeed
|
||||||
|
pip uninstall deepspeed
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo There was an error uninstalling DeepSpeed.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
Echo DeepSpeed uninstalled successfully.
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:GenerateDiagsTextGen
|
||||||
|
Python diagnostics.py
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo There was an error running diagnostics. Have you correctly started your
|
||||||
|
echo Text-generation-webui Python environment with %L_GREEN%cmd_windows.bat%RESET%?
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
echo.
|
||||||
|
Echo Diagnostics.log generated. Please scroll up to look over the log.
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto WebUIMenu
|
||||||
|
|
||||||
|
:InstallCustomStandalone
|
||||||
|
set PATH=%PATH%;%SystemRoot%\system32
|
||||||
|
|
||||||
|
@rem Check if curl is available
|
||||||
|
curl --version >nul 2>&1
|
||||||
|
if "%ERRORLEVEL%" NEQ "0" (
|
||||||
|
echo curl is not available on this system. Please install curl then re-run the script https://curl.se/
|
||||||
|
echo or perform a manual installation of a Conda Python environment.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. Please correct your folder names and re-try installation. && goto exit
|
||||||
|
|
||||||
|
@rem Check for special characters in installation path
|
||||||
|
set "SPCHARMESSAGE=WARNING: Special characters were detected in the installation path! This can cause the installation to fail!"
|
||||||
|
echo "%CD%"| findstr /R /C:"[!#\$%&()\*+,;<=>?@\[\]\^`{|}~]" >nul && (
|
||||||
|
call :PrintBigMessage %SPCHARMESSAGE%
|
||||||
|
)
|
||||||
|
set SPCHARMESSAGE=
|
||||||
|
|
||||||
|
@rem fix failed install when installing to a separate drive
|
||||||
|
set TMP=%cd%\alltalk_environment
|
||||||
|
set TEMP=%cd%\alltalk_environment
|
||||||
|
|
||||||
|
@rem deactivate existing conda envs as needed to avoid conflicts
|
||||||
|
(call conda deactivate && call conda deactivate && call conda deactivate) 2>nul
|
||||||
|
|
||||||
|
@rem config
|
||||||
|
set INSTALL_DIR=%cd%\alltalk_environment
|
||||||
|
set CONDA_ROOT_PREFIX=%cd%\alltalk_environment\conda
|
||||||
|
set INSTALL_ENV_DIR=%cd%\alltalk_environment\env
|
||||||
|
set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Windows-x86_64.exe
|
||||||
|
set conda_exists=F
|
||||||
|
|
||||||
|
@rem figure out whether git and conda need to be installed
|
||||||
|
call "%CONDA_ROOT_PREFIX%\_conda.exe" --version >nul 2>&1
|
||||||
|
if "%ERRORLEVEL%" EQU "0" (
|
||||||
|
set conda_exists=T
|
||||||
|
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%"
|
||||||
|
goto RunScript
|
||||||
|
)
|
||||||
|
|
||||||
|
@rem download and install conda if not installed
|
||||||
|
echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL% to %INSTALL_DIR%\miniconda_installer.exe
|
||||||
|
mkdir "%INSTALL_DIR%"
|
||||||
|
call curl -Lk "%MINICONDA_DOWNLOAD_URL%" > "%INSTALL_DIR%\miniconda_installer.exe" || ( echo. && echo Miniconda failed to download. && goto end )
|
||||||
|
echo Installing Miniconda to %CONDA_ROOT_PREFIX%
|
||||||
|
start /wait "" "%INSTALL_DIR%\miniconda_installer.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%CONDA_ROOT_PREFIX%
|
||||||
|
echo Miniconda version:
|
||||||
|
call "%CONDA_ROOT_PREFIX%\_conda.exe" --version || ( echo. && echo Miniconda not found. && goto end )
|
||||||
|
|
||||||
|
@rem create the installer env
|
||||||
|
echo Packages to install: %PACKAGES_TO_INSTALL%
|
||||||
|
call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.11 || ( echo. && echo Conda environment creation failed. && goto end )
|
||||||
|
|
||||||
|
@rem check if conda environment was actually created
|
||||||
|
if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end )
|
||||||
|
|
||||||
|
@rem activate installer env
|
||||||
|
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end )
|
||||||
|
|
||||||
|
@rem Ask user for the type of requirements to install
|
||||||
|
echo.
|
||||||
|
echo %L_BLUE%Choose the type of requirements to install%RESET%
|
||||||
|
echo.
|
||||||
|
echo 1. Nvidia graphics card machines
|
||||||
|
echo 2. Other machines (mac, amd, etc)
|
||||||
|
echo.
|
||||||
|
set /p UserChoice="Enter your choice (1 or 2): "
|
||||||
|
|
||||||
|
@rem Install requirements based on user choice
|
||||||
|
if "%UserChoice%" == "1" (
|
||||||
|
echo.
|
||||||
|
echo Installing Nvidia requirements...
|
||||||
|
echo Downloading Pytorch with CUDA..
|
||||||
|
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --upgrade --force-reinstall --index-url https://download.pytorch.org/whl/cu121
|
||||||
|
pip install numpy==1.24.4
|
||||||
|
pip install typing-extensions>=4.8.0
|
||||||
|
pip install networkx<3.0.0,>=2.5.0
|
||||||
|
pip install fsspec>=2023.6.0
|
||||||
|
pip install soundfile==0.12.1
|
||||||
|
pip install uvicorn==0.24.0.post1
|
||||||
|
pip install TTS==0.21.3
|
||||||
|
pip install fastapi==0.104.1
|
||||||
|
pip install Jinja2==3.1.2
|
||||||
|
pip install requests==2.31.0
|
||||||
|
pip install tqdm==4.66.1
|
||||||
|
pip install importlib-metadata==4.8.1
|
||||||
|
pip install packaging==23.2
|
||||||
|
pip install pydantic==1.10.13
|
||||||
|
pip install sounddevice==0.4.6
|
||||||
|
pip install python-multipart==0.0.6
|
||||||
|
echo Downloading DeepSpeed...
|
||||||
|
curl -LO https://github.com/erew123/alltalk_tts/releases/download/DeepSpeed-12.7/deepspeed-0.12.7+d058d4b-cp311-cp311-win_amd64.whl
|
||||||
|
echo Installing DeepSpeed...
|
||||||
|
pip install deepspeed-0.12.7+d058d4b-cp311-cp311-win_amd64.whl
|
||||||
|
del deepspeed-0.12.7+d058d4b-cp311-cp311-win_amd64.whl
|
||||||
|
) else (
|
||||||
|
echo Installing requirements for other machines...
|
||||||
|
pip install -r requirements_other.txt
|
||||||
|
)
|
||||||
|
|
||||||
|
@rem Create start_environment.bat to run AllTalk environment
|
||||||
|
echo @echo off > start_environment.bat
|
||||||
|
echo cd /D "%~dp0" >> start_environment.bat
|
||||||
|
echo set CONDA_ROOT_PREFIX=%cd%\alltalk_environment\conda >> start_environment.bat
|
||||||
|
echo set INSTALL_ENV_DIR=%cd%\alltalk_environment\env >> start_environment.bat
|
||||||
|
echo call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" >> start_environment.bat
|
||||||
|
echo exit >> start_environment.bat
|
||||||
|
@rem Create start_alltalk.bat to run AllTalk
|
||||||
|
echo @echo off > start_alltalk.bat
|
||||||
|
echo cd /D "%~dp0" >> start_alltalk.bat
|
||||||
|
echo set CONDA_ROOT_PREFIX=%cd%\alltalk_environment\conda >> start_alltalk.bat
|
||||||
|
echo set INSTALL_ENV_DIR=%cd%\alltalk_environment\env >> start_alltalk.bat
|
||||||
|
echo call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" >> start_alltalk.bat
|
||||||
|
echo call python script.py >> start_alltalk.bat
|
||||||
|
echo exit >> start_alltalk.bat
|
||||||
|
Echo.
|
||||||
|
Echo start_alltalk.bat has been created.
|
||||||
|
Echo You can now start AllTalk with %L_YELLOW%start_alltalk.bat%RESET%
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
|
||||||
|
:DeleteCustomStandalone
|
||||||
|
@rem Check if the alltalk_environment directory exists
|
||||||
|
if not exist "%cd%\alltalk_environment\" (
|
||||||
|
echo.
|
||||||
|
echo %L_GREEN%alltalk_environment%RESET% directory does not exist. No need to delete.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
@rem Check if a Conda environment is active
|
||||||
|
if not defined CONDA_PREFIX goto NoCondaEnvDeleteCustomStandalone
|
||||||
|
@rem Deactivate Conda environment if it's active
|
||||||
|
Echo Exiting the Conda Environment. Please run %L_GREEN%atsetup.bat%RESET% again and delete the environment.
|
||||||
|
conda deactivate
|
||||||
|
:NoCondaEnvDeleteCustomStandalone
|
||||||
|
echo Deleting "alltalk_environment". Please wait.
|
||||||
|
rd /s /q "alltalk_environment"
|
||||||
|
del start_alltalk.bat
|
||||||
|
del start_environment.bat
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo Failed to delete alltalk_environment folder.
|
||||||
|
echo Please make sure it is not in use and try again.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
Echo.
|
||||||
|
echo Environment %L_GREEN%alltalk_environment%RESET% deleted. Please set up the environment again.
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
|
||||||
|
:InstallFinetuneStandalone
|
||||||
|
cd /D "%~dp0"
|
||||||
|
set CONDA_ROOT_PREFIX=%cd%\alltalk_environment\conda
|
||||||
|
set INSTALL_ENV_DIR=%cd%\alltalk_environment\env
|
||||||
|
@rem Check if the Conda environment exists
|
||||||
|
if not exist "%INSTALL_ENV_DIR%\python.exe" (
|
||||||
|
echo.
|
||||||
|
echo The Conda environment at "%INSTALL_ENV_DIR%" does not exist.
|
||||||
|
echo Please install the environment before proceeding.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
@rem Attempt to activate the Conda environment
|
||||||
|
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo Failed to activate the Conda environment.
|
||||||
|
echo Please check your installation and try again.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
@rem Proceed with installing requirements
|
||||||
|
pip install -r requirements_finetune.txt
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo There was an error installing the Finetune requirements.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
Echo Finetune requirements installed successfully. Please ensure you have installed CUDA 11.8.
|
||||||
|
Echo Finetune needs access to %L_GREEN%cublas64_11.dll%RESET% and will error if this is not setup correctly.
|
||||||
|
Echo Please see here for details %L_GREEN%https://github.com/erew123/alltalk_tts#-finetuning-a-model%RESET%
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
|
||||||
|
:GenerateDiagsStandalone
|
||||||
|
cd /D "%~dp0"
|
||||||
|
set CONDA_ROOT_PREFIX=%cd%\alltalk_environment\conda
|
||||||
|
set INSTALL_ENV_DIR=%cd%\alltalk_environment\env
|
||||||
|
@rem Check if the Conda environment exists
|
||||||
|
if not exist "%INSTALL_ENV_DIR%\python.exe" (
|
||||||
|
echo.
|
||||||
|
echo The Conda environment at "%INSTALL_ENV_DIR%" does not exist.
|
||||||
|
echo Please install the environment before proceeding.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
@rem Attempt to activate the Conda environment
|
||||||
|
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%"
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo Failed to activate the Conda environment.
|
||||||
|
echo Please check your installation and try again.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
@rem Run diagnostics
|
||||||
|
Python diagnostics.py
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo There was an error running diagnostics.
|
||||||
|
echo Press any key to return to the menu.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
)
|
||||||
|
Echo.
|
||||||
|
Echo.
|
||||||
|
Echo Diagnostics.log generated. Please scroll up to look over the log.
|
||||||
|
Echo.
|
||||||
|
pause
|
||||||
|
goto StandaloneMenu
|
||||||
|
|
||||||
|
:End
|
||||||
|
echo Exiting AllTalk Setup Utility...
|
||||||
|
exit /b
|
||||||
@@ -0,0 +1,440 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ANSI color codes
|
||||||
|
RED='\033[1;31m'
|
||||||
|
GREEN='\033[1;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[1;34m'
|
||||||
|
CYAN='\033[1;36m'
|
||||||
|
MAGENTA='\033[1;35m'
|
||||||
|
WHITE='\033[1;37m'
|
||||||
|
L_RED='\033[1;91m'
|
||||||
|
L_GREEN='\033[1;92m'
|
||||||
|
L_YELLOW='\033[1;93m'
|
||||||
|
L_BLUE='\033[1;94m'
|
||||||
|
L_CYAN='\033[1;96m'
|
||||||
|
L_MAGENTA='\033[1;95m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# Navigate to the script's directory
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
# Function to check if curl is installed
|
||||||
|
check_curl() {
|
||||||
|
if ! command -v curl &> /dev/null; then
|
||||||
|
echo "curl is not available on this system. Please install curl then re-run the script https://curl.se/"
|
||||||
|
echo "or perform a manual installation of a Conda Python environment."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main Menu
|
||||||
|
main_menu() {
|
||||||
|
while true; do
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo -e " ${L_BLUE}ALLTALK LINUX SETUP UTILITY${NC}"
|
||||||
|
echo
|
||||||
|
echo " INSTALLATION TYPE"
|
||||||
|
echo -e " 1) I am using AllTalk as part of ${L_GREEN}Text-generation-webui${NC}"
|
||||||
|
echo -e " 2) I am using AllTalk as a ${L_GREEN}Standalone Application${NC}"
|
||||||
|
echo
|
||||||
|
echo -e " 9)${L_RED} Exit/Quit${NC}"
|
||||||
|
echo
|
||||||
|
read -p " Enter your choice: " user_option
|
||||||
|
|
||||||
|
case $user_option in
|
||||||
|
1) webui_menu ;;
|
||||||
|
2) standalone_menu ;;
|
||||||
|
9) exit 0 ;;
|
||||||
|
*) echo "Invalid option"; sleep 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Text-generation-webui Menu
|
||||||
|
webui_menu() {
|
||||||
|
while true; do
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo -e " ${L_BLUE}TEXT-GENERATION-WEBUI SETUP${NC}"
|
||||||
|
echo
|
||||||
|
echo -e " Please ensure you have started your Text-generation-webui Python"
|
||||||
|
echo -e " environment. If you have NOT done this, please run ${L_GREEN}/cmd_linux.sh${NC}"
|
||||||
|
echo -e " in the ${L_GREEN}text-generation-webui${NC} folder and then re-run this script."
|
||||||
|
echo
|
||||||
|
echo " BASE REQUIREMENTS"
|
||||||
|
echo -e " 1) Install the AllTalk requirements for an ${L_GREEN}Nvidia GPU machine.${NC}"
|
||||||
|
echo -e " 2) Install the AllTalk requirements for an ${L_GREEN}AMD or MAC machine.${NC}"
|
||||||
|
echo
|
||||||
|
echo " OPTIONAL"
|
||||||
|
echo " 3) Install the Finetuning requirements."
|
||||||
|
echo " 4) Install DeepSpeed."
|
||||||
|
echo " 5) Uninstall DeepSpeed."
|
||||||
|
echo
|
||||||
|
echo " OTHER"
|
||||||
|
echo " 6) Generate a diagnostics file."
|
||||||
|
echo
|
||||||
|
echo -e " 9)${L_RED} Exit/Quit${NC}"
|
||||||
|
echo
|
||||||
|
read -p " Enter your choice: " webui_option
|
||||||
|
|
||||||
|
case $webui_option in
|
||||||
|
1) install_nvidia_textgen ;;
|
||||||
|
2) install_other_textgen ;;
|
||||||
|
3) install_finetune_textgen ;;
|
||||||
|
4) install_deepspeed ;;
|
||||||
|
5) uninstall_deepspeed ;;
|
||||||
|
6) generate_diagnostics_textgen ;;
|
||||||
|
9) exit 0 ;;
|
||||||
|
*) echo "Invalid option"; sleep 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
install_nvidia_textgen() {
|
||||||
|
local requirements_file="requirements_nvidia.txt"
|
||||||
|
echo " Installing Finetune requirements from $requirements_file..."
|
||||||
|
if ! pip install -r "$requirements_file"; then
|
||||||
|
echo " There was an error installing the Nvidia requirements."
|
||||||
|
echo " Please check the output for details."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo " Nvidia requirements installed successfully."
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
install_other_textgen() {
|
||||||
|
local requirements_file="requirements_other.txt"
|
||||||
|
echo " Installing Other machine requirements from $requirements_file..."
|
||||||
|
if ! pip install -r "$requirements_file"; then
|
||||||
|
echo " There was an error installing the Other requirements."
|
||||||
|
echo " Please check the output for details."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo " Other machine requirements installed successfully."
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
install_finetune_textgen() {
|
||||||
|
local requirements_file="requirements_finetune.txt"
|
||||||
|
echo " Installing Finetune requirements from $requirements_file..."
|
||||||
|
if ! pip install -r "$requirements_file"; then
|
||||||
|
echo " There was an error installing the Finetune requirements."
|
||||||
|
echo " Please check the output for details."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo " Finetune base requirements installed successfully."
|
||||||
|
echo
|
||||||
|
echo -e " Finetuning requires access to ${GREEN}Cublas${NC} from the ${GREEN}Nvidia CUDA Toolkit${NC}, so will need installing."
|
||||||
|
echo
|
||||||
|
echo -e " Instructions can be found here:"
|
||||||
|
echo -e " ${GREEN}https://github.com/erew123/alltalk_tts?#-finetuning-a-model${NC}"
|
||||||
|
echo
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install DeepSpeed
|
||||||
|
install_deepspeed() {
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo -e " ${L_BLUE}DEEPSPEED INSTALLATION REQUIREMENTS${NC}"
|
||||||
|
echo
|
||||||
|
echo -e " - NVIDIA CUDA Toolkit must be installed from your ${L_GREEN}Linux package manager${NC}"
|
||||||
|
echo -e " or ${L_GREEN}https://developer.nvidia.com/cuda-toolkit-archive${NC}"
|
||||||
|
echo -e " - The environment variable ${L_GREEN}CUDA_HOME${NC} must be set in your Python env"
|
||||||
|
echo -e " e.g. export CUDA_HOME=/usr/local/cuda."
|
||||||
|
echo -e " - ${L_GREEN}libaio-dev${NC} must be installed."
|
||||||
|
echo
|
||||||
|
echo -e " See the following link for full instructions:"
|
||||||
|
echo -e " ${L_GREEN}https://github.com/erew123/alltalk_tts?#-deepspeed-installation-options${NC}"
|
||||||
|
echo
|
||||||
|
echo -e " ${L_BLUE}Please ${L_RED}confirm${L_BLUE} that you have completed these steps before continuing"
|
||||||
|
echo -e " with the DeepSpeed installation, or the install ${L_RED}will fail.${NC}"
|
||||||
|
echo
|
||||||
|
read -p " Have you completed all the above steps? (y/n): " confirm
|
||||||
|
|
||||||
|
if [ "$confirm" != "y" ]; then
|
||||||
|
echo -e " ${RED}DeepSpeed installation cannot proceed without completing the prerequisites.${NC}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n ${GREEN}Proceeding with DeepSpeed installation...${NC}"
|
||||||
|
pip install deepspeed
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e " ${RED}There was an error installing DeepSpeed.${NC}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e " ${GREEN}DeepSpeed installed successfully.${NC}"
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstall_deepspeed() {
|
||||||
|
echo "Uninstalling DeepSpeed..."
|
||||||
|
pip uninstall -y deepspeed
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo " There was an error uninstalling DeepSpeed."
|
||||||
|
echo " Press any key to return to the menu."
|
||||||
|
read -n 1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo " DeepSpeed uninstalled successfully."
|
||||||
|
echo " Press any key to continue."
|
||||||
|
read -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_diagnostics_textgen() {
|
||||||
|
# Run diagnostics
|
||||||
|
if ! python diagnostics.py; then
|
||||||
|
echo " There was an error running diagnostics."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo " Diagnostics completed successfully."
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
# Standalone Menu
|
||||||
|
standalone_menu() {
|
||||||
|
while true; do
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo -e " ${L_BLUE}ALLTALK STANDALONE APPLICATION SETUP${NC}"
|
||||||
|
echo
|
||||||
|
echo " BASE REQUIREMENTS"
|
||||||
|
echo " 1) Install AllTalk as a Standalone Application"
|
||||||
|
echo
|
||||||
|
echo " OPTIONAL"
|
||||||
|
echo " 2) Delete AllTalk's custom Python environment"
|
||||||
|
echo " 3) Install the Finetuning requirements"
|
||||||
|
echo " 4) Install DeepSpeed."
|
||||||
|
echo
|
||||||
|
echo " OTHER"
|
||||||
|
echo " 5) Generate a diagnostics file"
|
||||||
|
echo
|
||||||
|
echo -e " 9)${L_RED} Exit/Quit${NC}"
|
||||||
|
echo
|
||||||
|
read -p " Enter your choice: " standalone_option
|
||||||
|
|
||||||
|
case $standalone_option in
|
||||||
|
1) install_custom_standalone ;;
|
||||||
|
2) delete_custom_standalone ;;
|
||||||
|
3) install_finetune_standalone ;;
|
||||||
|
4) install_deepspeed ;;
|
||||||
|
5) generate_diagnostics_standalone ;;
|
||||||
|
9) exit 0 ;;
|
||||||
|
*) echo "Invalid option"; sleep 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
install_custom_standalone() {
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
|
if [[ "$(pwd)" =~ " " ]]; then
|
||||||
|
echo "This script relies on Miniconda which can not be silently installed under a path with spaces."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Deactivate existing conda envs as needed to avoid conflicts
|
||||||
|
{ conda deactivate && conda deactivate && conda deactivate; } 2> /dev/null
|
||||||
|
|
||||||
|
OS_ARCH=$(uname -m)
|
||||||
|
case "${OS_ARCH}" in
|
||||||
|
x86_64*) OS_ARCH="x86_64" ;;
|
||||||
|
arm64* | aarch64*) OS_ARCH="aarch64" ;;
|
||||||
|
*) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Config
|
||||||
|
INSTALL_DIR="$(pwd)/alltalk_environment"
|
||||||
|
CONDA_ROOT_PREFIX="${INSTALL_DIR}/conda"
|
||||||
|
INSTALL_ENV_DIR="${INSTALL_DIR}/env"
|
||||||
|
MINICONDA_DOWNLOAD_URL="https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Linux-${OS_ARCH}.sh"
|
||||||
|
|
||||||
|
if [ ! -x "${CONDA_ROOT_PREFIX}/bin/conda" ]; then
|
||||||
|
echo "Downloading Miniconda from $MINICONDA_DOWNLOAD_URL to ${INSTALL_DIR}/miniconda_installer.sh"
|
||||||
|
mkdir -p "${INSTALL_DIR}"
|
||||||
|
curl -L "${MINICONDA_DOWNLOAD_URL}" -o "${INSTALL_DIR}/miniconda_installer.sh"
|
||||||
|
chmod +x "${INSTALL_DIR}/miniconda_installer.sh"
|
||||||
|
bash "${INSTALL_DIR}/miniconda_installer.sh" -b -p "${CONDA_ROOT_PREFIX}"
|
||||||
|
echo "Miniconda installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "${INSTALL_ENV_DIR}" ]; then
|
||||||
|
"${CONDA_ROOT_PREFIX}/bin/conda" create -y --prefix "${INSTALL_ENV_DIR}" python=3.11
|
||||||
|
echo "Conda environment created at ${INSTALL_ENV_DIR}."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate the environment and install requirements
|
||||||
|
source "${CONDA_ROOT_PREFIX}/etc/profile.d/conda.sh"
|
||||||
|
conda activate "${INSTALL_ENV_DIR}"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo -e " ${L_BLUE}Choose the type of requirements to install${NC}"
|
||||||
|
echo
|
||||||
|
echo " 1. Nvidia graphics card machines"
|
||||||
|
echo " 2. Other machines (mac, amd, etc)"
|
||||||
|
echo
|
||||||
|
read -p " Enter your choice (1 or 2): " user_choice
|
||||||
|
|
||||||
|
if [ "$user_choice" == "1" ]; then
|
||||||
|
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --upgrade --force-reinstall --index-url https://download.pytorch.org/whl/cu121
|
||||||
|
pip install numpy==1.24.4
|
||||||
|
pip install typing-extensions>=4.8.0
|
||||||
|
pip install networkx<3.0.0,>=2.5.0
|
||||||
|
pip install fsspec>=2023.6.0
|
||||||
|
pip install soundfile==0.12.1
|
||||||
|
pip install uvicorn==0.24.0.post1
|
||||||
|
pip install TTS==0.21.3
|
||||||
|
pip install fastapi==0.104.1
|
||||||
|
pip install Jinja2==3.1.2
|
||||||
|
pip install requests==2.31.0
|
||||||
|
pip install tqdm==4.66.1
|
||||||
|
pip install importlib-metadata==4.8.1
|
||||||
|
pip install packaging==23.2
|
||||||
|
pip install pydantic==1.10.13
|
||||||
|
pip install sounddevice==0.4.6
|
||||||
|
pip install python-multipart==0.0.6
|
||||||
|
else
|
||||||
|
pip install -r requirements_other.txt
|
||||||
|
fi
|
||||||
|
# Create start_environment.sh to run AllTalk
|
||||||
|
cat << EOF > start_environment.sh
|
||||||
|
#!/bin/bash
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
|
||||||
|
# deactivate existing conda envs as needed to avoid conflicts
|
||||||
|
{ conda deactivate && conda deactivate && conda deactivate; } 2> /dev/null
|
||||||
|
# config
|
||||||
|
CONDA_ROOT_PREFIX="$(pwd)/alltalk_environment/conda"
|
||||||
|
INSTALL_ENV_DIR="$(pwd)/alltalk_environment/env"
|
||||||
|
# environment isolation
|
||||||
|
export PYTHONNOUSERSITE=1
|
||||||
|
unset PYTHONPATH
|
||||||
|
unset PYTHONHOME
|
||||||
|
export CUDA_PATH="$INSTALL_ENV_DIR"
|
||||||
|
export CUDA_HOME="$CUDA_PATH"
|
||||||
|
# activate env
|
||||||
|
bash --init-file <(echo "source \"$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh\" && conda activate \"$INSTALL_ENV_DIR\"")
|
||||||
|
EOF
|
||||||
|
# Create start_alltalk.sh to run AllTalk
|
||||||
|
cat << EOF > start_alltalk.sh
|
||||||
|
#!/bin/bash
|
||||||
|
source "${CONDA_ROOT_PREFIX}/etc/profile.d/conda.sh"
|
||||||
|
conda activate "${INSTALL_ENV_DIR}"
|
||||||
|
python script.py
|
||||||
|
EOF
|
||||||
|
chmod +x start_alltalk.sh
|
||||||
|
chmod +x start_environment.sh
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo -e " start_alltalk.sh has been created."
|
||||||
|
echo -e " You can now start AllTalk with ${L_YELLOW}./start_alltalk.sh${NC}"
|
||||||
|
echo
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
delete_custom_standalone() {
|
||||||
|
local env_dir="$PWD/alltalk_environment"
|
||||||
|
# Check if the alltalk_environment directory exists
|
||||||
|
if [ ! -d "$env_dir" ]; then
|
||||||
|
echo " \"$env_dir\" directory does not exist. No need to delete."
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
# Check if a Conda environment is active and deactivate it
|
||||||
|
if [ -n "$CONDA_PREFIX" ]; then
|
||||||
|
echo " Exiting the Conda environment. You may need to start ./atstart.sh again"
|
||||||
|
conda deactivate
|
||||||
|
fi
|
||||||
|
echo "Deleting \"$env_dir\". Please wait."
|
||||||
|
rm -rf "$env_dir"
|
||||||
|
if [ -d "$env_dir" ]; then
|
||||||
|
echo " Failed to delete \"$env_dir\" folder."
|
||||||
|
echo " Please make sure it is not in use and try again."
|
||||||
|
else
|
||||||
|
echo " Environment \"$env_dir\" deleted successfully."
|
||||||
|
fi
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
install_finetune_standalone() {
|
||||||
|
local env_dir="$PWD/alltalk_environment"
|
||||||
|
local conda_root_prefix="${env_dir}/conda"
|
||||||
|
local install_env_dir="${env_dir}/env"
|
||||||
|
if [ ! -d "${install_env_dir}" ]; then
|
||||||
|
echo " The Conda environment at '${install_env_dir}' does not exist."
|
||||||
|
echo " Please install the environment before proceeding."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
source "${conda_root_prefix}/etc/profile.d/conda.sh"
|
||||||
|
conda activate "${install_env_dir}"
|
||||||
|
local requirements_file="requirements_finetune.txt"
|
||||||
|
echo "Installing Finetune requirements from $requirements_file..."
|
||||||
|
if ! pip install -r "$requirements_file"; then
|
||||||
|
echo " There was an error installing the Finetune requirements."
|
||||||
|
echo " Please check the output for details."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo " Finetune base requirements installed successfully."
|
||||||
|
echo
|
||||||
|
echo -e " Finetuning requires access to ${GREEN}Cublas${NC} from the ${GREEN}Nvidia CUDA Toolkit${NC}, so will need installing."
|
||||||
|
echo
|
||||||
|
echo -e " Instructions can be found here:"
|
||||||
|
echo -e " ${GREEN}https://github.com/erew123/alltalk_tts?#-finetuning-a-model${NC}"
|
||||||
|
echo
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_diagnostics_standalone() {
|
||||||
|
local env_dir="$PWD/alltalk_environment"
|
||||||
|
local conda_root_prefix="${env_dir}/conda"
|
||||||
|
local install_env_dir="${env_dir}/env"
|
||||||
|
if [ ! -d "${install_env_dir}" ]; then
|
||||||
|
echo " The Conda environment at '${install_env_dir}' does not exist."
|
||||||
|
echo " Please install the environment before proceeding."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
source "${conda_root_prefix}/etc/profile.d/conda.sh"
|
||||||
|
conda activate "${install_env_dir}"
|
||||||
|
if ! python diagnostics.py; then
|
||||||
|
echo " There was an error running diagnostics."
|
||||||
|
read -p " Press any key to return to the menu. " -n 1
|
||||||
|
echo
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo " Diagnostics completed successfully."
|
||||||
|
read -p " Press any key to continue. " -n 1
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Start the main menu
|
||||||
|
main_menu
|
||||||
@@ -215,6 +215,13 @@ def log_system_info():
|
|||||||
|
|
||||||
# Print colored output
|
# Print colored output
|
||||||
print(f"{package_name.ljust(max_package_length)} Required: {color_required}{operator} {required_version.ljust(12)}\033[0m Installed: {color_installed}{installed_version}\033[0m")
|
print(f"{package_name.ljust(max_package_length)} Required: {color_required}{operator} {required_version.ljust(12)}\033[0m Installed: {color_installed}{installed_version}\033[0m")
|
||||||
|
|
||||||
|
print("\nOn Nvidia Graphics cards machines, if your \033[92mInstalled\033[0m version of \033[92mTorch\033[0m and \033[92mTorchaudio\033[0m does")
|
||||||
|
print("not have \033[92m+cu118\033[0m (Cuda 11.8) or \033[92m+cu121\033[0m (Cuda 12.1) listed after them, you do not have CUDA")
|
||||||
|
print("installed for Torch or Torchaudio in this Python environment. This will cause you problems")
|
||||||
|
print("with \033[94mAllTalk\033[0m and \033[94mFinetuning.\033[0m You may have to 'pip install' a new version of torch and")
|
||||||
|
print("torchaudio, using '\033[94m--upgrade --force-reinstall\033[0m' with the correct version of PyTorch for\033[0m")
|
||||||
|
print("your Python environment.\033[0m")
|
||||||
print("\033[94m\nRequirements file specifier meanings:\033[0m")
|
print("\033[94m\nRequirements file specifier meanings:\033[0m")
|
||||||
explanation = textwrap.dedent("""
|
explanation = textwrap.dedent("""
|
||||||
== Exact version != Any version except < Less than
|
== Exact version != Any version except < Less than
|
||||||
|
|||||||
@@ -917,7 +917,9 @@ if __name__ == "__main__":
|
|||||||
#### - Place your audio files in <span style="color: #3366ff;">{str(audio_folder)}</span>
|
#### - Place your audio files in <span style="color: #3366ff;">{str(audio_folder)}</span>
|
||||||
#### - Your audio samples can be in the format <span style="color: #3366ff;">mp3, wav,</span> or <span style="color: #3366ff;">flac.</span>
|
#### - Your audio samples can be in the format <span style="color: #3366ff;">mp3, wav,</span> or <span style="color: #3366ff;">flac.</span>
|
||||||
#### - You will need a minimum of <span style="color: #3366ff;">2 minutes</span> of audio in either one or multiple audio files. Very small sample files cause errors, so I would suggest 30 seconds and longer samples.
|
#### - You will need a minimum of <span style="color: #3366ff;">2 minutes</span> of audio in either one or multiple audio files. Very small sample files cause errors, so I would suggest 30 seconds and longer samples.
|
||||||
#### - When you have completed Steps 1, 2, and 3, you are welcome to delete your samples from "put-voice-samples-in-here".<br>
|
#### - When you have completed Steps 1, 2, and 3, you are welcome to delete your samples from "put-voice-samples-in-here".
|
||||||
|
#### - FYI Anecdotal evidence suggests that the Whisper 2 model may yield superior results in audio splitting and dataset creation.
|
||||||
|
#### - If this step is failing, it will be worth running the diagnostics with atsetup and confirming you have cu118 or cu112 listed against your torch and torchaudio.<br>
|
||||||
### 🟨 <u>What this step is doing</u>
|
### 🟨 <u>What this step is doing</u>
|
||||||
#### - With step one, we are going to be stripping your audio file(s) into smaller files, using Whisper to find spoken words/sentences, compile that into excel sheets of training data, ready for finetuning the model on Step 2.
|
#### - With step one, we are going to be stripping your audio file(s) into smaller files, using Whisper to find spoken words/sentences, compile that into excel sheets of training data, ready for finetuning the model on Step 2.
|
||||||
#### - Whilst you can choose multiple Whisper models, its best only to use the 1 model as each one is about 3GB in size and will download to your local huggingface cache on first-time use. If and when you have completed training, you wish to delete this 3GB model from your system, you are welcome to do so.
|
#### - Whilst you can choose multiple Whisper models, its best only to use the 1 model as each one is about 3GB in size and will download to your local huggingface cache on first-time use. If and when you have completed training, you wish to delete this 3GB model from your system, you are welcome to do so.
|
||||||
|
|||||||
@@ -237,10 +237,12 @@ process = subprocess.Popen(["python", script_path])
|
|||||||
# Check if the subprocess has started successfully
|
# Check if the subprocess has started successfully
|
||||||
if process.poll() is None:
|
if process.poll() is None:
|
||||||
print(f"[{params['branding']}Startup] TTS Subprocess starting")
|
print(f"[{params['branding']}Startup] TTS Subprocess starting")
|
||||||
|
print(f"[{params['branding']}Startup]")
|
||||||
print(
|
print(
|
||||||
f"[{params['branding']}Startup] Readme available here:",
|
f"[{params['branding']}Startup] \033[94mSettings & Documentation:\033[00m",
|
||||||
f"http://{params['ip_address']}:{params['port_number']}",
|
f"\033[92mhttp://{params['ip_address']}:{params['port_number']}\033[00m",
|
||||||
)
|
)
|
||||||
|
print(f"[{params['branding']}Startup]")
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
f"[{params['branding']}Startup] \033[91mWarning\033[0m TTS Subprocess Webserver failing to start process"
|
f"[{params['branding']}Startup] \033[91mWarning\033[0m TTS Subprocess Webserver failing to start process"
|
||||||
@@ -600,7 +602,7 @@ def output_modifier(string, state):
|
|||||||
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
||||||
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_part)
|
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\u0150\u0151\u0170\u0171\$]', '', cleaned_part)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
||||||
|
|
||||||
@@ -622,7 +624,7 @@ def output_modifier(string, state):
|
|||||||
# Replace multiple instances of certain punctuation marks with a single instance
|
# Replace multiple instances of certain punctuation marks with a single instance
|
||||||
cleaned_part = re.sub(r'([!?.])\1+', r'\1', cleaned_part)
|
cleaned_part = re.sub(r'([!?.])\1+', r'\1', cleaned_part)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_part)
|
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\u0150\u0151\u0170\u0171\$]', '', cleaned_part)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
||||||
# Process the part and give it a non-character name if being used vai API or standalone.
|
# Process the part and give it a non-character name if being used vai API or standalone.
|
||||||
@@ -736,93 +738,16 @@ def input_modifier(string, state):
|
|||||||
def ui():
|
def ui():
|
||||||
with gr.Accordion(params["branding"] + " TTS (XTTSv2)"):
|
with gr.Accordion(params["branding"] + " TTS (XTTSv2)"):
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
activate = gr.Checkbox(value=params["activate"], label="Activate TTS")
|
activate = gr.Checkbox(value=params['activate'], label='Enable TTS')
|
||||||
autoplay = gr.Checkbox(
|
autoplay = gr.Checkbox(value=params['autoplay'], label='Autoplay TTS')
|
||||||
value=params["autoplay"], label="Play TTS automatically"
|
show_text = gr.Checkbox(value=params['show_text'], label='Show Text')
|
||||||
)
|
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
show_text = gr.Checkbox(
|
low_vram = gr.Checkbox(value=params['low_vram'], label='Enable Low VRAM Mode')
|
||||||
value=params["show_text"], label="Show message text under audio player"
|
|
||||||
)
|
|
||||||
remove_trailing_dots = gr.Checkbox(
|
|
||||||
value=params["remove_trailing_dots"],
|
|
||||||
label='Remove trailing "." from text segments before generation',
|
|
||||||
)
|
|
||||||
|
|
||||||
with gr.Row():
|
|
||||||
with gr.Row():
|
|
||||||
available_voices = get_available_voices()
|
|
||||||
default_voice = params["voice"]
|
|
||||||
# Check if the default voice is in the list of available voices
|
|
||||||
if default_voice not in available_voices:
|
|
||||||
# Handle the case where the default voice is not in the list (choose a default value or update it)
|
|
||||||
default_voice = available_voices[
|
|
||||||
0
|
|
||||||
] # Choose the first available voice as the default
|
|
||||||
# Add allow_custom_value=True to the Dropdown
|
|
||||||
voice = gr.Dropdown(
|
|
||||||
available_voices,
|
|
||||||
label="Default Voice",
|
|
||||||
value=default_voice,
|
|
||||||
allow_custom_value=True,
|
|
||||||
)
|
|
||||||
create_refresh_button(
|
|
||||||
voice,
|
|
||||||
lambda: None,
|
|
||||||
lambda: {
|
|
||||||
"choices": get_available_voices(),
|
|
||||||
"value": params["voice"],
|
|
||||||
},
|
|
||||||
"refresh-button",
|
|
||||||
)
|
|
||||||
|
|
||||||
language = gr.Dropdown(
|
|
||||||
languages.keys(),
|
|
||||||
label="Language",
|
|
||||||
allow_custom_value=True,
|
|
||||||
value=params["language"],
|
|
||||||
)
|
|
||||||
|
|
||||||
with gr.Row():
|
|
||||||
with gr.Row():
|
|
||||||
narrator_voice_gr = gr.Dropdown(
|
|
||||||
get_available_voices(),
|
|
||||||
label="Narrator Voice",
|
|
||||||
allow_custom_value=True,
|
|
||||||
value=params["narrator_voice"],
|
|
||||||
)
|
|
||||||
create_refresh_button(
|
|
||||||
narrator_voice_gr,
|
|
||||||
lambda: None,
|
|
||||||
lambda: {
|
|
||||||
"choices": get_available_voices(),
|
|
||||||
"value": params["narrator_voice"],
|
|
||||||
},
|
|
||||||
"refresh-button",
|
|
||||||
)
|
|
||||||
narrator_enabled_gr = gr.Radio(
|
|
||||||
choices={"Enabled": "true", "Disabled": "false"},
|
|
||||||
label="Narrator Activation",
|
|
||||||
value="Enabled" if params.get("narrator_enabled") else "Disabled",
|
|
||||||
)
|
|
||||||
non_quoted_text_is_gr = gr.Radio(
|
|
||||||
choices={"Char": "true", "Narrator": "false"},
|
|
||||||
label='Text NOT inside of * or " is',
|
|
||||||
value="Char" if non_quoted_text_is else "Narrator",
|
|
||||||
)
|
|
||||||
|
|
||||||
with gr.Row():
|
|
||||||
low_vram = gr.Checkbox(
|
|
||||||
value=params["low_vram"], label="Low VRAM mode (Read NOTE)"
|
|
||||||
)
|
|
||||||
low_vram_play = gr.HTML(visible=False)
|
low_vram_play = gr.HTML(visible=False)
|
||||||
deepspeed_checkbox = gr.Checkbox(
|
deepspeed_checkbox = gr.Checkbox(value=params['deepspeed_activate'], label='Enable DeepSpeed', visible=deepspeed_installed)
|
||||||
value=params["deepspeed_activate"],
|
|
||||||
label="Activate DeepSpeed (Read NOTE)",
|
|
||||||
visible=deepspeed_installed,
|
|
||||||
)
|
|
||||||
deepspeed_checkbox_play = gr.HTML(visible=False)
|
deepspeed_checkbox_play = gr.HTML(visible=False)
|
||||||
|
remove_trailing_dots = gr.Checkbox(value=params['remove_trailing_dots'], label='Remove trailing "."')
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
model_loader_choices=["API TTS", "API Local", "XTTSv2 Local"]
|
model_loader_choices=["API TTS", "API Local", "XTTSv2 Local"]
|
||||||
@@ -830,13 +755,37 @@ def ui():
|
|||||||
model_loader_choices.append("XTTSv2 FT")
|
model_loader_choices.append("XTTSv2 FT")
|
||||||
tts_radio_buttons = gr.Radio(
|
tts_radio_buttons = gr.Radio(
|
||||||
choices=model_loader_choices,
|
choices=model_loader_choices,
|
||||||
label="Select TTS Generation Method (Read NOTE)",
|
label="TTS Method (Each method sounds slightly different)",
|
||||||
value=gr_modelchoice, # Set the default value
|
value=gr_modelchoice, # Set the default value
|
||||||
)
|
)
|
||||||
tts_radio_buttons_play = gr.HTML(visible=False)
|
tts_radio_buttons_play = gr.HTML(visible=False)
|
||||||
explanation_text = gr.HTML(
|
with gr.Row():
|
||||||
f"<p>⚙️ <a href='http://{params['ip_address']}:{params['port_number']}'>Click here for the Settings page, help & instructions</a><a href='http://{params['ip_address']}:{params['port_number']}'></a>⚙️<br>NOTE: Switching Model Type, Low VRAM & DeepSpeed, each takes 15 seconds. Each TTS generation method has a slightly different sound. DeepSpeed checkbox is only visible if DeepSpeed is installed on your system."
|
available_voices = get_available_voices()
|
||||||
)
|
default_voice = params["voice"] # Check if the default voice is in the list of available voices
|
||||||
|
|
||||||
|
if default_voice not in available_voices:
|
||||||
|
default_voice = available_voices[ 0 ] # Choose the first available voice as the default
|
||||||
|
# Add allow_custom_value=True to the Dropdown
|
||||||
|
voice = gr.Dropdown(available_voices, label="Character Voice", value=default_voice, allow_custom_value=True, )
|
||||||
|
create_refresh_button(voice, lambda: None, lambda: {"choices": get_available_voices(), "value": params["voice"],}, "refresh-button",)
|
||||||
|
|
||||||
|
with gr.Row():
|
||||||
|
language = gr.Dropdown(languages.keys(), label="Language", value=params["language"])
|
||||||
|
with gr.Row():
|
||||||
|
narrator_voice_gr = gr.Dropdown(get_available_voices(), label="Narrator Voice", allow_custom_value=True, value=params["narrator_voice"])
|
||||||
|
create_refresh_button(narrator_voice_gr, lambda: None, lambda: {"choices": get_available_voices(), "value": params["narrator_voice"],}, "refresh-button")
|
||||||
|
|
||||||
|
# Temperature and Repetition Penalty (Not yet parsed to api/implemented)
|
||||||
|
# with gr.Row():
|
||||||
|
# local_temperature_gr = gr.Slider(minimum=0, maximum=1, step=0.05, label="Temperature", value=params["local_temperature"])
|
||||||
|
# local_repetition_penalty_gr = gr.Slider(minimum=0, maximum=20, step=0.5, label="Repetition Penalty", value=params["local_repetition_penalty"])
|
||||||
|
|
||||||
|
with gr.Row():
|
||||||
|
with gr.Row():
|
||||||
|
narrator_enabled_gr = gr.Radio(choices={"Enabled": "true", "Disabled": "false"}, label="Narrator", value="Enabled" if params.get("narrator_enabled") else "Disabled")
|
||||||
|
non_quoted_text_is_gr = gr.Radio(choices={"Character": "true", "Narrator": "false"}, label='Unmarked text NOT inside of * or " is', value="Character" if non_quoted_text_is else "Narrator")
|
||||||
|
explanation_text = gr.HTML(
|
||||||
|
f"<p>⚙️ <a href='http://{params['ip_address']}:{params['port_number']}'>Settings and Documentation Page</a><a href='http://{params['ip_address']}:{params['port_number']}'></a>⚙️<br>- Low VRAM Mode and Deepspeed take 15 seconds to be enabled or disabled.<br>- The DeepSpeed checkbox is only visible if DeepSpeed is present.</p>")
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
preview_text = gr.Text(
|
preview_text = gr.Text(
|
||||||
@@ -915,6 +864,11 @@ def ui():
|
|||||||
voice.change(lambda x: params.update({"voice": x}), voice, None)
|
voice.change(lambda x: params.update({"voice": x}), voice, None)
|
||||||
language.change(lambda x: params.update({"language": x}), language, None)
|
language.change(lambda x: params.update({"language": x}), language, None)
|
||||||
|
|
||||||
|
|
||||||
|
# TS Settings (Not yet parsed to api/implemented)
|
||||||
|
# local_temperature_gr.change(lambda x: params.update({"local_temperature": x}), local_temperature_gr, None)
|
||||||
|
# local_repetition_penalty_gr.change(lambda x: params.update({"local_repetition_penalty": x}), local_repetition_penalty_gr, None)
|
||||||
|
|
||||||
# Narrator selection actions
|
# Narrator selection actions
|
||||||
narrator_enabled_gr.change(update_narrator_enabled, narrator_enabled_gr, None)
|
narrator_enabled_gr.change(update_narrator_enabled, narrator_enabled_gr, None)
|
||||||
non_quoted_text_is_gr.change(update_non_quoted_text_is, non_quoted_text_is_gr, None)
|
non_quoted_text_is_gr.change(update_non_quoted_text_is, non_quoted_text_is_gr, None)
|
||||||
@@ -934,4 +888,4 @@ if running_in_standalone:
|
|||||||
try:
|
try:
|
||||||
time.sleep(1) # Add a small delay to avoid high CPU usage
|
time.sleep(1) # Add a small delay to avoid high CPU usage
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
break # Allow graceful exit on Ctrl+C
|
break # Allow graceful exit on Ctrl+C
|
||||||
@@ -0,0 +1,938 @@
|
|||||||
|
import { doExtrasFetch, getApiUrl, modules } from '../../extensions.js';
|
||||||
|
import { saveTtsProviderSettings } from './index.js';
|
||||||
|
|
||||||
|
export { AllTalkTtsProvider };
|
||||||
|
|
||||||
|
const css = `
|
||||||
|
.settings-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between; /* Distribute space evenly between the children */
|
||||||
|
align-items: center;
|
||||||
|
width: 100%; /* Full width to spread out the children */
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-option {
|
||||||
|
flex: 1; /* Each child will take equal space */
|
||||||
|
margin: 0 10px; /* Adjust spacing as needed */
|
||||||
|
}
|
||||||
|
|
||||||
|
.endpoint-option {
|
||||||
|
flex: 1; /* Each child will take equal space */
|
||||||
|
margin: 0 10px; /* Adjust spacing as needed */
|
||||||
|
margin-right: 25px;
|
||||||
|
width: 38%; /* Full width to spread out the children */
|
||||||
|
}
|
||||||
|
|
||||||
|
.website-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: start; /* Aligns items to the start of the row */
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 10px; /* Top margin */
|
||||||
|
margin-bottom: 10px; /* Bottom margin */
|
||||||
|
}
|
||||||
|
|
||||||
|
.website-option {
|
||||||
|
flex: 1; /* Allows each option to take equal space */
|
||||||
|
margin-right: 10px; /* Spacing between the two options, adjust as needed */
|
||||||
|
margin-left: 10px; /* Adjust this value to align as desired */
|
||||||
|
/* Remove the individual margin top and bottom declarations if they are set globally on the .settings-row */
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-separator {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 18x;
|
||||||
|
font-weight: bold;
|
||||||
|
border-top: 1px solid #e1e1e1; /* Grey line */
|
||||||
|
border-bottom: 1px solid #e1e1e1; /* Grey line */
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-message {
|
||||||
|
flex: 1; /* Adjust as needed */
|
||||||
|
margin: 0 10px;
|
||||||
|
/* Additional styling */
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-endpoint-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-option, .endpoint-option {
|
||||||
|
flex: 1;
|
||||||
|
margin: 0 10px;
|
||||||
|
margin-left: 10px; /* Adjust this value to align as desired */
|
||||||
|
/* Adjust width as needed to fit in one line */
|
||||||
|
}
|
||||||
|
|
||||||
|
.endpoint-option {
|
||||||
|
/* Adjust width to align with model dropdown */
|
||||||
|
width: 38%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#status_info {
|
||||||
|
color: lightgreen; /* Or any specific shade of green you prefer */
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const style = document.createElement('style');
|
||||||
|
style.type = 'text/css';
|
||||||
|
style.appendChild(document.createTextNode(css));
|
||||||
|
document.head.appendChild(style);
|
||||||
|
|
||||||
|
class AllTalkTtsProvider {
|
||||||
|
//########//
|
||||||
|
// Config //
|
||||||
|
//########//
|
||||||
|
|
||||||
|
settings;
|
||||||
|
ready = false;
|
||||||
|
voices = [];
|
||||||
|
separator = '. ';
|
||||||
|
audioElement = document.createElement('audio');
|
||||||
|
|
||||||
|
languageLabels = {
|
||||||
|
'Arabic': 'ar',
|
||||||
|
'Brazilian Portuguese': 'pt',
|
||||||
|
'Chinese': 'zh-cn',
|
||||||
|
'Czech': 'cs',
|
||||||
|
'Dutch': 'nl',
|
||||||
|
'English': 'en',
|
||||||
|
'French': 'fr',
|
||||||
|
'German': 'de',
|
||||||
|
'Italian': 'it',
|
||||||
|
'Polish': 'pl',
|
||||||
|
'Russian': 'ru',
|
||||||
|
'Spanish': 'es',
|
||||||
|
'Turkish': 'tr',
|
||||||
|
'Japanese': 'ja',
|
||||||
|
'Korean': 'ko',
|
||||||
|
'Hungarian': 'hu',
|
||||||
|
'Hindi': 'hi',
|
||||||
|
};
|
||||||
|
|
||||||
|
Settings = {
|
||||||
|
provider_endpoint: 'http://localhost:7851',
|
||||||
|
language: 'en',
|
||||||
|
voiceMap: {},
|
||||||
|
at_generation_method: 'standard_generation',
|
||||||
|
narrator_enabled: 'false',
|
||||||
|
at_narrator_text_not_inside: 'narrator',
|
||||||
|
narrator_voice_gen: 'female_01.wav',
|
||||||
|
finetuned_model: 'false'
|
||||||
|
};
|
||||||
|
|
||||||
|
get settingsHtml() {
|
||||||
|
let html = `<div class="settings-separator">AllTalk Settings</div>`;
|
||||||
|
|
||||||
|
html += `<div class="settings-row">
|
||||||
|
|
||||||
|
<div class="settings-option">
|
||||||
|
<label for="at_generation_method">AllTalk TTS Generation Method</label>
|
||||||
|
<select id="at_generation_method">
|
||||||
|
<option value="standard_generation">Standard Audio Generation (AT Narrator - Optional)</option>
|
||||||
|
<option value="streaming_enabled">Streaming Audio Generation (AT Narrator - Disabled)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
html += `<div class="settings-row">
|
||||||
|
|
||||||
|
<div class="settings-option">
|
||||||
|
<label for="at_narrator_enabled">AT Narrator</label>
|
||||||
|
<select id="at_narrator_enabled">
|
||||||
|
<option value="true">Enabled</option>
|
||||||
|
<option value="false">Disabled</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="settings-option">
|
||||||
|
<label for="at_narrator_text_not_inside">Text Not Inside * or " is</label>
|
||||||
|
<select id="at_narrator_text_not_inside">
|
||||||
|
<option value="narrator">Narrator</option>
|
||||||
|
<option value="character">Character</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
html += `<div class="settings-row">
|
||||||
|
<div class="settings-option">
|
||||||
|
<label for="narrator_voice">Narrator Voice</label>
|
||||||
|
<select id="narrator_voice">`;
|
||||||
|
if (this.voices) {
|
||||||
|
for (let voice of this.voices) {
|
||||||
|
html += `<option value="${voice.voice_id}">${voice.name}</option>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
html += `</select>
|
||||||
|
</div>
|
||||||
|
<div class="settings-option">
|
||||||
|
<label for="language_options">Language</label>
|
||||||
|
<select id="language_options">`;
|
||||||
|
for (let language in this.languageLabels) {
|
||||||
|
html += `<option value="${this.languageLabels[language]}" ${this.languageLabels[language] === this.settings?.language ? 'selected="selected"' : ''}>${language}</option>`;
|
||||||
|
}
|
||||||
|
html += `</select>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
|
||||||
|
html += `<div class="model-endpoint-row">
|
||||||
|
<div class="model-option">
|
||||||
|
<label for="switch_model">Switch Model</label>
|
||||||
|
<select id="switch_model">
|
||||||
|
<option value="api_tts">API TTS</option>
|
||||||
|
<option value="api_local">API Local</option>
|
||||||
|
<option value="xttsv2_local">XTTSv2 Local</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="endpoint-option">
|
||||||
|
<label for="at_server">AllTalk Endpoint:</label>
|
||||||
|
<input id="at_server" type="text" class="text_pole" maxlength="80" value="${this.Settings.provider_endpoint}"/>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
|
||||||
|
html += `<div class="model-endpoint-row">
|
||||||
|
<div class="settings-option">
|
||||||
|
<label for="low_vram">Low VRAM</label>
|
||||||
|
<input id="low_vram" type="checkbox"/>
|
||||||
|
</div>
|
||||||
|
<div class="settings-option">
|
||||||
|
<label for="deepspeed">DeepSpeed</label>
|
||||||
|
<input id="deepspeed" type="checkbox"/>
|
||||||
|
</div>
|
||||||
|
<div class="settings-option status-option">
|
||||||
|
<span>Status: <span id="status_info">Ready</span></span>
|
||||||
|
</div>
|
||||||
|
<div class="settings-option empty-option">
|
||||||
|
<!-- This div remains empty for spacing -->
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
|
||||||
|
html += `<div class="website-row">
|
||||||
|
<div class="website-option">
|
||||||
|
<span>AllTalk <a target="_blank" href="${this.Settings.provider_endpoint}">Config & Docs</a>.</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="website-option">
|
||||||
|
<span>AllTalk <a target="_blank" href="https://github.com/erew123/alltalk_tts/">Website</a>.</span>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
html += `<div class="website-row">
|
||||||
|
<div class="website-option">
|
||||||
|
<span><strong>Text-generation-webui</strong> users - Uncheck <strong>Enable TTS</strong> in Text-generation-webui.</span>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//#################//
|
||||||
|
// Startup ST & AT //
|
||||||
|
//#################//
|
||||||
|
|
||||||
|
async loadSettings(settings) {
|
||||||
|
updateStatus('Offline');
|
||||||
|
// Use default settings if no settings are provided
|
||||||
|
this.settings = Object.keys(settings).length === 0 ? this.Settings : settings;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Check if TTS provider is ready
|
||||||
|
await this.checkReady();
|
||||||
|
await this.fetchTtsVoiceObjects(); // Fetch voices only if service is ready
|
||||||
|
await this.updateSettingsFromServer();
|
||||||
|
this.updateNarratorVoicesDropdown();
|
||||||
|
this.updateLanguageDropdown();
|
||||||
|
this.setupEventListeners();
|
||||||
|
this.applySettingsToHTML();
|
||||||
|
updateStatus('Ready');
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error loading settings:", error);
|
||||||
|
// Set status to Error if there is an issue in loading settings
|
||||||
|
updateStatus('Offline');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
applySettingsToHTML() {
|
||||||
|
// Load AllTalk specific settings first
|
||||||
|
const loadedSettings = loadAllTalkSettings();
|
||||||
|
// Apply loaded settings or use defaults
|
||||||
|
this.settings = loadedSettings ? { ...this.Settings, ...loadedSettings } : this.Settings;
|
||||||
|
const narratorVoiceSelect = document.getElementById('narrator_voice');
|
||||||
|
const atNarratorSelect = document.getElementById('at_narrator_enabled');
|
||||||
|
const textNotInsideSelect = document.getElementById('at_narrator_text_not_inside');
|
||||||
|
const generationMethodSelect = document.getElementById('at_generation_method');
|
||||||
|
// Apply settings to Narrator Voice dropdown
|
||||||
|
if (narratorVoiceSelect && this.settings.narrator_voice) {
|
||||||
|
narratorVoiceSelect.value = this.settings.narrator_voice.replace('.wav', '');
|
||||||
|
this.settings.narrator_voice_gen = this.settings.narrator_voice;
|
||||||
|
//console.log(this.settings.narrator_voice_gen)
|
||||||
|
}
|
||||||
|
// Apply settings to AT Narrator Enabled dropdown
|
||||||
|
if (atNarratorSelect) {
|
||||||
|
//console.log(this.settings.narrator_enabled)
|
||||||
|
// Sync the state with the checkbox in index.js
|
||||||
|
const ttsPassAsterisksCheckbox = document.getElementById('tts_pass_asterisks'); // Access the checkbox from index.js
|
||||||
|
const ttsNarrateQuotedCheckbox = document.getElementById('tts_narrate_quoted'); // Access the checkbox from index.js
|
||||||
|
const ttsNarrateDialoguesCheckbox = document.getElementById('tts_narrate_dialogues'); // Access the checkbox from index.js
|
||||||
|
// Sync the state with the checkbox in index.js
|
||||||
|
if (this.settings.narrator_enabled) {
|
||||||
|
ttsPassAsterisksCheckbox.checked = false;
|
||||||
|
$('#tts_pass_asterisks').click(); // Simulate a click event
|
||||||
|
$('#tts_pass_asterisks').trigger('change');
|
||||||
|
}
|
||||||
|
if (!this.settings.narrator_enabled) {
|
||||||
|
ttsPassAsterisksCheckbox.checked = true;
|
||||||
|
$('#tts_pass_asterisks').click(); // Simulate a click event
|
||||||
|
$('#tts_pass_asterisks').trigger('change');
|
||||||
|
}
|
||||||
|
// Uncheck and set tts_narrate_quoted to false if narrator is enabled
|
||||||
|
if (this.settings.narrator_enabledd) {
|
||||||
|
ttsNarrateQuotedCheckbox.checked = true;
|
||||||
|
ttsNarrateDialoguesCheckbox.checked = true;
|
||||||
|
// Trigger click events instead of change events
|
||||||
|
$('#tts_narrate_quoted').click();
|
||||||
|
$('#tts_narrate_quoted').trigger('change');
|
||||||
|
$('#tts_narrate_dialogues').click();
|
||||||
|
$('#tts_narrate_dialogues').trigger('change');
|
||||||
|
}
|
||||||
|
atNarratorSelect.value = this.settings.narrator_enabled.toString();
|
||||||
|
this.settings.narrator_enabled = this.settings.narrator_enabled.toString();
|
||||||
|
}
|
||||||
|
// Apply settings to the Language dropdown
|
||||||
|
const languageSelect = document.getElementById('language_options');
|
||||||
|
if (languageSelect && this.settings.language) {
|
||||||
|
languageSelect.value = this.settings.language;
|
||||||
|
//console.log(this.settings.language)
|
||||||
|
}
|
||||||
|
// Apply settings to Text Not Inside dropdown
|
||||||
|
if (textNotInsideSelect && this.settings.text_not_inside) {
|
||||||
|
textNotInsideSelect.value = this.settings.text_not_inside;
|
||||||
|
this.settings.at_narrator_text_not_inside = this.settings.text_not_inside;
|
||||||
|
//console.log(this.settings.at_narrator_text_not_inside)
|
||||||
|
}
|
||||||
|
// Apply settings to Generation Method dropdown
|
||||||
|
if (generationMethodSelect && this.settings.at_generation_method) {
|
||||||
|
generationMethodSelect.value = this.settings.at_generation_method;
|
||||||
|
//console.log(this.settings.at_generation_method)
|
||||||
|
}
|
||||||
|
// Additional logic to disable/enable dropdowns based on the selected generation method
|
||||||
|
const isStreamingEnabled = this.settings.at_generation_method === 'streaming_enabled';
|
||||||
|
if (isStreamingEnabled) {
|
||||||
|
// Disable certain dropdowns when streaming is enabled
|
||||||
|
if (atNarratorSelect) atNarratorSelect.disabled = true;
|
||||||
|
if (textNotInsideSelect) textNotInsideSelect.disabled = true;
|
||||||
|
if (narratorVoiceSelect) narratorVoiceSelect.disabled = true;
|
||||||
|
} else {
|
||||||
|
// Enable dropdowns for standard generation
|
||||||
|
if (atNarratorSelect) atNarratorSelect.disabled = false;
|
||||||
|
if (textNotInsideSelect) textNotInsideSelect.disabled = !this.settings.narrator_enabled;
|
||||||
|
if (narratorVoiceSelect) narratorVoiceSelect.disabled = !this.settings.narrator_enabled;
|
||||||
|
}
|
||||||
|
const modelSelect = document.getElementById('switch_model');
|
||||||
|
if (this.settings.finetuned_model === 'true') {
|
||||||
|
const ftOption = document.createElement('option');
|
||||||
|
ftOption.value = 'XTTSv2 FT';
|
||||||
|
ftOption.textContent = 'XTTSv2 FT';
|
||||||
|
modelSelect.appendChild(ftOption);
|
||||||
|
}
|
||||||
|
//console.log("Settings applied to HTML.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//##############################//
|
||||||
|
// Check AT Server is Available //
|
||||||
|
//##############################//
|
||||||
|
|
||||||
|
async checkReady() {
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${this.settings.provider_endpoint}/api/ready`);
|
||||||
|
// Check if the HTTP request was successful
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP Error Response: ${response.status} ${response.statusText}`);
|
||||||
|
}
|
||||||
|
const statusText = await response.text();
|
||||||
|
// Check if the response is 'Ready'
|
||||||
|
if (statusText === 'Ready') {
|
||||||
|
this.ready = true; // Set the ready flag to true
|
||||||
|
console.log('TTS service is ready.');
|
||||||
|
} else {
|
||||||
|
this.ready = false;
|
||||||
|
console.log('TTS service is not ready.');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error checking TTS service readiness:', error);
|
||||||
|
this.ready = false; // Ensure ready flag is set to false in case of error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//######################//
|
||||||
|
// Get Available Voices //
|
||||||
|
//######################//
|
||||||
|
|
||||||
|
async fetchTtsVoiceObjects() {
|
||||||
|
const response = await fetch(`${this.settings.provider_endpoint}/api/voices`);
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text();
|
||||||
|
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
const voices = data.voices.map(filename => {
|
||||||
|
const voiceName = filename.replace('.wav', '');
|
||||||
|
return {
|
||||||
|
name: voiceName,
|
||||||
|
voice_id: voiceName,
|
||||||
|
preview_url: null, // Preview URL will be dynamically generated
|
||||||
|
lang: 'en' // Default language
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this.voices = voices; // Assign to the class property
|
||||||
|
return voices; // Also return this list
|
||||||
|
}
|
||||||
|
|
||||||
|
//##########################################//
|
||||||
|
// Get Current AT Server Config & Update ST //
|
||||||
|
//##########################################//
|
||||||
|
|
||||||
|
async updateSettingsFromServer() {
|
||||||
|
try {
|
||||||
|
// Fetch current settings
|
||||||
|
const response = await fetch(`${this.settings.provider_endpoint}/api/currentsettings`);
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Failed to fetch current settings: ${response.statusText}`);
|
||||||
|
}
|
||||||
|
const currentSettings = await response.json();
|
||||||
|
// Update internal settings
|
||||||
|
this.settings.modelsAvailable = currentSettings.models_available;
|
||||||
|
this.settings.currentModel = currentSettings.current_model_loaded;
|
||||||
|
this.settings.deepspeed_available = currentSettings.deepspeed_available;
|
||||||
|
this.settings.deepSpeedEnabled = currentSettings.deepspeed_status;
|
||||||
|
this.settings.lowVramEnabled = currentSettings.low_vram_status;
|
||||||
|
this.settings.finetuned_model = currentSettings.finetuned_model
|
||||||
|
// Update HTML elements
|
||||||
|
this.updateModelDropdown();
|
||||||
|
this.updateCheckboxes();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error updating settings from server: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//###################################################//
|
||||||
|
// Get Current AT Server Config & Update ST (Models) //
|
||||||
|
//###################################################//
|
||||||
|
|
||||||
|
updateModelDropdown() {
|
||||||
|
const modelSelect = document.getElementById('switch_model');
|
||||||
|
if (modelSelect) {
|
||||||
|
modelSelect.innerHTML = ''; // Clear existing options
|
||||||
|
this.settings.modelsAvailable.forEach(model => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = model.model_name;
|
||||||
|
option.textContent = model.model_name; // Use model_name instead of name
|
||||||
|
option.selected = model.model_name === this.settings.currentModel;
|
||||||
|
modelSelect.appendChild(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#######################################################//
|
||||||
|
// Get Current AT Server Config & Update ST (DS and LVR) //
|
||||||
|
//#######################################################//
|
||||||
|
|
||||||
|
updateCheckboxes() {
|
||||||
|
const deepspeedCheckbox = document.getElementById('deepspeed');
|
||||||
|
const lowVramCheckbox = document.getElementById('low_vram');
|
||||||
|
if (lowVramCheckbox) lowVramCheckbox.checked = this.settings.lowVramEnabled;
|
||||||
|
if (deepspeedCheckbox) {
|
||||||
|
deepspeedCheckbox.checked = this.settings.deepSpeedEnabled;
|
||||||
|
deepspeedCheckbox.disabled = !this.settings.deepspeed_available; // Disable checkbox if deepspeed is not available
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//###############################################################//
|
||||||
|
// Get Current AT Server Config & Update ST (AT Narrator Voices) //
|
||||||
|
//###############################################################//
|
||||||
|
|
||||||
|
updateNarratorVoicesDropdown() {
|
||||||
|
const narratorVoiceSelect = document.getElementById('narrator_voice');
|
||||||
|
if (narratorVoiceSelect && this.voices) {
|
||||||
|
// Clear existing options
|
||||||
|
narratorVoiceSelect.innerHTML = '';
|
||||||
|
// Add new options
|
||||||
|
for (let voice of this.voices) {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = voice.voice_id;
|
||||||
|
option.textContent = voice.name;
|
||||||
|
narratorVoiceSelect.appendChild(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//######################################################//
|
||||||
|
// Get Current AT Server Config & Update ST (Languages) //
|
||||||
|
//######################################################//
|
||||||
|
|
||||||
|
updateLanguageDropdown() {
|
||||||
|
const languageSelect = document.getElementById('language_options');
|
||||||
|
if (languageSelect) {
|
||||||
|
// Ensure default language is set
|
||||||
|
this.settings.language = this.Settings.language;
|
||||||
|
|
||||||
|
languageSelect.innerHTML = '';
|
||||||
|
for (let language in this.languageLabels) {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = this.languageLabels[language];
|
||||||
|
option.textContent = language;
|
||||||
|
if (this.languageLabels[language] === this.settings.language) {
|
||||||
|
option.selected = true;
|
||||||
|
}
|
||||||
|
languageSelect.appendChild(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//########################################//
|
||||||
|
// Start AT TTS extenstion page listeners //
|
||||||
|
//########################################//
|
||||||
|
|
||||||
|
setupEventListeners() {
|
||||||
|
|
||||||
|
let debounceTimeout;
|
||||||
|
const debounceDelay = 500; // Milliseconds
|
||||||
|
|
||||||
|
// Define the event handler function
|
||||||
|
const onModelSelectChange = async (event) => {
|
||||||
|
console.log("Model select change event triggered"); // Debugging statement
|
||||||
|
const selectedModel = event.target.value;
|
||||||
|
console.log(`Selected model: ${selectedModel}`); // Debugging statement
|
||||||
|
// Set status to Processing
|
||||||
|
updateStatus('Processing');
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${this.settings.provider_endpoint}/api/reload?tts_method=${encodeURIComponent(selectedModel)}`, {
|
||||||
|
method: 'POST'
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP Error: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("POST response data:", data); // Debugging statement
|
||||||
|
// Set status to Ready if successful
|
||||||
|
updateStatus('Ready');
|
||||||
|
} catch (error) {
|
||||||
|
console.error("POST request error:", error); // Debugging statement
|
||||||
|
// Set status to Error in case of failure
|
||||||
|
updateStatus('Error');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle response or error
|
||||||
|
};
|
||||||
|
|
||||||
|
const debouncedModelSelectChange = (event) => {
|
||||||
|
clearTimeout(debounceTimeout);
|
||||||
|
debounceTimeout = setTimeout(() => {
|
||||||
|
onModelSelectChange(event);
|
||||||
|
}, debounceDelay);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Switch Model Listener
|
||||||
|
const modelSelect = document.getElementById('switch_model');
|
||||||
|
if (modelSelect) {
|
||||||
|
// Remove the event listener if it was previously added
|
||||||
|
modelSelect.removeEventListener('change', debouncedModelSelectChange);
|
||||||
|
// Add the debounced event listener
|
||||||
|
modelSelect.addEventListener('change', debouncedModelSelectChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepSpeed Listener
|
||||||
|
const deepspeedCheckbox = document.getElementById('deepspeed');
|
||||||
|
if (deepspeedCheckbox) {
|
||||||
|
deepspeedCheckbox.addEventListener('change', async (event) => {
|
||||||
|
const deepSpeedValue = event.target.checked ? 'True' : 'False';
|
||||||
|
// Set status to Processing
|
||||||
|
updateStatus('Processing');
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${this.settings.provider_endpoint}/api/deepspeed?new_deepspeed_value=${deepSpeedValue}`, {
|
||||||
|
method: 'POST'
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP Error: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("POST response data:", data); // Debugging statement
|
||||||
|
// Set status to Ready if successful
|
||||||
|
updateStatus('Ready');
|
||||||
|
} catch (error) {
|
||||||
|
console.error("POST request error:", error); // Debugging statement
|
||||||
|
// Set status to Error in case of failure
|
||||||
|
updateStatus('Error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Low VRAM Listener
|
||||||
|
const lowVramCheckbox = document.getElementById('low_vram');
|
||||||
|
if (lowVramCheckbox) {
|
||||||
|
lowVramCheckbox.addEventListener('change', async (event) => {
|
||||||
|
const lowVramValue = event.target.checked ? 'True' : 'False';
|
||||||
|
// Set status to Processing
|
||||||
|
updateStatus('Processing');
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${this.settings.provider_endpoint}/api/lowvramsetting?new_low_vram_value=${lowVramValue}`, {
|
||||||
|
method: 'POST'
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP Error: ${response.status}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("POST response data:", data); // Debugging statement
|
||||||
|
// Set status to Ready if successful
|
||||||
|
updateStatus('Ready');
|
||||||
|
} catch (error) {
|
||||||
|
console.error("POST request error:", error); // Debugging statement
|
||||||
|
// Set status to Error in case of failure
|
||||||
|
updateStatus('Error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Narrator Voice Dropdown Listener
|
||||||
|
const narratorVoiceSelect = document.getElementById('narrator_voice');
|
||||||
|
if (narratorVoiceSelect) {
|
||||||
|
narratorVoiceSelect.addEventListener('change', (event) => {
|
||||||
|
this.settings.narrator_voice_gen = `${event.target.value}.wav`;
|
||||||
|
this.onSettingsChangeAllTalk(); // Save the settings after change
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const textNotInsideSelect = document.getElementById('at_narrator_text_not_inside');
|
||||||
|
if (textNotInsideSelect) {
|
||||||
|
textNotInsideSelect.addEventListener('change', (event) => {
|
||||||
|
this.settings.text_not_inside = event.target.value;
|
||||||
|
this.onSettingsChangeAllTalk(); // Save the settings after change
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// AT Narrator Dropdown Listener
|
||||||
|
const atNarratorSelect = document.getElementById('at_narrator_enabled');
|
||||||
|
const ttsPassAsterisksCheckbox = document.getElementById('tts_pass_asterisks'); // Access the checkbox from index.js
|
||||||
|
const ttsNarrateQuotedCheckbox = document.getElementById('tts_narrate_quoted'); // Access the checkbox from index.js
|
||||||
|
const ttsNarrateDialoguesCheckbox = document.getElementById('tts_narrate_dialogues'); // Access the checkbox from index.js
|
||||||
|
|
||||||
|
if (atNarratorSelect && textNotInsideSelect && narratorVoiceSelect) {
|
||||||
|
atNarratorSelect.addEventListener('change', (event) => {
|
||||||
|
const isNarratorEnabled = event.target.value === 'true';
|
||||||
|
this.settings.narrator_enabled = isNarratorEnabled; // Update the setting here
|
||||||
|
textNotInsideSelect.disabled = !isNarratorEnabled;
|
||||||
|
narratorVoiceSelect.disabled = !isNarratorEnabled;
|
||||||
|
|
||||||
|
// Sync the state with the checkbox in index.js
|
||||||
|
if (isNarratorEnabled) {
|
||||||
|
ttsPassAsterisksCheckbox.checked = false;
|
||||||
|
$('#tts_pass_asterisks').click(); // Simulate a click event
|
||||||
|
$('#tts_pass_asterisks').trigger('change');
|
||||||
|
}
|
||||||
|
if (!isNarratorEnabled) {
|
||||||
|
ttsPassAsterisksCheckbox.checked = true;
|
||||||
|
$('#tts_pass_asterisks').click(); // Simulate a click event
|
||||||
|
$('#tts_pass_asterisks').trigger('change');
|
||||||
|
}
|
||||||
|
// Uncheck and set tts_narrate_quoted to false if narrator is enabled
|
||||||
|
if (isNarratorEnabled) {
|
||||||
|
ttsNarrateQuotedCheckbox.checked = true;
|
||||||
|
ttsNarrateDialoguesCheckbox.checked = true;
|
||||||
|
// Trigger click events instead of change events
|
||||||
|
$('#tts_narrate_quoted').click();
|
||||||
|
$('#tts_narrate_quoted').trigger('change');
|
||||||
|
$('#tts_narrate_dialogues').click();
|
||||||
|
$('#tts_narrate_dialogues').trigger('change');
|
||||||
|
}
|
||||||
|
this.onSettingsChangeAllTalk(); // Save the settings after change
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Event Listener for AT Generation Method Dropdown
|
||||||
|
const atGenerationMethodSelect = document.getElementById('at_generation_method');
|
||||||
|
const atNarratorEnabledSelect = document.getElementById('at_narrator_enabled');
|
||||||
|
if (atGenerationMethodSelect) {
|
||||||
|
atGenerationMethodSelect.addEventListener('change', (event) => {
|
||||||
|
const selectedMethod = event.target.value;
|
||||||
|
|
||||||
|
if (selectedMethod === 'streaming_enabled') {
|
||||||
|
// Disable and unselect AT Narrator
|
||||||
|
atNarratorEnabledSelect.disabled = true;
|
||||||
|
atNarratorEnabledSelect.value = 'false';
|
||||||
|
textNotInsideSelect.disabled = true;
|
||||||
|
narratorVoiceSelect.disabled = true;
|
||||||
|
} else if (selectedMethod === 'standard_generation') {
|
||||||
|
// Enable AT Narrator
|
||||||
|
atNarratorEnabledSelect.disabled = false;
|
||||||
|
}
|
||||||
|
this.settings.at_generation_method = selectedMethod; // Update the setting here
|
||||||
|
this.onSettingsChangeAllTalk(); // Save the settings after change
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listener for Language Dropdown
|
||||||
|
const languageSelect = document.getElementById('language_options');
|
||||||
|
if (languageSelect) {
|
||||||
|
languageSelect.addEventListener('change', (event) => {
|
||||||
|
this.settings.language = event.target.value;
|
||||||
|
this.onSettingsChangeAllTalk(); // Save the settings after change
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#############################//
|
||||||
|
// Store ST interface settings //
|
||||||
|
//#############################//
|
||||||
|
|
||||||
|
onSettingsChange() {
|
||||||
|
// Update settings that SillyTavern will save
|
||||||
|
this.settings.provider_endpoint = $('#at_server').val();
|
||||||
|
this.settings.language = $('#language_options').val();
|
||||||
|
saveTtsProviderSettings(); // This function should save settings handled by SillyTavern
|
||||||
|
// Call the function to handle AllTalk specific settings
|
||||||
|
this.onSettingsChangeAllTalk(); // Save the settings after change
|
||||||
|
}
|
||||||
|
|
||||||
|
onSettingsChangeAllTalk() {
|
||||||
|
// Update AllTalk specific settings and save to localStorage
|
||||||
|
this.settings.narrator_enabled = $('#at_narrator_enabled').val() === 'true';
|
||||||
|
this.settings.narrator_voice = $('#narrator_voice').val() + '.wav'; // assuming you need to append .wav
|
||||||
|
this.settings.text_not_inside = $('#at_narrator_text_not_inside').val(); // "character" or "narrator"
|
||||||
|
this.settings.at_generation_method = $('#at_generation_method').val(); // Streaming or standard
|
||||||
|
this.settings.language = $('#language_options').val(); // Streaming or standard
|
||||||
|
|
||||||
|
// Call the save function with the current settings
|
||||||
|
saveAllTalkSettings({
|
||||||
|
narrator_voice: this.settings.narrator_voice,
|
||||||
|
narrator_enabled: this.settings.narrator_enabled,
|
||||||
|
text_not_inside: this.settings.text_not_inside,
|
||||||
|
at_generation_method: this.settings.at_generation_method,
|
||||||
|
language: this.settings.language
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//#########################//
|
||||||
|
// ST Handle Reload button //
|
||||||
|
//#########################//
|
||||||
|
|
||||||
|
async onRefreshClick() {
|
||||||
|
await this.checkReady(); // Check if the TTS provider is ready
|
||||||
|
await this.loadSettings(this.settings); // Reload the settings
|
||||||
|
// Additional actions as needed
|
||||||
|
}
|
||||||
|
|
||||||
|
//##################//
|
||||||
|
// Preview AT Voice //
|
||||||
|
//##################//
|
||||||
|
|
||||||
|
async previewTtsVoice(voiceName) {
|
||||||
|
try {
|
||||||
|
// Prepare data for POST request
|
||||||
|
const postData = new URLSearchParams();
|
||||||
|
postData.append("voice", `${voiceName}.wav`);
|
||||||
|
// Making the POST request
|
||||||
|
const response = await fetch(`${this.settings.provider_endpoint}/api/previewvoice/`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
},
|
||||||
|
body: postData,
|
||||||
|
});
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text();
|
||||||
|
console.error(`[previewTtsVoice] Error Response Text:`, errorText);
|
||||||
|
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
||||||
|
}
|
||||||
|
// Assuming the server returns a URL to the .wav file
|
||||||
|
const data = await response.json();
|
||||||
|
if (data.output_file_url) {
|
||||||
|
// Use an audio element to play the .wav file
|
||||||
|
const audioElement = new Audio(data.output_file_url);
|
||||||
|
audioElement.play().catch(e => console.error("Error playing audio:", e));
|
||||||
|
} else {
|
||||||
|
console.warn("[previewTtsVoice] No output file URL received in the response");
|
||||||
|
throw new Error("No output file URL received in the response");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("[previewTtsVoice] Exception caught during preview generation:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#####################//
|
||||||
|
// Populate ST voices //
|
||||||
|
//#####################//
|
||||||
|
|
||||||
|
async getVoice(voiceName, generatePreview = false) {
|
||||||
|
// Ensure this.voices is populated
|
||||||
|
if (this.voices.length === 0) {
|
||||||
|
// Fetch voice objects logic
|
||||||
|
}
|
||||||
|
// Find the object where the name matches voiceName
|
||||||
|
const match = this.voices.find(voice => voice.name === voiceName);
|
||||||
|
if (!match) {
|
||||||
|
// Error handling
|
||||||
|
}
|
||||||
|
// Generate preview URL only if requested
|
||||||
|
if (!match.preview_url && generatePreview) {
|
||||||
|
// Generate preview logic
|
||||||
|
}
|
||||||
|
return match; // Return the found voice object
|
||||||
|
}
|
||||||
|
|
||||||
|
//##########################################//
|
||||||
|
// Generate TTS Streaming or call Standard //
|
||||||
|
//##########################################//
|
||||||
|
|
||||||
|
async generateTts(inputText, voiceId) {
|
||||||
|
try {
|
||||||
|
if (this.settings.at_generation_method === 'streaming_enabled') {
|
||||||
|
// For streaming method
|
||||||
|
const streamingUrl = `${this.settings.provider_endpoint}/api/tts-generate-streaming?text=${encodeURIComponent(inputText)}&voice=${encodeURIComponent(voiceId)}.wav&language=${encodeURIComponent(this.settings.language)}&output_file=stream_output.wav`;
|
||||||
|
const audioElement = new Audio(streamingUrl);
|
||||||
|
audioElement.play(); // Play the audio stream directly
|
||||||
|
console.log("Streaming URL:", streamingUrl);
|
||||||
|
return new Response(null, {
|
||||||
|
status: 200,
|
||||||
|
statusText: "OK",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "audio/wav",
|
||||||
|
"Content-Location": streamingUrl
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// For standard method
|
||||||
|
const outputUrl = await this.fetchTtsGeneration(inputText, voiceId);
|
||||||
|
// Fetch the audio data as a blob from the URL
|
||||||
|
const audioResponse = await fetch(outputUrl);
|
||||||
|
if (!audioResponse.ok) {
|
||||||
|
throw new Error(`HTTP ${audioResponse.status}: Failed to fetch audio data`);
|
||||||
|
}
|
||||||
|
const audioBlob = await audioResponse.blob();
|
||||||
|
if (!audioBlob.type.startsWith('audio/')) {
|
||||||
|
throw new Error(`Invalid audio data format. Expecting audio/*, got ${audioBlob.type}`);
|
||||||
|
}
|
||||||
|
return new Response(audioBlob, {
|
||||||
|
status: 200,
|
||||||
|
statusText: "OK",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": audioBlob.type
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error in generateTts:", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//####################//
|
||||||
|
// Generate Standard //
|
||||||
|
//####################//
|
||||||
|
|
||||||
|
async fetchTtsGeneration(inputText, voiceId) {
|
||||||
|
// Prepare the request payload
|
||||||
|
const requestBody = new URLSearchParams({
|
||||||
|
'text_input': inputText,
|
||||||
|
'text_filtering': "standard",
|
||||||
|
'character_voice_gen': voiceId + ".wav",
|
||||||
|
'narrator_enabled': this.settings.narrator_enabled,
|
||||||
|
'narrator_voice_gen': this.settings.narrator_voice_gen,
|
||||||
|
'text_not_inside': this.settings.text_not_inside,
|
||||||
|
'language': this.settings.language,
|
||||||
|
'output_file_name': "st_output",
|
||||||
|
'output_file_timestamp': "true",
|
||||||
|
'autoplay': "false",
|
||||||
|
'autoplay_volume': "0.8"
|
||||||
|
}).toString();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await doExtrasFetch(
|
||||||
|
`${this.settings.provider_endpoint}/api/tts-generate`,
|
||||||
|
{
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
},
|
||||||
|
body: requestBody
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text();
|
||||||
|
console.error(`[fetchTtsGeneration] Error Response Text:`, errorText);
|
||||||
|
// Uncomment the following line if you have a UI element for displaying errors
|
||||||
|
// toastr.error(response.statusText, 'TTS Generation Failed');
|
||||||
|
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
const outputUrl = data.output_file_url;
|
||||||
|
return outputUrl; // Return only the output_file_url
|
||||||
|
} catch (error) {
|
||||||
|
console.error("[fetchTtsGeneration] Exception caught:", error);
|
||||||
|
throw error; // Rethrow the error for further handling
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#########################//
|
||||||
|
// Update Status Messages //
|
||||||
|
//#########################//
|
||||||
|
|
||||||
|
function updateStatus(message) {
|
||||||
|
const statusElement = document.getElementById('status_info');
|
||||||
|
if (statusElement) {
|
||||||
|
statusElement.textContent = message;
|
||||||
|
switch (message) {
|
||||||
|
case 'Offline':
|
||||||
|
statusElement.style.color = 'red';
|
||||||
|
break;
|
||||||
|
case 'Ready':
|
||||||
|
statusElement.style.color = 'lightgreen';
|
||||||
|
break;
|
||||||
|
case 'Processing':
|
||||||
|
statusElement.style.color = 'blue';
|
||||||
|
break;
|
||||||
|
case 'Error':
|
||||||
|
statusElement.style.color = 'red';
|
||||||
|
break;
|
||||||
|
// Add more cases as needed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//########################//
|
||||||
|
// Save/load AT Settings //
|
||||||
|
//########################//
|
||||||
|
|
||||||
|
function saveAllTalkSettings(settingsToSave) {
|
||||||
|
// Save the specific settings to localStorage
|
||||||
|
console.log("settings", settingsToSave)
|
||||||
|
localStorage.setItem('AllTalkSettings', JSON.stringify(settingsToSave));
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadAllTalkSettings() {
|
||||||
|
// Retrieve the settings from localStorage
|
||||||
|
const settings = localStorage.getItem('AllTalkSettings');
|
||||||
|
// If settings exist, parse them back into an object
|
||||||
|
if (settings) {
|
||||||
|
return JSON.parse(settings);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@@ -1,584 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>AllTalk TTS Generator</title>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
body,
|
|
||||||
textarea,
|
|
||||||
select,
|
|
||||||
input[type="range"],
|
|
||||||
input[type="number"],
|
|
||||||
button {
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 20px;
|
|
||||||
background-color: #f7f7f7;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-container {
|
|
||||||
max-width: 80%;
|
|
||||||
margin: 50px auto;
|
|
||||||
padding: 20px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.settings-section {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: flex-start;
|
|
||||||
/* Align items to the start */
|
|
||||||
align-items: center;
|
|
||||||
/* Align items vertically */
|
|
||||||
gap: 20px;
|
|
||||||
/* This creates a consistent gap between all child elements */
|
|
||||||
}
|
|
||||||
|
|
||||||
.setting {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
/* Space from bottom if wrapped */
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
/* Removed flex property to stop forcing them to grow */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
label {
|
|
||||||
font-size: 0.9em;
|
|
||||||
color: #333;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea {
|
|
||||||
resize: vertical;
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure select and input elements do not exceed the width of their parent */
|
|
||||||
select,
|
|
||||||
input[type="range"],
|
|
||||||
input[type="number"] {
|
|
||||||
width: 100%;
|
|
||||||
/* They will fill the width of their .setting container */
|
|
||||||
padding: 10px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
|
|
||||||
select,
|
|
||||||
input[type="range"],
|
|
||||||
input[type="number"] {
|
|
||||||
width: auto;
|
|
||||||
/* Only auto width for larger screens */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
button {
|
|
||||||
background-color: #4caf50;
|
|
||||||
color: #fff;
|
|
||||||
padding: 10px 20px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-block;
|
|
||||||
margin: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background-color: #45a049;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark-mode {
|
|
||||||
background-color: #121212;
|
|
||||||
color: #ffffff;
|
|
||||||
/* Text color for dark mode background */
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark-mode .form-container {
|
|
||||||
background-color: #1e1e1e;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Modify the text color for elements within dark mode */
|
|
||||||
.dark-mode label,
|
|
||||||
.dark-mode textarea,
|
|
||||||
.dark-mode select,
|
|
||||||
.dark-mode input[type="range"],
|
|
||||||
.dark-mode input[type="number"],
|
|
||||||
.dark-mode button,
|
|
||||||
.dark-mode .error {
|
|
||||||
color: #ffffff;
|
|
||||||
/* Text color for dark mode elements */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Modify text color for input elements, textarea, and dropdowns in dark mode */
|
|
||||||
.dark-mode input,
|
|
||||||
.dark-mode textarea,
|
|
||||||
.dark-mode select {
|
|
||||||
color: #000000;
|
|
||||||
/* Text color for input elements, textarea, and dropdowns in dark mode */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set background color for textarea in dark mode */
|
|
||||||
.dark-mode textarea {
|
|
||||||
background-color: #C0C0C0;
|
|
||||||
/* Light grey background color for textarea in dark mode */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set background color for option elements within select in dark mode */
|
|
||||||
.dark-mode select {
|
|
||||||
background-color: #C0C0C0;
|
|
||||||
/* Light grey background color for options in dark mode */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Additional styles if needed for fixed-width dropdowns */
|
|
||||||
.fixed-size-dropdown {
|
|
||||||
width: 130px;
|
|
||||||
/* Adjust the width as needed */
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-overlay {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spinner {
|
|
||||||
border: 5px solid #f3f3f3;
|
|
||||||
border-top: 5px solid #3498db;
|
|
||||||
border-radius: 50%;
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
animation: spin 2s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
|
||||||
color: #ff0000;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Add space between sliders */
|
|
||||||
.slider-setting {
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Adjust the thumb appearance for a more standard line slider look */
|
|
||||||
input[type="range"]::-webkit-slider-thumb,
|
|
||||||
input[type="range"]::-moz-range-thumb,
|
|
||||||
input[type="range"]::-ms-thumb {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
width: 16px;
|
|
||||||
/* Smaller width for a more standard thumb size */
|
|
||||||
height: 16px;
|
|
||||||
/* Smaller height for a more standard thumb size */
|
|
||||||
border-radius: 50%;
|
|
||||||
/* Keep it rounded, or set to 0 for square */
|
|
||||||
background: #3071a9;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-top: -7px;
|
|
||||||
/* Adjust if needed to align thumb with the track */
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<h1>AllTalk TTS Generator</h1>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<div class="input-section">
|
|
||||||
<label for="text_input">Text Input:</label>
|
|
||||||
<textarea id="text_input" rows="8"></textarea> <!-- Removed cols attribute -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="settings-section">
|
|
||||||
|
|
||||||
<div class="setting voice-setting">
|
|
||||||
<label for="character_voice_gen">Character Voice:</label>
|
|
||||||
<select id="character_voice_gen"></select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="setting language-setting">
|
|
||||||
<label for="language">Language:</label>
|
|
||||||
<select id="language" name="language" class="fixed-size-dropdown">
|
|
||||||
<option value="ar">Arabic</option>
|
|
||||||
<option value="zh-cn">Chinese (Simplified)</option>
|
|
||||||
<option value="cs">Czech</option>
|
|
||||||
<option value="nl">Dutch</option>
|
|
||||||
<option value="en" selected>English</option>
|
|
||||||
<option value="fr">French</option>
|
|
||||||
<option value="de">German</option>
|
|
||||||
<option value="hu">Hungarian</option>
|
|
||||||
<option value="it">Italian</option>
|
|
||||||
<option value="ja">Japanese</option>
|
|
||||||
<option value="ko">Korean</option>
|
|
||||||
<option value="pl">Polish</option>
|
|
||||||
<option value="pt">Portuguese</option>
|
|
||||||
<option value="ru">Russian</option>
|
|
||||||
<option value="es">Spanish</option>
|
|
||||||
<option value="tr">Turkish</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="setting play-mode-setting">
|
|
||||||
<label for="playMode">Playback:</label>
|
|
||||||
<select id="playMode" name="playMode" class="fixed-size-dropdown">
|
|
||||||
<option value="local" selected>In Browser</option>
|
|
||||||
<option value="remote">On Server</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="setting theme-mode-setting">
|
|
||||||
<label for="themeMode">Theme:</label>
|
|
||||||
<select id="themeMode" name="themeMode" class="fixed-size-dropdown">
|
|
||||||
<option value="light" selected>Light</option>
|
|
||||||
<option value="dark">Dark</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="setting chunk-size-setting">
|
|
||||||
<label for="chunkSize">Sentence Chunk Size:</label>
|
|
||||||
<input type="range" id="chunkSize" name="chunkSize" class="slider-setting" min="1" max="10" value="4"
|
|
||||||
oninput="updateChunkSizeValue(this.value)">
|
|
||||||
<span id="chunkSizeValue">3</span> <!-- Display the value of the slider -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="setting volume-setting">
|
|
||||||
<label for="volume">Volume:</label>
|
|
||||||
<input type="range" id="volume" name="volume" class="slider-setting" min="0.1" max="1.0" step="0.1"
|
|
||||||
value="0.8" oninput="updateVolumeValue(this.value)">
|
|
||||||
<span id="volumeValue">0.8</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="action-buttons">
|
|
||||||
<button onclick="generateTTS()">Generate TTS</button>
|
|
||||||
<button onclick="stopPlayback()">Stop Playback</button>
|
|
||||||
<button onclick="previewVoice()">Preview Voice</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="progressIndicator" class="progress-overlay" style="display: none;">
|
|
||||||
<div class="spinner"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
async function fetchVoices() {
|
|
||||||
try {
|
|
||||||
const response = await fetch("http://127.0.0.1:7851/api/voices");
|
|
||||||
const result = await response.json();
|
|
||||||
const characterVoiceSelect = document.getElementById("character_voice_gen");
|
|
||||||
|
|
||||||
result.voices.forEach(voice => {
|
|
||||||
const option = document.createElement("option");
|
|
||||||
option.value = voice;
|
|
||||||
option.text = voice;
|
|
||||||
characterVoiceSelect.add(option);
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateVolumeValue(value) {
|
|
||||||
document.getElementById("volumeValue").innerText = value;
|
|
||||||
|
|
||||||
// Set the volume for browser playback
|
|
||||||
audioElement.volume = parseFloat(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
let stopTTSGeneration = false;
|
|
||||||
let audioQueue = [];
|
|
||||||
let currentlyPlaying = false;
|
|
||||||
const audioElement = new Audio();
|
|
||||||
|
|
||||||
async function generateTTS() {
|
|
||||||
try {
|
|
||||||
// Reset the flag at the start
|
|
||||||
stopTTSGeneration = false;
|
|
||||||
|
|
||||||
const textInput = document.getElementById("text_input").value;
|
|
||||||
const language = document.getElementById("language").value;
|
|
||||||
const characterVoice = document.getElementById("character_voice_gen").value;
|
|
||||||
const volume = parseFloat(document.getElementById("volume").value);
|
|
||||||
const chunkSize = parseInt(document.getElementById("chunkSize").value);
|
|
||||||
// Retrieve the value of the selected option for playMode from the dropdown
|
|
||||||
const playModeValue = document.getElementById("playMode").value;
|
|
||||||
|
|
||||||
// Clean up the textInput
|
|
||||||
let cleanedText = textInput.replace(/ \- | \– /g, ' '); // Replaces " - " and " – " with " "
|
|
||||||
cleanedText = cleanedText.replace(/\.\s'/g, ".'"); // Correctly remove space between a period and a single quote
|
|
||||||
cleanedText = cleanedText.replace(/'/g, ""); // Remove all single quotes
|
|
||||||
|
|
||||||
// Split text into chunks based on the specified number of sentences
|
|
||||||
const sentences = cleanedText.match(/("[^"]+"|[^.!?]+[.!?]+)/g);
|
|
||||||
const chunks = [];
|
|
||||||
for (let i = 0; i < sentences.length; i += chunkSize) {
|
|
||||||
let chunk = sentences.slice(i, i + chunkSize).map(s => s.trim()).join(' ');
|
|
||||||
chunks.push(chunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use playModeValue for the conditional check
|
|
||||||
if (playModeValue === "remote") {
|
|
||||||
for (const chunk of chunks) {
|
|
||||||
if (stopTTSGeneration) break; // Stop if flag is set
|
|
||||||
await generateAndPlayRemote(chunk, language, characterVoice, volume);
|
|
||||||
}
|
|
||||||
} else if (playModeValue === "local") {
|
|
||||||
generateAndPlayLocal(chunks, 0);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error in generateTTS:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function generateAndPlayLocal(chunks, index) {
|
|
||||||
if (index >= chunks.length || stopTTSGeneration) {
|
|
||||||
return; // Stop if no more chunks or flag is set
|
|
||||||
}
|
|
||||||
if (index >= chunks.length) {
|
|
||||||
// No more chunks to process
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const chunk = chunks[index];
|
|
||||||
const data = new URLSearchParams({
|
|
||||||
text_input: chunk.trim(),
|
|
||||||
text_filtering: "standard",
|
|
||||||
character_voice_gen: document.getElementById("character_voice_gen").value,
|
|
||||||
narrator_enabled: "false",
|
|
||||||
narrator_voice_gen: document.getElementById("character_voice_gen").value,
|
|
||||||
text_not_inside: "character",
|
|
||||||
language: document.getElementById("language").value,
|
|
||||||
output_file_name: "myoutputfile",
|
|
||||||
output_file_timestamp: "true",
|
|
||||||
autoplay: "false",
|
|
||||||
autoplay_volume: document.getElementById("volume").value
|
|
||||||
});
|
|
||||||
|
|
||||||
const response = await fetch("http://127.0.0.1:7851/api/tts-generate", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
},
|
|
||||||
body: data,
|
|
||||||
});
|
|
||||||
|
|
||||||
const result = await response.json();
|
|
||||||
if (result.output_file_url) {
|
|
||||||
audioQueue.push(result.output_file_url);
|
|
||||||
if (!currentlyPlaying) {
|
|
||||||
playNextLocalChunk();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recursively call the function with the next index
|
|
||||||
generateAndPlayLocal(chunks, index + 1);
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error in generateAndPlayLocal with chunk index", index, ":", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function generateAndPlayRemote(chunk, language, characterVoice, volume) {
|
|
||||||
try {
|
|
||||||
if (stopTTSGeneration) {
|
|
||||||
console.log("TTS generation stopped.");
|
|
||||||
return; // Early return if stop flag is set
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = new URLSearchParams({
|
|
||||||
text_input: chunk.trim(),
|
|
||||||
text_filtering: "standard",
|
|
||||||
character_voice_gen: characterVoice,
|
|
||||||
narrator_enabled: "false",
|
|
||||||
narrator_voice_gen: characterVoice,
|
|
||||||
text_not_inside: "character",
|
|
||||||
language: language,
|
|
||||||
output_file_name: "myoutputfile",
|
|
||||||
output_file_timestamp: "true",
|
|
||||||
autoplay: "true",
|
|
||||||
autoplay_volume: volume.toString(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const response = await fetch("http://127.0.0.1:7851/api/tts-generate", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
},
|
|
||||||
body: data,
|
|
||||||
});
|
|
||||||
|
|
||||||
const result = await response.json();
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(`API error: ${result.detail || 'Unknown error'}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("TTS generation complete for chunk:", chunk);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error in generateAndPlayRemote:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function previewVoice() {
|
|
||||||
const characterVoice = document.getElementById("character_voice_gen").value;
|
|
||||||
try {
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append("voice", characterVoice);
|
|
||||||
|
|
||||||
const response = await fetch("http://127.0.0.1:7851/api/previewvoice/", {
|
|
||||||
method: "POST",
|
|
||||||
body: formData,
|
|
||||||
});
|
|
||||||
|
|
||||||
const result = await response.json();
|
|
||||||
if (result.status === "generate-success") {
|
|
||||||
// Play the preview audio
|
|
||||||
const audioPreview = new Audio(result.output_file_url);
|
|
||||||
audioPreview.play();
|
|
||||||
} else {
|
|
||||||
throw new Error('Preview generation failed');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error in previewVoice:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function playNextLocalChunk() {
|
|
||||||
if (audioQueue.length > 0) {
|
|
||||||
currentlyPlaying = true;
|
|
||||||
const audioUrl = audioQueue.shift();
|
|
||||||
audioElement.src = audioUrl;
|
|
||||||
audioElement.play();
|
|
||||||
|
|
||||||
audioElement.onended = () => {
|
|
||||||
currentlyPlaying = false;
|
|
||||||
playNextLocalChunk();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleThemeMode() {
|
|
||||||
// Retrieve the value of the selected option for themeMode from the dropdown
|
|
||||||
const themeModeValue = document.getElementById('themeMode').value;
|
|
||||||
|
|
||||||
if (themeModeValue === "dark") {
|
|
||||||
document.body.classList.add('dark-mode');
|
|
||||||
localStorage.setItem('darkMode', 'enabled'); // Assuming saveDarkModePreference sets this
|
|
||||||
} else {
|
|
||||||
document.body.classList.remove('dark-mode');
|
|
||||||
localStorage.setItem('darkMode', 'disabled'); // Assuming saveDarkModePreference sets this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateChunkSizeValue(value) {
|
|
||||||
document.getElementById("chunkSizeValue").innerText = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optionally, save the dark mode preference in localStorage
|
|
||||||
function saveDarkModePreference(isDarkMode) {
|
|
||||||
localStorage.setItem('darkMode', isDarkMode ? 'enabled' : 'disabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopPlayback() {
|
|
||||||
// Stop current audio playback
|
|
||||||
audioElement.pause();
|
|
||||||
audioElement.currentTime = 0;
|
|
||||||
|
|
||||||
// Clear the audio queue, reset playback flag, and stop further TTS generation
|
|
||||||
audioQueue = [];
|
|
||||||
currentlyPlaying = false;
|
|
||||||
stopTTSGeneration = true; // Set flag to stop TTS generation
|
|
||||||
}
|
|
||||||
|
|
||||||
function showProgress() {
|
|
||||||
document.getElementById('progressIndicator').style.display = 'flex';
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideProgress() {
|
|
||||||
document.getElementById('progressIndicator').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function displayOutput(result) {
|
|
||||||
const outputContainer = document.getElementById("output");
|
|
||||||
outputContainer.innerHTML = `<p>Status: ${result.status}</p>`;
|
|
||||||
if (result.output_file_path) {
|
|
||||||
outputContainer.innerHTML += `<p>File Path: ${result.output_file_path}</p>`;
|
|
||||||
}
|
|
||||||
if (result.output_file_url) {
|
|
||||||
outputContainer.innerHTML += `<p>File URL: ${result.output_file_url}</p>`;
|
|
||||||
}
|
|
||||||
if (result.error) {
|
|
||||||
outputContainer.innerHTML += `<p class="error">Error: ${result.error}</p>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
fetchVoices();
|
|
||||||
|
|
||||||
const isDarkModeEnabled = localStorage.getItem('darkMode') === 'enabled';
|
|
||||||
const themeModeSelect = document.getElementById('themeMode');
|
|
||||||
if (isDarkModeEnabled) {
|
|
||||||
document.body.classList.add('dark-mode');
|
|
||||||
themeModeSelect.value = 'dark';
|
|
||||||
} else {
|
|
||||||
themeModeSelect.value = 'light';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add change event listener to the themeMode dropdown
|
|
||||||
themeModeSelect.addEventListener('change', toggleThemeMode);
|
|
||||||
|
|
||||||
// Initialize other elements if necessary
|
|
||||||
};
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<link rel="shortcut icon" href="#">
|
<link rel="icon" href="./static/favicon.ico" type="image/x-icon">
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>AllTalk TTS for Text generation webUI</title>
|
<title>AllTalk TTS for Text generation webUI</title>
|
||||||
@@ -218,9 +218,11 @@
|
|||||||
<li><a href="#getting-started">Getting Started</a></li>
|
<li><a href="#getting-started">Getting Started</a></li>
|
||||||
<li><a href="#server-information">Server Information</a></li>
|
<li><a href="#server-information">Server Information</a></li>
|
||||||
<li><a href="#demotesttts">Demo/Test TTS output</a></li>
|
<li><a href="#demotesttts">Demo/Test TTS output</a></li>
|
||||||
|
<li><a href="#tts-generator">AllTalk TTS Generator</a></li>
|
||||||
<li><a href="#using-voice-samples">Using Voice Samples</a></li>
|
<li><a href="#using-voice-samples">Using Voice Samples</a></li>
|
||||||
<li><a href="#text-not-inside">Text Not inside</a></li>
|
<li><a href="#text-not-inside">Text Not inside</a></li>
|
||||||
<li><a href="#low-vram">Low VRAM</a></li>
|
<li><a href="#low-vram">Low VRAM</a></li>
|
||||||
|
<li><a href="#sillytavern-support">Silly Tavern Support</a></li>
|
||||||
<li><a href="#finetune">Finetuning (Training the model)</a></li>
|
<li><a href="#finetune">Finetuning (Training the model)</a></li>
|
||||||
<li><a href="#deepspeed">DeepSpeed</a>
|
<li><a href="#deepspeed">DeepSpeed</a>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -271,6 +273,8 @@
|
|||||||
here</a><br />Update instructions <a href="https://github.com/erew123/alltalk_tts?#-updating"
|
here</a><br />Update instructions <a href="https://github.com/erew123/alltalk_tts?#-updating"
|
||||||
target="_blank" rel="noopener">link here</a><br />Help and issues <a
|
target="_blank" rel="noopener">link here</a><br />Help and issues <a
|
||||||
href="https://github.com/erew123/alltalk_tts?#-help-with-problems" target="_blank" rel="noopener">link
|
href="https://github.com/erew123/alltalk_tts?#-help-with-problems" target="_blank" rel="noopener">link
|
||||||
|
here</a><br />TTS Generator <a href="http://127.0.0.1:7851/static/tts_chunk_player/tts_chunk_player.html"
|
||||||
|
target="_blank" rel="noopener">link
|
||||||
here<br /><br /></a><span style="text-decoration: underline;"><strong>Text generation webUI</strong></span>
|
here<br /><br /></a><span style="text-decoration: underline;"><strong>Text generation webUI</strong></span>
|
||||||
<br />Web interface <a href="http://{{ params.ip_address }}:7860" target="_blank" rel="noopener">link
|
<br />Web interface <a href="http://{{ params.ip_address }}:7860" target="_blank" rel="noopener">link
|
||||||
here</a> <br />Documentation <a href="https://github.com/oobabooga/text-generation-webui/wiki"
|
here</a> <br />Documentation <a href="https://github.com/oobabooga/text-generation-webui/wiki"
|
||||||
@@ -288,6 +292,8 @@
|
|||||||
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
||||||
|
|
||||||
<h2 id="demotesttts">Demo/Test TTS</h2>
|
<h2 id="demotesttts">Demo/Test TTS</h2>
|
||||||
|
<p style="padding-left: 30px;">If you are wanting to generate bulk quantities of TTS and have control over them,
|
||||||
|
please see the <a href="#tts-generator">AllTalk TTS Generator</a> below.</p>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<form method="post" action="/tts-demo-request" id="ttsForm">
|
<form method="post" action="/tts-demo-request" id="ttsForm">
|
||||||
<label for="text">Text:</label>
|
<label for="text">Text:</label>
|
||||||
@@ -400,6 +406,9 @@
|
|||||||
});
|
});
|
||||||
// Form submit
|
// Form submit
|
||||||
const form = document.getElementById('ttsForm');
|
const form = document.getElementById('ttsForm');
|
||||||
|
const ipAddress = "{{ params.ip_address }}";
|
||||||
|
const portNumber = "{{ params.port_number }}";
|
||||||
|
const baseurl = `http://${ipAddress}:${portNumber}`;
|
||||||
form.addEventListener('submit', async (event) => {
|
form.addEventListener('submit', async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@@ -411,11 +420,13 @@
|
|||||||
// Get and clean the text input from the textarea
|
// Get and clean the text input from the textarea
|
||||||
let textInput = formData.get('text');
|
let textInput = formData.get('text');
|
||||||
let cleanedText = textInput.replace(/ \- | \– /g, ' '); // Replace hyphens
|
let cleanedText = textInput.replace(/ \- | \– /g, ' '); // Replace hyphens
|
||||||
cleanedText = cleanedText.replace(/([!?.])\1+/g, '$1');
|
cleanedText = cleanedText.replace(/%/g, " percent");
|
||||||
cleanedText = cleanedText.replace(/[^a-zA-Z0-9\s\.,;:!?\-\'"]/g, '');
|
//cleanedText = cleanedText.replace(/([!?.])\1+/g, '$1');
|
||||||
|
//cleanedText = cleanedText.replace(/[^a-zA-Z0-9\s\.,;:!?\-\'"À-ÿ\u0400-\u04FF]/g, '');
|
||||||
|
cleanedText = cleanedText.replace(/[^a-zA-Z0-9\s\.,;:!?\-\'"À-ÿ\u0400-\u04FF]\$/g, '')
|
||||||
cleanedText = cleanedText.replace(/\n+/g, ' ');
|
cleanedText = cleanedText.replace(/\n+/g, ' ');
|
||||||
cleanedText = cleanedText.replace(/\.\s'/g, ".'"); // Remove space between period and single quote
|
cleanedText = cleanedText.replace(/\.\s'/g, ".'"); // Remove space between period and single quote
|
||||||
cleanedText = cleanedText.replace(/'/g, ""); // Remove all single quotes
|
//cleanedText = cleanedText.replace(/'/g, ""); // Remove all single quotes
|
||||||
|
|
||||||
// Set the cleaned text back to the form data
|
// Set the cleaned text back to the form data
|
||||||
formData.set('text', cleanedText);
|
formData.set('text', cleanedText);
|
||||||
@@ -425,11 +436,11 @@
|
|||||||
if (formData.get('streaming') === 'true') {
|
if (formData.get('streaming') === 'true') {
|
||||||
// For streaming, update the audio player src
|
// For streaming, update the audio player src
|
||||||
const searchParams = new URLSearchParams(formData).toString();
|
const searchParams = new URLSearchParams(formData).toString();
|
||||||
audioPlayer.src = "/tts-demo-request?" + searchParams;
|
audioPlayer.src = baseurl + "/api/tts-generate-streaming?" + searchParams;
|
||||||
audioPlayer.load(); // Reload the audio player
|
audioPlayer.load(); // Reload the audio player
|
||||||
} else {
|
} else {
|
||||||
// For non-streaming, send a POST request
|
// For non-streaming, send a POST request
|
||||||
const response = await fetch('/tts-demo-request', {
|
const response = await fetch('/api/tts-generate-streaming', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
cache: "no-store"
|
cache: "no-store"
|
||||||
@@ -440,7 +451,7 @@
|
|||||||
// Update output file path and audio player source
|
// Update output file path and audio player source
|
||||||
const outputFilePath = document.getElementById('outputFilePath');
|
const outputFilePath = document.getElementById('outputFilePath');
|
||||||
outputFilePath.textContent = result.output_file_path;
|
outputFilePath.textContent = result.output_file_path;
|
||||||
audioPlayer.src = `/audio/${result.output_file_path}`;
|
audioPlayer.src = baseurl + `/audio/${result.output_file_path}`;
|
||||||
audioPlayer.load(); // Reload the audio player
|
audioPlayer.load(); // Reload the audio player
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -448,6 +459,87 @@
|
|||||||
</script>
|
</script>
|
||||||
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 id="tts-generator"><strong>AllTalk TTS Generator</strong></h2>
|
||||||
|
<p style="padding-left: 30px;">AllTalk TTS Generator is the solution for converting large volumes of text into
|
||||||
|
speech using the voice of your choice. Whether you're creating audio content or just want to hear text read
|
||||||
|
aloud, the TTS Generator is equipped to handle it all efficiently.</p>
|
||||||
|
<p style="padding-left: 30px;">The TTS Generator is available on this <a
|
||||||
|
href="http://127.0.0.1:7851/static/tts_chunk_player/tts_chunk_player.html" target="_blank"
|
||||||
|
rel="noopener">link</a></p>
|
||||||
|
<h4>Quick Start</h4>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Text Input:</strong> Enter the text you wish to convert into speech in the 'Text Input' box.</li>
|
||||||
|
<li><strong>Generate TTS Button:</strong> Hit this to start the text-to-speech conversion.</li>
|
||||||
|
<li><strong>Pause/Resume:</strong> Used to pause and resume the playback of the initial generation of wavs or
|
||||||
|
the stream.</li>
|
||||||
|
<li><strong>Stop Playback:</strong> This will stop the current audio playing back. It does not stop the text
|
||||||
|
from being generated however.</li>
|
||||||
|
</ul>
|
||||||
|
<p style="padding-left: 30px;">Once you have sent text off to be generated, either as a stream or wav file
|
||||||
|
generation, the TTS server will remain busy until this process has competed. As such, think carefully as to how
|
||||||
|
much you want to send to the server.</p>
|
||||||
|
<p style="padding-left: 30px;">If you are generating wav files and populating the queue, you can generate one lot of
|
||||||
|
text to speech, then input your next lot of text and it will continue adding to the list.</p>
|
||||||
|
<h4>TTS Generation Modes</h4>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Wav Chunks:</strong> Perfect for creating audio books, or anything you want to keep long term.
|
||||||
|
Breaks down your text into manageable wav files and queues them up. Generation begins automatically, and
|
||||||
|
playback will start after a few chunks have been prepared ahead. You can set the volume to 0 if you
|
||||||
|
don’t want to hear playback. With Wav chunks, you can edit and/or regenerate portions of the TTS as
|
||||||
|
needed.</li>
|
||||||
|
<li><strong>Streaming:</strong> For immediate playback without the ability to save. Ideal for on-the-fly speech
|
||||||
|
generation and listening. This will not generate wav files and it will play back through your browser. You
|
||||||
|
cannot stop the server generating the TTS once it has been sent.</li>
|
||||||
|
</ul>
|
||||||
|
<p style="padding-left: 30px;">With wav chunks you can either playback “In Browser” which is the web
|
||||||
|
page you are on, or “On Server” which is through the console/terminal where AllTalk is running from.
|
||||||
|
Only generation “In Browser” can play back smoothly and populate the Generated TTS List. Setting the
|
||||||
|
Volume will affect the volume level played back both “In Browser” and “On Server”.</p>
|
||||||
|
<h4>Playback and List Management</h4>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Playback Controls:</strong> Utilize 'Play List' to start from the beginning or 'Stop Playback' to
|
||||||
|
halt at any time.</li>
|
||||||
|
<li><strong>Custom Start:</strong> Jump into your list at a specific ID to hear a particular section.</li>
|
||||||
|
<li><strong>Regeneration and Editing:</strong> If a chunk isn't quite right, you can opt to regenerate it or
|
||||||
|
edit the text directly. Click off the text to save changes and hit regenerate for the specific line.</li>
|
||||||
|
<li><strong>Export/Import List:</strong> Save your TTS list as a JSON file or import one. Note: Existing wav
|
||||||
|
files are needed for playback. Exporting is handy if you want to take your files away into another program
|
||||||
|
and have a list of which wav is which, or if you keep your audio files, but want to come back at a later
|
||||||
|
date, edit one or two lines, regenerate the speech and re-combine the wav’s into one new long wav.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Exporting Your Audio</h4>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Export to WAV:</strong> Combine all generated TTS from the list, into one single WAV file for easy
|
||||||
|
download and distribution.</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Customization and Preferences</h4>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Character Voice:</strong> Choose the voice that will read your text.</li>
|
||||||
|
<li><strong>Language:</strong> Select the language of your text.</li>
|
||||||
|
<li><strong>Chunk Sizes:</strong> Decide the size of text chunks for generation. Smaller sizes are recommended
|
||||||
|
for better TTS quality.</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Interface and Accessibility</h4>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Dark/Light Mode:</strong> Switch between themes for your visual comfort.</li>
|
||||||
|
<li><strong>Word Count and Generation Queue:</strong> Keep track of the word count and the generation progress.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Notes on Usage</h4>
|
||||||
|
<ul>
|
||||||
|
<li>For seamless TTS generation, it's advised to keep text chunks under 250 characters, which you can control
|
||||||
|
with the Chunk sizes.</li>
|
||||||
|
<li>Generated audio can be played back from the list, which also highlights the currently playing chunk.</li>
|
||||||
|
<li>The TTS Generator remembers your settings, so you can pick up where you left off even after refreshing the
|
||||||
|
page.</li>
|
||||||
|
</ul>
|
||||||
|
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2 id="using-voice-samples"><strong>Using Voice Samples</strong></h2>
|
<h2 id="using-voice-samples"><strong>Using Voice Samples</strong></h2>
|
||||||
<h4 id="where-are-the-sample-voices-stored">Where are the sample voices stored?</h4>
|
<h4 id="where-are-the-sample-voices-stored">Where are the sample voices stored?</h4>
|
||||||
<p style="padding-left: 30px;">Voice samples are stored in <span style="color: #3366ff;">/alltalk_tts/voices/</span>
|
<p style="padding-left: 30px;">Voice samples are stored in <span style="color: #3366ff;">/alltalk_tts/voices/</span>
|
||||||
@@ -473,7 +565,7 @@
|
|||||||
is
|
is
|
||||||
<span style="color: #3366ff;">22050Hz</span>, <span style="color: #3366ff;">Mono</span>, <span
|
<span style="color: #3366ff;">22050Hz</span>, <span style="color: #3366ff;">Mono</span>, <span
|
||||||
style="color: #3366ff;">16 bit</span> and between 6 to 30 seconds long, though 8 to 10 seconds is usually
|
style="color: #3366ff;">16 bit</span> and between 6 to 30 seconds long, though 8 to 10 seconds is usually
|
||||||
good enough. The model can handle up to a 30 second samples, however I've not noticed any improvement in voice
|
good enough. The model can handle up to 30 second samples, however I've not noticed any improvement in voice
|
||||||
output from a much longer clips.
|
output from a much longer clips.
|
||||||
</p>
|
</p>
|
||||||
<p style="padding-left: 30px; text-align: justify;">You want to find a nice clear selection of audio, so lets say
|
<p style="padding-left: 30px; text-align: justify;">You want to find a nice clear selection of audio, so lets say
|
||||||
@@ -568,6 +660,113 @@
|
|||||||
|
|
||||||
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
||||||
|
|
||||||
|
<h2 id="sillytavern-support"><strong>SillyTavern Support</strong></h2>
|
||||||
|
<h4>Important note for Text-generation-webui users</h4>
|
||||||
|
<p style="padding-left: 30px;">You <strong><span style="color: #3366ff;">HAVE</span></strong> to disable
|
||||||
|
<strong>Enable TTS</strong> within the Text-generation-webui AllTalk interface,
|
||||||
|
otherwise Text-generation-webui will also generate TTS due to the way it sends out text. You can do this
|
||||||
|
each time you start up Text-generation-webui or set it in the start-up settings at the top of this page.
|
||||||
|
</p>
|
||||||
|
<h4>Quick Tips</h4>
|
||||||
|
<ul>
|
||||||
|
<li>Only change DeepSpeed, Low VRAM or Model one at a time. Wait for it to say Ready before changing something
|
||||||
|
else.</li>
|
||||||
|
<li>You can permanently change the AllTalk startup settings or DeepSpeed, Low VRAM and Model at the top of this
|
||||||
|
page.</li>
|
||||||
|
<li>Different AI models use quotes and asterisks differently, so you may need to change "Text not inside"
|
||||||
|
depending on model.</li>
|
||||||
|
<li>Add new voice samples to the voices folder. You can Finetune a model to make it sound even closer to the
|
||||||
|
original sample.</li>
|
||||||
|
<li>DeepSpeed will improve processing time to TTS to be 2-3x faster.</li>
|
||||||
|
<li>Low VRAM can be very beneficial if you don't have much memory left after loading your LLM.</li>
|
||||||
|
</ul>
|
||||||
|
<h4>TTS Generation Methods in SilllyTavern</h4>
|
||||||
|
<p style="padding-left: 30px;">You have 2 types of audio generation options, Streaming and Standard.</p>
|
||||||
|
<p style="padding-left: 30px; text-align: justify;">The Streaming Audio Generation method is designed for speed and
|
||||||
|
is best suited for situations where you just want quick audio playback. This method, however, is limited to
|
||||||
|
using just one voice per TTS generation request. This means a limitation of the Streaming method is the
|
||||||
|
inability to utilize the AllTalk narrator function, making it a straightforward but less nuanced option.</p>
|
||||||
|
<p style="padding-left: 30px; text-align: justify;">On the other hand, the Standard Audio Generation method provides
|
||||||
|
a richer auditory experience. It's slightly slower than the Streaming method but compensates for this with its
|
||||||
|
ability to split text into multiple voices. This functionality is particularly useful in scenarios where
|
||||||
|
differentiating between character dialogues and narration can enhance the storytelling and delivery. The
|
||||||
|
inclusion of the AllTalk narrator functionality in the Standard method allows for a more layered and immersive
|
||||||
|
experience, making it ideal for content where depth and variety in voice narration add significant value.</p>
|
||||||
|
<p style="padding-left: 30px; text-align: justify;">In summary, the choice between Streaming and Standard methods in
|
||||||
|
AllTalk TTS depends on what you want. Streaming is great for quick and simple audio generation, while Standard
|
||||||
|
is preferable for a more dynamic and engaging audio experience.</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>AllTalk TTS Generation Method:</strong>
|
||||||
|
<ul>
|
||||||
|
<li>Select between Standard and Streaming Audio Generation methods.</li>
|
||||||
|
<li>This setting impacts the AllTalk narrator functionality.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><strong>Language Selection:</strong><br />
|
||||||
|
<ul>
|
||||||
|
<li>Select your preferred TTS generation language from the "Language" dropdown.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><strong>Model Switching:</strong>
|
||||||
|
<ul>
|
||||||
|
<li>Switch between different TTS models like API TTS, API Local, XTTSv2 Local, and optionally XTTSv2 FT
|
||||||
|
if you have a finetuned model available.</li>
|
||||||
|
<li>Fine-tuned model availability (XTTSv2 FT) will only show when a finetuned model is detected by
|
||||||
|
AllTalk.</li>
|
||||||
|
<li>See TTS Models/Methods for more information (though most people will want to stick with XTTSv2
|
||||||
|
Local).</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><strong>DeepSpeed and Low VRAM Options:</strong>
|
||||||
|
<ul>
|
||||||
|
<li>Optimize performance with DeepSpeed and Low VRAM settings.</li>
|
||||||
|
<li>DeepSpeed can offer a 2-3x performance boost on TTS generation. (Requires installation)</li>
|
||||||
|
<li>See the relevant sections in this documentation for details.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p style="padding-left: 30px;">Changing model or DeepSpeed or Low VRAM <span
|
||||||
|
style="color: #0000ff;"><strong>each</strong></span> take about 15 seconds so you should only change one at
|
||||||
|
a time and wait for <span style="color: #99cc00;">Ready</span> before changing the next setting. To set these
|
||||||
|
options long term you can apply the settings at the top of this page.</p>
|
||||||
|
<h4>AllTalk Narrator</h4>
|
||||||
|
<p style="padding-left: 30px;">Only available on the Standard Audo Generation method.</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Narrator Voice Selection:</strong>
|
||||||
|
<ul>
|
||||||
|
<li>Allows users to choose different narrator voices.</li>
|
||||||
|
<li>Access via the "Narrator Voice" dropdown.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><strong>AllTalk Narrator:</strong>
|
||||||
|
<ul>
|
||||||
|
<li>Toggle the AllTalk narrator feature.</li>
|
||||||
|
<li>Access via "AT Narrator" dropdown with Enabled/Disabled options.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><strong>Text Outside Asterisks Handling:</strong>
|
||||||
|
<ul>
|
||||||
|
<li>Choose how text outside asterisks is interpreted (as Narrator or Character voice).</li>
|
||||||
|
<li>Managed via the "Text Not Inside * or "" dropdown.</li>
|
||||||
|
<li>Note, only available when the AllTalk Narrator is enabled.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Usage Notes:</h4>
|
||||||
|
<ul>
|
||||||
|
<li>On startup of SillyTavern, it will pull your current settings from AllTalk (Current model, DeepSpeed status,
|
||||||
|
Low VRAM status and Finetuned model availability).</li>
|
||||||
|
<li>Enabling the narrator automatically unchecks certain checkboxes related to text handling.</li>
|
||||||
|
<li>Changes in model or settings might trigger multiple requests to the server; patience is advised.</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Troubleshooting:</h4>
|
||||||
|
<ul>
|
||||||
|
<li>If experiencing issues, use the Reload button in SillyTavern's TTS extension to reinitialize the connection
|
||||||
|
to AllTalk and check if AllTalk is started correctly.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p style="padding-left: 30px;"><a href="#toc">Back to top of page</a></p>
|
||||||
|
|
||||||
<h2 id="finetune"><strong>Finetuning (Training the model)</strong></h2>
|
<h2 id="finetune"><strong>Finetuning (Training the model)</strong></h2>
|
||||||
<p style="margin-left:40px; text-align:justify">If you have a voice that the model doesnt quite reproduce correctly,
|
<p style="margin-left:40px; text-align:justify">If you have a voice that the model doesnt quite reproduce correctly,
|
||||||
or indeed you just want to improve the reproduced voice, then finetuning is a way to train your "XTTSv2
|
or indeed you just want to improve the reproduced voice, then finetuning is a way to train your "XTTSv2
|
||||||
@@ -747,6 +946,8 @@
|
|||||||
|
|
||||||
<h3 id="deepspeed-windows">DeepSpeed Setup - Windows</h3>
|
<h3 id="deepspeed-windows">DeepSpeed Setup - Windows</h3>
|
||||||
<p style="padding-left: 30px;">➡️DeepSpeed requires an Nvidia Graphics card!⬅️</p>
|
<p style="padding-left: 30px;">➡️DeepSpeed requires an Nvidia Graphics card!⬅️</p>
|
||||||
|
<p style="padding-left: 30px;">The atsetup utility for Windows can install DeepSpeed for you (Stanalone users whom
|
||||||
|
installed via the atsetup utility will already have DeepSpeed installed).</p>
|
||||||
<p style="padding-left: 30px;">DeepSpeed v11.2 will work on the current default text-generation-webui Python 3.11
|
<p style="padding-left: 30px;">DeepSpeed v11.2 will work on the current default text-generation-webui Python 3.11
|
||||||
environment! You have 2x options for how to setup DeepSpeed on Windows. A quick way <span
|
environment! You have 2x options for how to setup DeepSpeed on Windows. A quick way <span
|
||||||
style="color: #339966;"><strong>Option 1</strong></span> and a long way <span
|
style="color: #339966;"><strong>Option 1</strong></span> and a long way <span
|
||||||
|
|||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,179 @@
|
|||||||
|
export interface CrunkerConstructorOptions {
|
||||||
|
/**
|
||||||
|
* Sample rate for Crunker's internal audio context.
|
||||||
|
*
|
||||||
|
* @default 44100
|
||||||
|
*/
|
||||||
|
sampleRate: number;
|
||||||
|
}
|
||||||
|
export type CrunkerInputTypes = string | File | Blob;
|
||||||
|
/**
|
||||||
|
* An exported Crunker audio object.
|
||||||
|
*/
|
||||||
|
export interface ExportedCrunkerAudio {
|
||||||
|
blob: Blob;
|
||||||
|
url: string;
|
||||||
|
element: HTMLAudioElement;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Crunker is the simple way to merge, concatenate, play, export and download audio files using the Web Audio API.
|
||||||
|
*/
|
||||||
|
export default class Crunker {
|
||||||
|
private readonly _sampleRate;
|
||||||
|
private readonly _context;
|
||||||
|
/**
|
||||||
|
* Creates a new instance of Crunker with the provided options.
|
||||||
|
*
|
||||||
|
* If `sampleRate` is not defined, it will auto-select an appropriate sample rate
|
||||||
|
* for the device being used.
|
||||||
|
*/
|
||||||
|
constructor({ sampleRate }?: Partial<CrunkerConstructorOptions>);
|
||||||
|
/**
|
||||||
|
* Creates Crunker's internal AudioContext.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _createContext;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* The internal AudioContext used by Crunker.
|
||||||
|
*/
|
||||||
|
get context(): AudioContext;
|
||||||
|
/**
|
||||||
|
* Asynchronously fetches multiple audio files and returns an array of AudioBuffers.
|
||||||
|
*/
|
||||||
|
fetchAudio(...filepaths: CrunkerInputTypes[]): Promise<AudioBuffer[]>;
|
||||||
|
/**
|
||||||
|
* Merges (layers) multiple AudioBuffers into a single AudioBuffer.
|
||||||
|
*
|
||||||
|
* **Visual representation:**
|
||||||
|
*
|
||||||
|
* 
|
||||||
|
*/
|
||||||
|
mergeAudio(buffers: AudioBuffer[]): AudioBuffer;
|
||||||
|
/**
|
||||||
|
* Concatenates multiple AudioBuffers into a single AudioBuffer.
|
||||||
|
*
|
||||||
|
* **Visual representation:**
|
||||||
|
*
|
||||||
|
* 
|
||||||
|
*/
|
||||||
|
concatAudio(buffers: AudioBuffer[]): AudioBuffer;
|
||||||
|
/**
|
||||||
|
* Pads a specified AudioBuffer with silence from a specified start time,
|
||||||
|
* for a specified length of time.
|
||||||
|
*
|
||||||
|
* Accepts float values as well as whole integers.
|
||||||
|
*
|
||||||
|
* @param buffer AudioBuffer to pad
|
||||||
|
* @param padStart Time to start padding (in seconds)
|
||||||
|
* @param seconds Duration to pad for (in seconds)
|
||||||
|
*/
|
||||||
|
padAudio(buffer: AudioBuffer, padStart?: number, seconds?: number): AudioBuffer;
|
||||||
|
/**
|
||||||
|
* Slices an AudioBuffer from the specified start time to the end time, with optional fade in and out.
|
||||||
|
*
|
||||||
|
* @param buffer AudioBuffer to slice
|
||||||
|
* @param start Start time (in seconds)
|
||||||
|
* @param end End time (in seconds)
|
||||||
|
* @param fadeIn Fade in duration (in seconds, default is 0)
|
||||||
|
* @param fadeOut Fade out duration (in seconds, default is 0)
|
||||||
|
*/
|
||||||
|
sliceAudio(buffer: AudioBuffer, start: number, end: number, fadeIn?: number, fadeOut?: number): AudioBuffer;
|
||||||
|
/**
|
||||||
|
* Plays the provided AudioBuffer in an AudioBufferSourceNode.
|
||||||
|
*/
|
||||||
|
play(buffer: AudioBuffer): AudioBufferSourceNode;
|
||||||
|
/**
|
||||||
|
* Exports the specified AudioBuffer to a Blob, Object URI and HTMLAudioElement.
|
||||||
|
*
|
||||||
|
* Note that changing the MIME type does not change the actual file format. The
|
||||||
|
* file format will **always** be a WAVE file due to how audio is stored in the
|
||||||
|
* browser.
|
||||||
|
*
|
||||||
|
* @param buffer Buffer to export
|
||||||
|
* @param type MIME type (default: `audio/wav`)
|
||||||
|
*/
|
||||||
|
export(buffer: AudioBuffer, type?: string): ExportedCrunkerAudio;
|
||||||
|
/**
|
||||||
|
* Downloads the provided Blob.
|
||||||
|
*
|
||||||
|
* @param blob Blob to download
|
||||||
|
* @param filename An optional file name to use for the download (default: `crunker`)
|
||||||
|
*/
|
||||||
|
download(blob: Blob, filename?: string): HTMLAnchorElement;
|
||||||
|
/**
|
||||||
|
* Executes a callback if the browser does not support the Web Audio API.
|
||||||
|
*
|
||||||
|
* Returns the result of the callback, or `undefined` if the Web Audio API is supported.
|
||||||
|
*
|
||||||
|
* @param callback callback to run if the browser does not support the Web Audio API
|
||||||
|
*/
|
||||||
|
notSupported<T>(callback: () => T): T | undefined;
|
||||||
|
/**
|
||||||
|
* Closes Crunker's internal AudioContext.
|
||||||
|
*/
|
||||||
|
close(): this;
|
||||||
|
/**
|
||||||
|
* Returns the largest duration of the longest AudioBuffer.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _maxDuration;
|
||||||
|
/**
|
||||||
|
* Returns the largest number of channels in an array of AudioBuffers.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _maxNumberOfChannels;
|
||||||
|
/**
|
||||||
|
* Returns the sum of the lengths of an array of AudioBuffers.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _totalLength;
|
||||||
|
/**
|
||||||
|
* Returns whether the browser supports the Web Audio API.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _isSupported;
|
||||||
|
/**
|
||||||
|
* Writes the WAV headers for the specified Float32Array.
|
||||||
|
*
|
||||||
|
* Returns a DataView containing the WAV headers and file content.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _writeHeaders;
|
||||||
|
/**
|
||||||
|
* Converts a Float32Array to 16-bit PCM.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _floatTo16BitPCM;
|
||||||
|
/**
|
||||||
|
* Writes a string to a DataView at the specified offset.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _writeString;
|
||||||
|
/**
|
||||||
|
* Converts an AudioBuffer to a Float32Array.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _interleave;
|
||||||
|
/**
|
||||||
|
* Creates an HTMLAudioElement whose source is the specified Blob.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _renderAudioElement;
|
||||||
|
/**
|
||||||
|
* Creates an Object URL for the specified Blob.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
private _renderURL;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,(o=a.key,i=void 0,i=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!==n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===n(i)?i:String(i)),a)}var o,i}e.d(t,{Z:()=>u});var u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.sampleRate;o(this,e),this._context=this._createContext(n),n||(n=this._context.sampleRate),this._sampleRate=n}var t,n,a;return t=e,n=[{key:"_createContext",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:44100;return window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,new AudioContext({sampleRate:e})}},{key:"context",get:function(){return this._context}},{key:"fetchAudio",value:async function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return await Promise.all(n.map((async function(t){var n;return n=t instanceof File||t instanceof Blob?await t.arrayBuffer():await fetch(t).then((function(e){return e.headers.has("Content-Type")&&!e.headers.get("Content-Type").includes("audio/")&&console.warn("Crunker: Attempted to fetch an audio file, but its MIME type is `".concat(e.headers.get("Content-Type").split(";")[0],"`. We'll try and continue anyway. (file: \"").concat(t,'")')),e.arrayBuffer()})),await e._context.decodeAudioData(n)})))}},{key:"mergeAudio",value:function(e){var t=this._context.createBuffer(this._maxNumberOfChannels(e),this._sampleRate*this._maxDuration(e),this._sampleRate);return e.forEach((function(e){for(var n=0;n<e.numberOfChannels;n++){for(var r=t.getChannelData(n),a=e.getChannelData(n),o=e.getChannelData(n).length-1;o>=0;o--)r[o]+=a[o];t.getChannelData(n).set(r)}})),t}},{key:"concatAudio",value:function(e){var t=this._context.createBuffer(this._maxNumberOfChannels(e),this._totalLength(e),this._sampleRate),n=0;return e.forEach((function(e){for(var r=0;r<e.numberOfChannels;r++)t.getChannelData(r).set(e.getChannelData(r),n);n+=e.length})),t}},{key:"padAudio",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0===n)return e;if(t<0)throw new Error('Crunker: Parameter "padStart" in padAudio must be positive');if(n<0)throw new Error('Crunker: Parameter "seconds" in padAudio must be positive');for(var r=this._context.createBuffer(e.numberOfChannels,Math.ceil(e.length+n*e.sampleRate),e.sampleRate),a=0;a<e.numberOfChannels;a++){var o=e.getChannelData(a);r.getChannelData(a).set(o.subarray(0,Math.ceil(t*e.sampleRate)+1),0),r.getChannelData(a).set(o.subarray(Math.ceil(t*e.sampleRate)+2,r.length+1),Math.ceil((t+n)*e.sampleRate))}return r}},{key:"sliceAudio",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(t>=n)throw new Error('Crunker: "start" time should be less than "end" time in sliceAudio method');for(var o=Math.round((n-t)*this._sampleRate),i=Math.round(t*this._sampleRate),u=this._context.createBuffer(e.numberOfChannels,o,this._sampleRate),l=0;l<e.numberOfChannels;l++)for(var s=e.getChannelData(l),c=u.getChannelData(l),f=0;f<o;f++)c[f]=s[i+f],f<r*this._sampleRate&&(c[f]*=f/(r*this._sampleRate)),f>o-a*this._sampleRate&&(c[f]*=(o-f)/(a*this._sampleRate));return u}},{key:"play",value:function(e){var t=this._context.createBufferSource();return t.buffer=e,t.connect(this._context.destination),t.start(),Line truncated
|
||||||
|
//# sourceMappingURL=crunker.esm.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"crunker.esm.js","mappings":"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 truncated
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
/*! howler.js v2.2.4 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */
|
||||||
|
!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t<o._howls.length;t++)if(!o._howls[t]._webAudio)for(var r=o._howls[t]._getSoundIds(),a=0;a<r.length;a++){var u=o._howls[t]._soundById(r[a]);u&&u._node&&(u._node.volume=u._volume*e)}return o}return o._volume},mute:function(e){var o=this||n;o.ctx||_(),o._muted=e,o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e?0:o._volume,n.ctx.currentTime);for(var t=0;t<o._howls.length;t++)if(!o._howls[t]._webAudio)for(var r=o._howls[t]._getSoundIds(),a=0;a<r.length;a++){var u=o._howls[t]._soundById(r[a]);u&&u._node&&(u._node.muted=!!e||u._muted)}return o},stop:function(){for(var e=this||n,o=0;o<e._howls.length;o++)e._howls[o].stop();return e},unload:function(){for(var e=this||n,o=e._howls.length-1;o>=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/(\d+)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length<e.html5PoolSize;)try{var t=new Audio;t._unlocked=!0,e._releaseHtml5Audio(t)}catch(n){e.noAudio=!0;break}for(var r=0;r<e._howls.length;r++)if(!e._howls[r]._webAudio)for(var a=e._howls[r]._getSoundIds(),u=0;u<a.length;u++){var d=e._howls[r]._soundById(a[u]);d&&d._node&&!d._node._unlocked&&(d._node._unlocked=!0,d._node.load())}e._autoResume();var i=e.ctx.createBufferSource();i.buffer=e._scratchBuffer,i.connect(e.ctx.destination),void 0===i.start?i.noteOn(0):i.start(0),"function"==typeof e.ctx.resume&&e.ctx.resume(),i.onended=function(){i.disconnect(0),e._audioUnlocked=!0,document.removeEventListener("touchstart",o,!0),document.removeEventListener("touchend",o,!0),document.removeEventListener("click",o,!0),document.removeEventListener("keydown",o,!0);for(var n=0;n<e._howls.length;n++)e._howls[n]._emit("unlock")}};return document.addEventListener("touchstart",o,!0),document.addEventListener("touchend",o,!0),document.addEventListener("click",o,!0),document.addEventListener("keydown",o,!0),e}},_obtainHtml5Audio:function(){var e=this||n;if(e._html5AudioPool.length)return e._html5AudioPool.pop();var o=(new Audio).play();return o&&"undefined"!=typeof Promise&&(o instanceof Promise||"function"==typeof o.then)&&o.catch(function(){console.warn("HTML5 Audio pool eLine truncated
|
||||||
|
/*! Spatial Plugin */
|
||||||
|
!function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var p=a._orientation;return n="number"!=typeof n?p[1]:n,t="number"!=typeof t?p[2]:t,r="number"!=typeof r?p[3]:r,o="number"!=typeof o?p[4]:o,i="number"!=typeof i?p[5]:i,"number"!=typeof e?p:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a<i.length;a++){var p=r._soundById(i[a]);if(p){if("number"!=typeof n)return p._stereo;p._stereo=n,p._pos=[n,0,0],p._node&&(p._pannerAttr.panningModel="equalpower",p._panner&&p._panner.pan||e(p,o),"spatial"===o?void 0!==p._panner.positionX?(p._panner.positionX.setValueAtTime(n,Howler.ctx.currentTime),p._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),p._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):p._panner.setPosition(n,0,0):p._panner.pan.setValueAtTime(n,Howler.ctx.currentTime)),r._emit("stereo",p._id)}}return r},Howl.prototype.pos=function(n,t,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(n,t,r,o)}}),i;if(t="number"!=typeof t?0:t,r="number"!=typeof r?-.5:r,void 0===o){if("number"!=typeof n)return i._pos;i._pos=[n,t,r]}for(var a=i._getSoundIds(o),p=0;p<a.length;p++){var s=i._soundById(a[p]);if(s){if("number"!=typeof n)return s._pos;s._pos=[n,t,r],s._node&&(s._panner&&!s._panner.pan||e(s,"spatial"),void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(n,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(t,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):s._panner.setPosition(n,t,r)),i._emit("pos",s._id)}}return i},Howl.prototype.orientation=function(n,t,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(n,t,r,o)}}),i;if(t="number"!=typeof t?i._orientation[1]:t,r="number"!=typeof r?i._orientation[2]:r,void 0===o){if("number"!=typeof n)return i._orientation;i._orientation=[n,t,r]}for(var a=i._getSoundIds(o),p=0;p<a.length;p++){var s=i._soundById(a[p]);if(s){if("number"!=typeof n)return s._orientation;s._orientation=[n,t,r],s._node&&(s._panner||(s._pos||(s._pos=i._pos||[0,0,-.5]),e(s,"spatial")),void 0!==s._panner.orientationX?(s._panner.orientationX.setValueAtTime(n,Howler.ctx.currentTime),s._panner.orientationY.setValueAtTime(t,Howler.ctx.currentTime),s._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):s._panner.setOrientation(n,t,r)),i._emit("orientation",s._id)}}return i},Howl.prototype.pannerAttr=function(){var n,t,r,o=this,i=arguments;if(!o._webAudioLine truncated
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/*! For license information please see 1995fcd6d39cade7d871.js.LICENSE.txt */
|
||||||
|
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new G(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",v={};function m(){}function g(){}function w(){}var x={};l(x,a,(function(){return this}));var E=Object.getPrototypeOf,b=E&&E(E(B([])));b&&b!==r&&n.call(b,a)&&(x=b);var T=w.prototype=m.prototype=Object.create(x);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==_typeof(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=h;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?d:p,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function B(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(_typeof(e)+" is not iterable")}return g.prototype=w,o(T,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:g,configurable:!0}),g.displayName=l(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},_(L.prototype),l(L.prototype,c,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(T),l(T,u,"Generator"),l(T,a,(function(){return this})),l(T,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=B,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryELine truncated
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||||
|
* See LICENSE in the project root for license information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-welcome__header {
|
||||||
|
padding: 20px;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
padding-top: 100px;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
-webkit-flex-direction: column;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-welcome__main {
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
-webkit-flex-direction: column;
|
||||||
|
flex-direction: column;
|
||||||
|
-webkit-flex-wrap: nowrap;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
-webkit-align-items: center;
|
||||||
|
align-items: center;
|
||||||
|
-webkit-flex: 1 0 0;
|
||||||
|
flex: 1 0 0;
|
||||||
|
padding: 10px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-welcome__main > h2 {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-welcome__features {
|
||||||
|
list-style-type: none;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-welcome__features.ms-List .ms-ListItem {
|
||||||
|
padding-bottom: 20px;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-welcome__features.ms-List .ms-ListItem > .ms-Icon {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-welcome__action.ms-Button--hero {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-Button.ms-Button--hero .ms-Button-label {
|
||||||
|
color: #0078d7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-Button.ms-Button--hero:hover .ms-Button-label,
|
||||||
|
.ms-Button.ms-Button--hero:focus .ms-Button-label{
|
||||||
|
color: #005a9e;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
b {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 839 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 99 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<!doctype html><html><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=Edge"/><script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script><script defer="defer" src="polyfill.js"></script><script defer="defer" src="commands.js"></script></head><body></body></html>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
!function(){var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),Office.onReady((function(){})),("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:void 0).action=function(e){var n={type:Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,message:"Performed action.",icon:"Icon.80x80",persistent:!0};Office.context.mailbox.item.notificationMessages.replaceAsync("action",n),e.completed()}}();
|
||||||
|
//# sourceMappingURL=commands.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"commands.js","mappings":"YACA,IAAIA,EAAsB,CAAC,ECD3BA,EAAoBC,EAAI,WACvB,GAA0B,iBAAfC,WAAyB,OAAOA,WAC3C,IACC,OAAOC,MAAQ,IAAIC,SAAS,cAAb,EAChB,CAAE,MAAOC,GACR,GAAsB,iBAAXC,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCOxBC,OAAOC,SAAQ,WACb,KAuBuB,oBAATC,KACVA,KACkB,oBAAXH,OACPA,YACkB,IAAXI,EAAAA,EACPA,EAAAA,OACAC,GAMJC,OA5BF,SAAgBC,GACd,IAAMC,EAAU,CACdC,KAAMR,OAAOS,aAAaC,4BAA4BC,qBACtDJ,QAAS,oBACTK,KAAM,aACNC,YAAY,GAIdb,OAAOc,QAAQC,QAAQC,KAAKC,qBAAqBC,aAAa,SAAUX,GAGxED,EAAMa,WACR,C","sources":["webpack://office-addin-taskpane-js/webpack/bootstrap","webpack://office-addin-taskpane-js/webpack/runtime/global","webpack://office-addin-taskpane-js/./src/commands/commands.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","/*\n * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n * See LICENSE in the project root for license information.\n */\n\n/* global global, Office, self, window */\n\nOffice.onReady(() => {\n // If needed, Office.js is ready to be called\n});\n\n/**\n * Shows a notification when the add-in command is executed.\n * @param event {Office.AddinCommands.Event}\n */\nfunction action(event) {\n const message = {\n type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,\n message: \"Performed action.\",\n icon: \"Icon.80x80\",\n persistent: true,\n };\n\n // Show a notification message\n Office.context.mailbox.item.notificationMessages.replaceAsync(\"action\", message);\n\n // Be sure to indicate when the add-in command function is complete\n event.completed();\n}\n\nfunction getGlobal() {\n return typeof self !== \"undefined\"\n ? self\n : typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : undefined;\n}\n\nconst g = getGlobal();\n\n// The add-in command functions need to be available in global scope\ng.action = action;\n"],"names":["__webpack_require__","g","globalThis","this","Function","e","window","Office","onReady","self","global","undefined","action","event","message","type","MailboxEnums","ItemNotificationMessageType","InformationalMessage","icon","persistent","context","mailbox","item","notificationMessages","replaceAsync","completed"],"sourceRoot":""}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
|
||||||
|
<Id>68b6ad53-4f72-42a8-a971-a9643c2f409a</Id>
|
||||||
|
<Version>1.0.0.0</Version>
|
||||||
|
<ProviderName>AllTalk</ProviderName>
|
||||||
|
<DefaultLocale>en-US</DefaultLocale>
|
||||||
|
<DisplayName DefaultValue="AllTalk TTS"/>
|
||||||
|
<Description DefaultValue="Enhance your document creation with AllTalk TTS's advanced text-to-voice functionality. Requires connection to AllTalk server."/>
|
||||||
|
<IconUrl DefaultValue="http://127.0.0.1:7851/api/word_addin/assets/icon-32.png"/>
|
||||||
|
<HighResolutionIconUrl DefaultValue="http://127.0.0.1:7851/api/word_addin/assets/icon-64.png"/>
|
||||||
|
<SupportUrl DefaultValue="https://github.com/erew123/alltalk_tts/issues"/>
|
||||||
|
<AppDomains>
|
||||||
|
<AppDomain>https://www.contoso.com</AppDomain>
|
||||||
|
</AppDomains>
|
||||||
|
<Hosts>
|
||||||
|
<Host Name="Document"/>
|
||||||
|
</Hosts>
|
||||||
|
<DefaultSettings>
|
||||||
|
<SourceLocation DefaultValue="http://127.0.0.1:7851/api/word_addin/taskpane.html"/>
|
||||||
|
</DefaultSettings>
|
||||||
|
<Permissions>ReadWriteDocument</Permissions>
|
||||||
|
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
|
||||||
|
<Hosts>
|
||||||
|
<Host xsi:type="Document">
|
||||||
|
<DesktopFormFactor>
|
||||||
|
<!-- You can add GetStarted information here if needed -->
|
||||||
|
<FunctionFile resid="Commands.Url"/>
|
||||||
|
<ExtensionPoint xsi:type="PrimaryCommandSurface">
|
||||||
|
<OfficeTab id="TabHome">
|
||||||
|
<Group id="AllTalkGroup">
|
||||||
|
<Label resid="AllTalkGroup.Label"/>
|
||||||
|
<Icon>
|
||||||
|
<bt:Image size="16" resid="Icon.16x16"/>
|
||||||
|
<bt:Image size="32" resid="Icon.32x32"/>
|
||||||
|
<bt:Image size="80" resid="Icon.80x80"/>
|
||||||
|
</Icon>
|
||||||
|
<Control xsi:type="Button" id="AllTalkTaskpaneButton">
|
||||||
|
<Label resid="AllTalkTaskpaneButton.Label"/>
|
||||||
|
<Supertip>
|
||||||
|
<Title resid="AllTalkTaskpaneButton.Label"/>
|
||||||
|
<Description resid="AllTalkTaskpaneButton.Tooltip"/>
|
||||||
|
</Supertip>
|
||||||
|
<Icon>
|
||||||
|
<bt:Image size="16" resid="Icon.16x16"/>
|
||||||
|
<bt:Image size="32" resid="Icon.32x32"/>
|
||||||
|
<bt:Image size="80" resid="Icon.80x80"/>
|
||||||
|
</Icon>
|
||||||
|
<Action xsi:type="ShowTaskpane">
|
||||||
|
<TaskpaneId>ButtonId1</TaskpaneId>
|
||||||
|
<SourceLocation resid="Taskpane.Url"/>
|
||||||
|
</Action>
|
||||||
|
</Control>
|
||||||
|
</Group>
|
||||||
|
</OfficeTab>
|
||||||
|
</ExtensionPoint>
|
||||||
|
</DesktopFormFactor>
|
||||||
|
</Host>
|
||||||
|
</Hosts>
|
||||||
|
<Resources>
|
||||||
|
<bt:Images>
|
||||||
|
<bt:Image id="Icon.16x16" DefaultValue="http://127.0.0.1:7851/api/word_addin/assets/icon-16.png"/>
|
||||||
|
<bt:Image id="Icon.32x32" DefaultValue="http://127.0.0.1:7851/api/word_addin/assets/icon-32.png"/>
|
||||||
|
<bt:Image id="Icon.80x80" DefaultValue="http://127.0.0.1:7851/api/word_addin/assets/icon-80.png"/>
|
||||||
|
</bt:Images>
|
||||||
|
<bt:Urls>
|
||||||
|
<!-- Ensure that these URLs are pointing to valid locations -->
|
||||||
|
<bt:Url id="Commands.Url" DefaultValue="http://127.0.0.1:7851/api/word_addin/commands.html"/>
|
||||||
|
<bt:Url id="Taskpane.Url" DefaultValue="http://127.0.0.1:7851/api/word_addin/taskpane.html"/>
|
||||||
|
</bt:Urls>
|
||||||
|
<bt:ShortStrings>
|
||||||
|
<bt:String id="AllTalkGroup.Label" DefaultValue="AllTalk Controls"/>
|
||||||
|
<bt:String id="AllTalkTaskpaneButton.Label" DefaultValue="Open AllTalk"/>
|
||||||
|
</bt:ShortStrings>
|
||||||
|
<bt:LongStrings>
|
||||||
|
<bt:String id="AllTalkTaskpaneButton.Tooltip" DefaultValue="Open the AllTalk task pane to start using the add-in."/>
|
||||||
|
</bt:LongStrings>
|
||||||
|
</Resources>
|
||||||
|
</VersionOverrides>
|
||||||
|
</OfficeApp>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
!function(){var t={35666:function(t){var r=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var o=r&&r.prototype instanceof y?r:y,u=Object.create(o.prototype),a=new j(n||[]);return i(u,"_invoke",{value:R(t,e,a)}),u}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h="suspendedStart",p="suspendedYield",v="executing",g="completed",d={};function y(){}function m(){}function b(){}var x={};s(x,u,(function(){return this}));var w=Object.getPrototypeOf,E=w&&w(w(P([])));E&&E!==e&&n.call(E,u)&&(x=E);var S=b.prototype=y.prototype=Object.create(x);function A(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function O(t,r){function e(i,o,u,a){var c=l(t[i],t,o);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,u,a)}),(function(t){e("throw",t,u,a)})):r.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return e("throw",t,u,a)}))}a(c.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new r((function(r,i){e(t,n,r,i)}))}return o=o?o.then(i,i):i()}})}function R(t,r,e){var n=h;return function(i,o){if(n===v)throw new Error("Generator is already running");if(n===g){if("throw"===i)throw o;return k()}for(e.method=i,e.arg=o;;){var u=e.delegate;if(u){var a=T(u,e);if(a){if(a===d)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===h)throw n=g,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=v;var c=l(t,r,e);if("normal"===c.type){if(n=e.done?g:p,c.arg===d)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n=g,e.method="throw",e.arg=c.arg)}}}function T(t,e){var n=e.method,i=t.iterator[n];if(i===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,T(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=l(i,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var u=o.arg;return u?u.done?(e[t.resultName]=u.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):u:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function I(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function M(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function P(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i<t.length;)if(n.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=r,e.done=!0,e};return o.next=o}}return{next:k}}function k(){return{value:r,done:!0}}return m.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:m,configurable:!0}),m.displayName=s(b,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,c,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},A(O.prototype),s(O.prototype,a,(function(){return this})),t.AsyncIterator=O,t.async=function(r,e,n,i,o){void 0===o&&(o=Promise);var u=new O(f(r,e,n,i),o);return t.isGeneratorFunction(e)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},A(S),s(S,c,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=P,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(n,i){return a.type="throw",a.arg=t,e.next=n,i&&(e.method="next",e.arg=r),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],aLine truncated
|
||||||
|
//# sourceMappingURL=polyfill.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"polyfill.js","mappings":"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 truncated
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<title>AllTalk TTS Add-in</title>
|
||||||
|
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script>
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css" />
|
||||||
|
<link href="1fda685b81e1123773f6.css" rel="stylesheet" />
|
||||||
|
<style>
|
||||||
|
label {
|
||||||
|
font-weight: 700;
|
||||||
|
display: block;
|
||||||
|
margin-top: 10px
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
width: 100%;
|
||||||
|
padding: 5px
|
||||||
|
}
|
||||||
|
|
||||||
|
.nice-button {
|
||||||
|
background-color: #0078d4;
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
transition: background-color .3s ease
|
||||||
|
}
|
||||||
|
|
||||||
|
.nice-button:hover {
|
||||||
|
background-color: #005a9e
|
||||||
|
}
|
||||||
|
|
||||||
|
#audioSource {
|
||||||
|
width: 300px;
|
||||||
|
height: 50px
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-right: 10px
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
display: flex;
|
||||||
|
justify-content: start;
|
||||||
|
align-items: flex-end
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group>.input-container {
|
||||||
|
flex: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script defer="defer" src="polyfill.js"></script>
|
||||||
|
<script defer="defer" src="taskpane.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="ms-font-m ms-welcome ms-Fabric">
|
||||||
|
<header class="ms-welcome__header ms-bgColor-neutralLighter"><img width="90" height="90"
|
||||||
|
src="http://127.0.0.1:7851/api/word_addin/assets/logo-filled.png" alt="AllTalk TTS" title="AllTalk TTS" />
|
||||||
|
<h1 class="ms-font-su">AllTalk TTS</h1>
|
||||||
|
</header>
|
||||||
|
<main class="ms-welcome__main"><textarea id="text" rows="4" placeholder="Enter text here"
|
||||||
|
style="display:none"></textarea> <label for="voice">Voice:</label> <select id="voice" name="voice"
|
||||||
|
required></select> <label for="language">Language:</label> <select id="language" name="language"
|
||||||
|
value="English" required>
|
||||||
|
<option value="en" selected="selected">English</option>
|
||||||
|
<option value="ar">Arabic</option>
|
||||||
|
<option value="zh-cn">Chinese</option>
|
||||||
|
<option value="cs">Czech</option>
|
||||||
|
<option value="nl">Dutch</option>
|
||||||
|
<option value="fr">French</option>
|
||||||
|
<option value="de">German</option>
|
||||||
|
<option value="hu">Hungarian</option>
|
||||||
|
<option value="it">Italian</option>
|
||||||
|
<option value="ja">Japanese</option>
|
||||||
|
<option value="ko">Korean</option>
|
||||||
|
<option value="pl">Polish</option>
|
||||||
|
<option value="pt">Portuguese</option>
|
||||||
|
<option value="ru">Russian</option>
|
||||||
|
<option value="es">Spanish</option>
|
||||||
|
<option value="tr">Turkish</option>
|
||||||
|
</select><br><audio id="audioSource" controls autoplay></audio><br><button id="sendTextButton"
|
||||||
|
class="nice-button">Send Text to TTS</button><br><br><br><br>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-container"><label for="serverIP">Server IP:</label> <input id="serverIP" name="serverIP"
|
||||||
|
value="127.0.0.1" required></div>
|
||||||
|
<div class="input-container"><label for="portNumber">Port Number:</label> <input type="number"
|
||||||
|
id="portNumber" name="portNumber" value="7851" required></div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<script src="1995fcd6d39cade7d871.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/*! For license information please see taskpane.js.LICENSE.txt */
|
||||||
|
!function(){var t={27091:function(t){"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),e.hash&&(t+=e.hash),e.maybeNeedQuotes&&/[\t\n\f\r "'=<>`]/.test(t)?'"'.concat(t,'"'):t):t}},44944:function(t,e,r){"use strict";t.exports=r.p+"assets/logo-filled.png"},36076:function(t,e,r){"use strict";t.exports=r.p+"1995fcd6d39cade7d871.js"},60806:function(t,e,r){"use strict";t.exports=r.p+"1fda685b81e1123773f6.css"}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.m=t,r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){var t;r.g.importScripts&&(t=r.g.location+"");var e=r.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&!t;)t=n[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=t}(),r.b=document.baseURI||self.location.href,function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(){"use strict";e=function(){return n};var r,n={},o=Object.prototype,i=o.hasOwnProperty,c=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",f=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(r){l=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,i=Object.create(o.prototype),a=new k(n||[]);return c(i,"_invoke",{value:I(t,r,a)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var y="suspendedStart",v="suspendedYield",d="executing",m="completed",g={};function w(){}function b(){}function x(){}var E={};l(E,u,(function(){return this}));var L=Object.getPrototypeOf,_=L&&L(L(T([])));_&&_!==o&&i.call(_,u)&&(E=_);var j=x.prototype=w.prototype=Object.create(E);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(e,r){function n(o,c,a,u){var f=p(e[o],e,c);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==t(l)&&i.call(l,"__await")?r.resolve(l.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):r.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(f.arg)}var o;c(this,"_invoke",{value:function(t,e){function i(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(i,i):i()}})}function I(t,e,n){var o=y;return function(i,c){if(o===d)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw c;return{value:r,done:!0}}for(n.method=i,n.arg=c;;){var a=n.delegate;if(a){var u=P(a,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=p(t,e,n);if("normal"===f.type){if(o=n.done?m:v,f.arg===g)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=m,n.method="throw",n.arg=f.arg)}}}function P(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,P(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var c=i.arg;return c?c.done?(e[t.resultName]=c.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):c:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function T(e){if(e||""===e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,c=function t(){for(;++o<e.length;)if(i.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return c.next=c}}throw new TLine truncated
|
||||||
|
//# sourceMappingURL=taskpane.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"taskpane.js","mappings":"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 truncated
|
||||||
@@ -81,6 +81,17 @@ else:
|
|||||||
f"[{params['branding']}Startup] \033[91mWarning\033[0m modeldownload.config is missing so please re-download it and save it in the alltalk_tts main folder."
|
f"[{params['branding']}Startup] \033[91mWarning\033[0m modeldownload.config is missing so please re-download it and save it in the alltalk_tts main folder."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
#### Check to see if a finetuned model exists ####
|
||||||
|
##################################################
|
||||||
|
# Set the path to the directory
|
||||||
|
trained_model_directory = this_dir / "models" / "trainedmodel"
|
||||||
|
# Check if the directory "trainedmodel" exists
|
||||||
|
finetuned_model = trained_model_directory.exists()
|
||||||
|
# If the directory exists, check for the existence of the required files
|
||||||
|
if finetuned_model:
|
||||||
|
required_files = ["model.pth", "config.json", "vocab.json"]
|
||||||
|
finetuned_model = all((trained_model_directory / file).exists() for file in required_files)
|
||||||
|
|
||||||
########################
|
########################
|
||||||
#### STARTUP CHECKS ####
|
#### STARTUP CHECKS ####
|
||||||
@@ -98,19 +109,17 @@ except ModuleNotFoundError:
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
# DEEPSPEED Import - Check for DeepSpeed and import it if it exists
|
# DEEPSPEED Import - Check for DeepSpeed and import it if it exists
|
||||||
|
deepspeed_available = False
|
||||||
try:
|
try:
|
||||||
import deepspeed
|
import deepspeed
|
||||||
|
deepspeed_available = True
|
||||||
deepspeed_installed = True
|
|
||||||
print(f"[{params['branding']}Startup] DeepSpeed \033[93mDetected\033[0m")
|
|
||||||
print(
|
|
||||||
f"[{params['branding']}Startup] Activate DeepSpeed in {params['branding']} settings"
|
|
||||||
)
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
deepspeed_installed = False
|
pass
|
||||||
print(
|
if deepspeed_available:
|
||||||
f"[{params['branding']}Startup] DeepSpeed \033[93mNot Detected\033[0m. See https://github.com/microsoft/DeepSpeed"
|
print(f"[{params['branding']}Startup] DeepSpeed \033[93mDetected\033[0m")
|
||||||
)
|
print(f"[{params['branding']}Startup] Activate DeepSpeed in {params['branding']}settings")
|
||||||
|
else:
|
||||||
|
print(f"[{params['branding']}Startup] DeepSpeed \033[93mNot Detected\033[0m. See https://github.com/microsoft/DeepSpeed")
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
@@ -729,6 +738,11 @@ async def tts_demo_request(request: Request, text: str = Form(...), voice: str =
|
|||||||
print(f"An error occurred: {e}")
|
print(f"An error occurred: {e}")
|
||||||
return JSONResponse(content={"error": "An error occurred"}, status_code=500)
|
return JSONResponse(content={"error": "An error occurred"}, status_code=500)
|
||||||
|
|
||||||
|
|
||||||
|
#####################
|
||||||
|
#### Audio feeds ####
|
||||||
|
#####################
|
||||||
|
|
||||||
# Gives web access to the output files
|
# Gives web access to the output files
|
||||||
@app.get("/audio/{filename}")
|
@app.get("/audio/{filename}")
|
||||||
async def get_audio(filename: str):
|
async def get_audio(filename: str):
|
||||||
@@ -807,6 +821,35 @@ import uuid
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import soundfile as sf
|
import soundfile as sf
|
||||||
import sys
|
import sys
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
##############################
|
||||||
|
#### Streaming Generation ####
|
||||||
|
##############################
|
||||||
|
|
||||||
|
@app.get("/api/tts-generate-streaming", response_class=StreamingResponse)
|
||||||
|
async def tts_generate_streaming(text: str, voice: str, language: str, output_file: str):
|
||||||
|
try:
|
||||||
|
output_file_path = this_dir / "outputs" / output_file
|
||||||
|
stream = await generate_audio(text, voice, language, output_file_path, streaming=True)
|
||||||
|
return StreamingResponse(stream, media_type="audio/wav")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred: {e}")
|
||||||
|
return JSONResponse(content={"error": "An error occurred"}, status_code=500)
|
||||||
|
|
||||||
|
@app.post("/api/tts-generate-streaming", response_class=JSONResponse)
|
||||||
|
async def tts_generate_streaming(request: Request, text: str = Form(...), voice: str = Form(...), language: str = Form(...), output_file: str = Form(...)):
|
||||||
|
try:
|
||||||
|
output_file_path = this_dir / "outputs" / output_file
|
||||||
|
await generate_audio(text, voice, language, output_file_path, streaming=False)
|
||||||
|
return JSONResponse(content={"output_file_path": str(output_file)}, status_code=200)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred: {e}")
|
||||||
|
return JSONResponse(content={"error": "An error occurred"}, status_code=500)
|
||||||
|
|
||||||
|
##############################
|
||||||
|
#### Standard Generation ####
|
||||||
|
##############################
|
||||||
|
|
||||||
# Check for PortAudio library on Linux
|
# Check for PortAudio library on Linux
|
||||||
try:
|
try:
|
||||||
@@ -936,8 +979,8 @@ def combine(output_file_timestamp, output_file_name, audio_files):
|
|||||||
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}_{timestamp}_combined.wav'
|
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}_{timestamp}_combined.wav'
|
||||||
else:
|
else:
|
||||||
output_file_path = os.path.join(this_dir / "outputs" / f'{output_file_name}_combined.wav')
|
output_file_path = os.path.join(this_dir / "outputs" / f'{output_file_name}_combined.wav')
|
||||||
output_file_url = f'http://{params["ip_address"]}:{params["port_number"]}/audio/{output_file_name}.wav'
|
output_file_url = f'http://{params["ip_address"]}:{params["port_number"]}/audio/{output_file_name}_combined.wav'
|
||||||
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}.wav'
|
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}_combined.wav'
|
||||||
try:
|
try:
|
||||||
sf.write(output_file_path, audio, samplerate=sample_rate)
|
sf.write(output_file_path, audio, samplerate=sample_rate)
|
||||||
# Clean up unnecessary files
|
# Clean up unnecessary files
|
||||||
@@ -1006,7 +1049,7 @@ async def tts_generate(
|
|||||||
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
# Replace multiple exclamation marks, question marks, or other punctuation with a single instance
|
||||||
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
cleaned_part = re.sub(r'([!?.])\1+', r'\1', part)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_part)
|
cleaned_part = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\u0150\u0151\u0170\u0171]\$', '', cleaned_part)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
cleaned_part = re.sub(r'\n+', ' ', cleaned_part)
|
||||||
output_file = this_dir / "outputs" / f"{output_file_name}_{uuid.uuid4()}_{int(time.time())}.wav"
|
output_file = this_dir / "outputs" / f"{output_file_name}_{uuid.uuid4()}_{int(time.time())}.wav"
|
||||||
@@ -1019,24 +1062,31 @@ async def tts_generate(
|
|||||||
else:
|
else:
|
||||||
if output_file_timestamp:
|
if output_file_timestamp:
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
output_file_path = this_dir / "outputs" / f"{output_file_name}_{timestamp}.wav"
|
# Generate a standard UUID
|
||||||
output_file_url = f'http://{params["ip_address"]}:{params["port_number"]}/audio/{output_file_name}_{timestamp}.wav'
|
original_uuid = uuid.uuid4()
|
||||||
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}_{timestamp}.wav'
|
# Hash the UUID using SHA-256
|
||||||
|
hash_object = hashlib.sha256(str(original_uuid).encode())
|
||||||
|
hashed_uuid = hash_object.hexdigest()
|
||||||
|
# Truncate to the desired length, for example, 16 characters
|
||||||
|
short_uuid = hashed_uuid[:5]
|
||||||
|
output_file_path = this_dir / "outputs" / f"{output_file_name}_{timestamp}{short_uuid}.wav"
|
||||||
|
output_file_url = f'http://{params["ip_address"]}:{params["port_number"]}/audio/{output_file_name}_{timestamp}{short_uuid}.wav'
|
||||||
|
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}_{timestamp}{short_uuid}.wav'
|
||||||
else:
|
else:
|
||||||
output_file_path = this_dir / "outputs" / f"{output_file_name}.wav"
|
output_file_path = this_dir / "outputs" / f"{output_file_name}.wav"
|
||||||
output_file_url = f'http://{params["ip_address"]}:{params["port_number"]}/audio/{output_file_name}.wav'
|
output_file_url = f'http://{params["ip_address"]}:{params["port_number"]}/audio/{output_file_name}.wav'
|
||||||
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}_{timestamp}.wav'
|
output_cache_url = f'http://{params["ip_address"]}:{params["port_number"]}/audiocache/{output_file_name}.wav'
|
||||||
if text_filtering == "html":
|
if text_filtering == "html":
|
||||||
cleaned_string = html.unescape(standard_filtering(text_input))
|
cleaned_string = html.unescape(standard_filtering(text_input))
|
||||||
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_string)
|
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\u0150\u0151\u0170\u0171]\$', '', cleaned_string)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
||||||
elif text_filtering == "standard":
|
elif text_filtering == "standard":
|
||||||
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
cleaned_string = re.sub(r'([!?.])\1+', r'\1', text_input)
|
||||||
# Further clean to remove any other unwanted characters
|
# Further clean to remove any other unwanted characters
|
||||||
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"]', '', cleaned_string)
|
cleaned_string = re.sub(r'[^a-zA-Z0-9\s\.,;:!?\-\'"\u0400-\u04FFÀ-ÿ\u0150\u0151\u0170\u0171]\$', '', cleaned_string)
|
||||||
# Remove all newline characters (single or multiple)
|
# Remove all newline characters (single or multiple)
|
||||||
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
cleaned_string = re.sub(r'\n+', ' ', cleaned_string)
|
||||||
else:
|
else:
|
||||||
@@ -1052,6 +1102,45 @@ async def tts_generate(
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return JSONResponse(content={"status": "generate-failure", "error": "An error occurred"}, status_code=500)
|
return JSONResponse(content={"status": "generate-failure", "error": "An error occurred"}, status_code=500)
|
||||||
|
|
||||||
|
|
||||||
|
##########################
|
||||||
|
#### Current Settings ####
|
||||||
|
##########################
|
||||||
|
# Define the available models
|
||||||
|
models_available = [
|
||||||
|
{"name": "Coqui", "model_name": "API TTS"},
|
||||||
|
{"name": "Coqui", "model_name": "API Local"},
|
||||||
|
{"name": "Coqui", "model_name": "XTTSv2 Local"}
|
||||||
|
]
|
||||||
|
|
||||||
|
@app.get('/api/currentsettings')
|
||||||
|
def get_current_settings():
|
||||||
|
# Determine the current model loaded
|
||||||
|
if params["tts_method_api_tts"]:
|
||||||
|
current_model_loaded = "API TTS"
|
||||||
|
elif params["tts_method_api_local"]:
|
||||||
|
current_model_loaded = "API Local"
|
||||||
|
elif params["tts_method_xtts_local"]:
|
||||||
|
current_model_loaded = "XTTSv2 Local"
|
||||||
|
else:
|
||||||
|
current_model_loaded = None # or a default value if no method is active
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
"models_available": models_available,
|
||||||
|
"current_model_loaded": current_model_loaded,
|
||||||
|
"deepspeed_available": deepspeed_available,
|
||||||
|
"deepspeed_status": params["deepspeed_activate"],
|
||||||
|
"low_vram_status": params["low_vram"],
|
||||||
|
"finetuned_model": finetuned_model
|
||||||
|
}
|
||||||
|
return settings # Automatically converted to JSON by Fas
|
||||||
|
|
||||||
|
#############################
|
||||||
|
#### Word Add-in Sharing ####
|
||||||
|
#############################
|
||||||
|
# Mount the static files from the 'word_addin' directory
|
||||||
|
app.mount("/api/word_addin", StaticFiles(directory=os.path.join(this_dir / 'templates' / 'word_addin')), name="word_addin")
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
#### Webserver Startup & Initial model Loading ####
|
#### Webserver Startup & Initial model Loading ####
|
||||||
###################################################
|
###################################################
|
||||||
@@ -1080,8 +1169,8 @@ async def read_root():
|
|||||||
return HTMLResponse(content=rendered_html, status_code=200)
|
return HTMLResponse(content=rendered_html, status_code=200)
|
||||||
|
|
||||||
# Start Uvicorn Webserver
|
# Start Uvicorn Webserver
|
||||||
host_parameter = {params["ip_address"]}
|
host_parameter = params["ip_address"]
|
||||||
port_parameter = str(params["port_number"])
|
port_parameter = int(params["port_number"])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|||||||