Sebastian commited on
Commit
11287fd
·
1 Parent(s): 8d2bed0
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. .github/FUNDING.yml +13 -0
  3. .gitignore +135 -0
  4. CITATION.cff +10 -0
  5. LICENSE +201 -0
  6. MANIFEST.in +2 -0
  7. app.py +146 -0
  8. app_read.py +204 -0
  9. examples/favorite_riding_hood.mp3 +3 -0
  10. examples/favorites/atkins_mha.mp3 +3 -0
  11. examples/favorites/atkins_omicron.mp3 +3 -0
  12. examples/favorites/atkins_value.mp3 +3 -0
  13. examples/favorites/daniel_craig_dumbledore.mp3 +3 -0
  14. examples/favorites/daniel_craig_training_ethics.mp3 +3 -0
  15. examples/favorites/dotrice_stop_for_death.mp3 +3 -0
  16. examples/favorites/emma_stone_courage.mp3 +3 -0
  17. examples/favorites/emma_stone_training_ethics.mp3 +3 -0
  18. examples/favorites/halle_barry_dumbledore.mp3 +3 -0
  19. examples/favorites/halle_barry_oar_to_oar.mp3 +3 -0
  20. examples/favorites/henry_cavill_metallic_hydrogen.mp3 +3 -0
  21. examples/favorites/kennard_road_not_taken.mp3 +3 -0
  22. examples/favorites/morgan_freeman_metallic_hydrogen.mp3 +3 -0
  23. examples/favorites/myself_gatsby.mp3 +3 -0
  24. examples/favorites/patrick_stewart_omicron.mp3 +3 -0
  25. examples/favorites/patrick_stewart_secret_of_life.mp3 +3 -0
  26. examples/favorites/robert_deniro_review.mp3 +3 -0
  27. examples/favorites/william_shatner_spacecraft_interview.mp3 +3 -0
  28. examples/finetuned/lj/1.mp3 +3 -0
  29. examples/finetuned/lj/2.mp3 +3 -0
  30. examples/finetuned/lj/3.mp3 +3 -0
  31. examples/finetuned/lj/4.mp3 +3 -0
  32. examples/naturalspeech_comparison/fibers/naturalspeech.mp3 +3 -0
  33. examples/naturalspeech_comparison/fibers/tortoise.mp3 +3 -0
  34. examples/naturalspeech_comparison/lax/naturalspeech.mp3 +3 -0
  35. examples/naturalspeech_comparison/lax/tortoise.mp3 +3 -0
  36. examples/naturalspeech_comparison/maltby/naturalspeech.mp3 +3 -0
  37. examples/naturalspeech_comparison/maltby/tortoise.mp3 +3 -0
  38. examples/prompting/angry.mp3 +3 -0
  39. examples/prompting/happy.mp3 +3 -0
  40. examples/prompting/sad.mp3 +3 -0
  41. examples/prompting/scared.mp3 +3 -0
  42. examples/riding_hood/angelina.mp3 +3 -0
  43. examples/riding_hood/craig.mp3 +3 -0
  44. examples/riding_hood/deniro.mp3 +3 -0
  45. examples/riding_hood/emma.mp3 +3 -0
  46. examples/riding_hood/freeman.mp3 +3 -0
  47. examples/riding_hood/geralt.mp3 +3 -0
  48. examples/riding_hood/halle.mp3 +3 -0
  49. examples/riding_hood/jlaw.mp3 +3 -0
  50. examples/riding_hood/lj.mp3 +3 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
37
+ *.wav filter=lfs diff=lfs merge=lfs -text
.github/FUNDING.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ github: [Pranjalya]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
.gitignore ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ .idea/*
132
+ .models/*
133
+ .custom/*
134
+ results/*
135
+ debug_states/*
CITATION.cff ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.3.0
2
+ message: "If you use this software, please cite it as below."
3
+ authors:
4
+ - family-names: "Betker"
5
+ given-names: "James"
6
+ orcid: "https://orcid.org/my-orcid?orcid=0000-0003-3259-4862"
7
+ title: "TorToiSe text-to-speech"
8
+ version: 2.0
9
+ date-released: 2022-04-28
10
+ url: "https://github.com/neonbjb/tortoise-tts"
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
MANIFEST.in ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ recursive-include tortoise/data *
2
+ recursive-include tortoise/voices *
app.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import torchaudio
4
+ import time
5
+ from datetime import datetime
6
+ from tortoise.api import TextToSpeech
7
+ from tortoise.utils.audio import load_audio, load_voice, load_voices
8
+
9
+ VOICE_OPTIONS = [
10
+ "random", # special option for random voice
11
+ "custom_voice", # special option for custom voice
12
+ "disabled", # special option for disabled voice
13
+ ]
14
+
15
+
16
+ def inference(text, emotion, prompt, voice, mic_audio, voice_b, voice_c, preset, seed):
17
+ if voice != "custom_voice":
18
+ voices = [voice]
19
+ else:
20
+ voices = []
21
+
22
+ if voice_b != "disabled":
23
+ voices.append(voice_b)
24
+ if voice_c != "disabled":
25
+ voices.append(voice_c)
26
+
27
+ if emotion != "None/Custom":
28
+ text = f"[I am really {emotion.lower()},] {text}"
29
+ elif prompt.strip() != "":
30
+ text = f"[{prompt},] {text}"
31
+
32
+ c = None
33
+ if voice == "custom_voice":
34
+ if mic_audio is None:
35
+ raise gr.Error("Please provide audio from mic when choosing custom voice")
36
+ c = load_audio(mic_audio, 22050)
37
+
38
+
39
+ if len(voices) == 1 or len(voices) == 0:
40
+ if voice == "custom_voice":
41
+ voice_samples, conditioning_latents = [c], None
42
+ else:
43
+ voice_samples, conditioning_latents = load_voice(voice)
44
+ else:
45
+ voice_samples, conditioning_latents = load_voices(voices)
46
+ if voice == "custom_voice":
47
+ voice_samples.extend([c])
48
+
49
+ sample_voice = voice_samples[0] if len(voice_samples) else None
50
+
51
+ start_time = time.time()
52
+ gen, _ = tts.tts_with_preset(
53
+ text,
54
+ voice_samples=voice_samples,
55
+ conditioning_latents=conditioning_latents,
56
+ preset=preset,
57
+ use_deterministic_seed=seed,
58
+ return_deterministic_state=True,
59
+ k=3,
60
+ )
61
+
62
+ with open("Tortoise_TTS_Runs.log", "a") as f:
63
+ f.write(
64
+ f"{datetime.now()} | Voice: {','.join(voices)} | Text: {text} | Quality: {preset} | Time Taken (s): {time.time()-start_time} | Seed: {seed}\n"
65
+ )
66
+
67
+ return (
68
+ (22050, sample_voice.squeeze().cpu().numpy()),
69
+ (24000, gen[0].squeeze().cpu().numpy()),
70
+ (24000, gen[1].squeeze().cpu().numpy()),
71
+ (24000, gen[2].squeeze().cpu().numpy()),
72
+ )
73
+
74
+
75
+ def main():
76
+ text = gr.Textbox(lines=4, label="Text:")
77
+ emotion = gr.Radio(
78
+ ["None/Custom", "Happy", "Sad", "Angry", "Disgusted", "Arrogant"],
79
+ value="None/Custom",
80
+ label="Select emotion:",
81
+ type="value",
82
+ )
83
+ prompt = gr.Textbox(lines=1, label="Enter prompt if [Custom] emotion:")
84
+ preset = gr.Radio(
85
+ ["ultra_fast", "fast", "standard", "high_quality"],
86
+ value="fast",
87
+ label="Preset mode (determines quality with tradeoff over speed):",
88
+ type="value",
89
+ )
90
+ voice = gr.Dropdown(
91
+ os.listdir(os.path.join("tortoise", "voices")) + VOICE_OPTIONS,
92
+ value="angie",
93
+ label="Select voice:",
94
+ type="value",
95
+ )
96
+ mic_audio = gr.Audio(
97
+ label="Record voice (when selected custom_voice):",
98
+ source="microphone",
99
+ type="filepath",
100
+ )
101
+ voice_b = gr.Dropdown(
102
+ os.listdir(os.path.join("tortoise", "voices")) + VOICE_OPTIONS,
103
+ value="disabled",
104
+ label="(Optional) Select second voice:",
105
+ type="value",
106
+ )
107
+ voice_c = gr.Dropdown(
108
+ os.listdir(os.path.join("tortoise", "voices")) + VOICE_OPTIONS,
109
+ value="disabled",
110
+ label="(Optional) Select third voice:",
111
+ type="value",
112
+ )
113
+ seed = gr.Number(value=0, precision=0, label="Seed (for reproducibility):")
114
+
115
+ selected_voice = gr.Audio(label="Sample of selected voice (first):")
116
+ output_audio_1 = gr.Audio(label="Output [Candidate 1]:")
117
+ output_audio_2 = gr.Audio(label="Output [Candidate 2]:")
118
+ output_audio_3 = gr.Audio(label="Output [Candidate 3]:")
119
+
120
+ interface = gr.Interface(
121
+ fn=inference,
122
+ inputs=[
123
+ text,
124
+ emotion,
125
+ prompt,
126
+ voice,
127
+ mic_audio,
128
+ voice_b,
129
+ voice_c,
130
+ preset,
131
+ seed,
132
+ ],
133
+ outputs=[selected_voice, output_audio_1, output_audio_2, output_audio_3],
134
+ )
135
+ interface.launch(share=True)
136
+
137
+
138
+ if __name__ == "__main__":
139
+ tts = TextToSpeech()
140
+
141
+ with open("Tortoise_TTS_Runs.log", "a") as f:
142
+ f.write(
143
+ f"\n\n-------------------------Tortoise TTS Logs, {datetime.now()}-------------------------\n"
144
+ )
145
+
146
+ main()
app_read.py ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+ import gradio as gr
4
+ import torchaudio
5
+ import time
6
+ from datetime import datetime
7
+ from tortoise.api import TextToSpeech
8
+ from tortoise.utils.text import split_and_recombine_text
9
+ from tortoise.utils.audio import load_audio, load_voice, load_voices
10
+
11
+ VOICE_OPTIONS = [
12
+ "raider_male",
13
+ "sebastian",
14
+ "jacoren",
15
+ "cond_latent_example",
16
+ "deniro",
17
+ "freeman",
18
+ "halle",
19
+ "lj",
20
+ "myself",
21
+ "pat2",
22
+ "snakes",
23
+ "tom",
24
+ "train_daws",
25
+ "train_dreams",
26
+ "train_grace",
27
+ "train_lescault",
28
+ "weaver",
29
+ "applejack",
30
+ "daniel",
31
+ "emma",
32
+ "geralt",
33
+ "jlaw",
34
+ "mol",
35
+ "pat",
36
+ "rainbow",
37
+ "tim_reynolds",
38
+ "train_atkins",
39
+ "train_dotrice",
40
+ "train_empire",
41
+ "train_kennard",
42
+ "train_mouse",
43
+ "william",
44
+ "random", # special option for random voice
45
+ "custom_voice", # special option for custom voice
46
+ "disabled", # special option for disabled voice
47
+ ]
48
+
49
+
50
+ def inference(
51
+ text,
52
+ script,
53
+ name,
54
+ voice,
55
+ voice_b,
56
+ voice_c,
57
+ preset,
58
+ seed,
59
+ regenerate,
60
+ split_by_newline,
61
+ ):
62
+ if regenerate.strip() == "":
63
+ regenerate = None
64
+
65
+ if name.strip() == "":
66
+ raise gr.Error("No name provided")
67
+
68
+ if text is None or text.strip() == "":
69
+ with open(script.name) as f:
70
+ text = f.read()
71
+ if text.strip() == "":
72
+ raise gr.Error("Please provide either text or script file with content.")
73
+
74
+ if split_by_newline == "Yes":
75
+ texts = list(filter(lambda x: x.strip() != "", text.split("\n")))
76
+ else:
77
+ texts = split_and_recombine_text(text)
78
+
79
+ os.makedirs(os.path.join("longform", name), exist_ok=True)
80
+
81
+ if regenerate is not None:
82
+ regenerate = list(map(int, regenerate.split()))
83
+
84
+ voices = [voice]
85
+ if voice_b != "disabled":
86
+ voices.append(voice_b)
87
+ if voice_c != "disabled":
88
+ voices.append(voice_c)
89
+
90
+ if len(voices) == 1:
91
+ voice_samples, conditioning_latents = load_voice(voice)
92
+ else:
93
+ voice_samples, conditioning_latents = load_voices(voices)
94
+
95
+ start_time = time.time()
96
+
97
+ all_parts = []
98
+ for j, text in enumerate(texts):
99
+ if regenerate is not None and j + 1 not in regenerate:
100
+ all_parts.append(
101
+ load_audio(os.path.join("longform", name, f"{j+1}.wav"), 24000)
102
+ )
103
+ continue
104
+ gen = tts.tts_with_preset(
105
+ text,
106
+ voice_samples=voice_samples,
107
+ conditioning_latents=conditioning_latents,
108
+ preset=preset,
109
+ k=1,
110
+ use_deterministic_seed=seed,
111
+ )
112
+
113
+ gen = gen.squeeze(0).cpu()
114
+ torchaudio.save(os.path.join("longform", name, f"{j+1}.wav"), gen, 24000)
115
+
116
+ all_parts.append(gen)
117
+
118
+ full_audio = torch.cat(all_parts, dim=-1)
119
+
120
+ os.makedirs("outputs", exist_ok=True)
121
+ torchaudio.save(os.path.join("outputs", f"{name}.wav"), full_audio, 24000)
122
+
123
+ with open("Tortoise_TTS_Runs_Scripts.log", "a") as f:
124
+ f.write(
125
+ f"{datetime.now()} | Voice: {','.join(voices)} | Text: {text} | Quality: {preset} | Time Taken (s): {time.time()-start_time} | Seed: {seed}\n"
126
+ )
127
+
128
+ output_texts = [f"({j+1}) {texts[j]}" for j in range(len(texts))]
129
+
130
+ return ((24000, full_audio.squeeze().cpu().numpy()), "\n".join(output_texts))
131
+
132
+
133
+ def main():
134
+ text = gr.Textbox(
135
+ lines=4,
136
+ label="Text (Provide either text, or upload a newline separated text file below):",
137
+ )
138
+ script = gr.File(label="Upload a text file")
139
+ name = gr.Textbox(
140
+ lines=1, label="Name of the output file / folder to store intermediate results:"
141
+ )
142
+ preset = gr.Radio(
143
+ ["ultra_fast", "fast", "standard", "high_quality"],
144
+ value="fast",
145
+ label="Preset mode (determines quality with tradeoff over speed):",
146
+ type="value",
147
+ )
148
+ voice = gr.Dropdown(
149
+ VOICE_OPTIONS, value="angie", label="Select voice:", type="value"
150
+ )
151
+ voice_b = gr.Dropdown(
152
+ VOICE_OPTIONS,
153
+ value="disabled",
154
+ label="(Optional) Select second voice:",
155
+ type="value",
156
+ )
157
+ voice_c = gr.Dropdown(
158
+ VOICE_OPTIONS,
159
+ value="disabled",
160
+ label="(Optional) Select third voice:",
161
+ type="value",
162
+ )
163
+ seed = gr.Number(value=0, precision=0, label="Seed (for reproducibility):")
164
+ regenerate = gr.Textbox(
165
+ lines=1,
166
+ label="Comma-separated indices of clips to regenerate [starting from 1]",
167
+ )
168
+ split_by_newline = gr.Radio(
169
+ ["Yes", "No"],
170
+ label="Split by newline (If [No], it will automatically try to find relevant splits):",
171
+ type="value",
172
+ value="No",
173
+ )
174
+ output_audio = gr.Audio(label="Combined audio:")
175
+ output_text = gr.Textbox(label="Split texts with indices:", lines=10)
176
+
177
+ interface = gr.Interface(
178
+ fn=inference,
179
+ inputs=[
180
+ text,
181
+ script,
182
+ name,
183
+ voice,
184
+ voice_b,
185
+ voice_c,
186
+ preset,
187
+ seed,
188
+ regenerate,
189
+ split_by_newline,
190
+ ],
191
+ outputs=[output_audio, output_text],
192
+ )
193
+ interface.launch(share=False)
194
+
195
+
196
+ if __name__ == "__main__":
197
+ tts = TextToSpeech()
198
+
199
+ with open("Tortoise_TTS_Runs_Scripts.log", "a") as f:
200
+ f.write(
201
+ f"\n\n-------------------------Tortoise TTS Scripts Logs, {datetime.now()}-------------------------\n"
202
+ )
203
+
204
+ main()
examples/favorite_riding_hood.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8fc300bce87fcf771fcade7df5b4708d41c635e0f940468cdbb8b0a1d4feb78
3
+ size 970413
examples/favorites/atkins_mha.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf7727c9449159c1d4e96dfda36bad79a4ca8e8cc1c0805ff9ad67530fbc1189
3
+ size 31629
examples/favorites/atkins_omicron.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a1eb795be4c99f6c2c4cf8e8bcd2cab7feebb1a4bef2200dad1a88031381287
3
+ size 41325
examples/favorites/atkins_value.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62180afc494c4f71a252fcd5ac7e5dac91d3e60468f0436bb8a8c0028e3d5ce3
3
+ size 18477
examples/favorites/daniel_craig_dumbledore.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38328f3120a18bbbd170caf9ae9faaa623a34f644d86b5a9a750095945d0ed2a
3
+ size 24045
examples/favorites/daniel_craig_training_ethics.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d399b8ec06d55fd621d772ebd86637801ac1651698e633758e6f5540065d2d8
3
+ size 48909
examples/favorites/dotrice_stop_for_death.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb1eaf0db9bcc46efbd4268df8e1ae96defc5e173645380089dc8defd5c76093
3
+ size 28845
examples/favorites/emma_stone_courage.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b2e92946410033681a3f156e3084e3f1d240437bebd00e9d8641b4127dac027
3
+ size 34125
examples/favorites/emma_stone_training_ethics.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0310203f39c3fe0ecb7ec5182970d50a2db4b14a67798e76535f8e7b3a15dcf8
3
+ size 48045
examples/favorites/halle_barry_dumbledore.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57901a5e7b475a45b6842947c49370f264cc391cfd59ec0c6af6f2ec0fbe1342
3
+ size 21453
examples/favorites/halle_barry_oar_to_oar.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dff5e42f46f0ed2ab27c070d75c0f8daf32b81d98f1e9c08cc901a7f4cf76932
3
+ size 40941
examples/favorites/henry_cavill_metallic_hydrogen.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9deecc64d009576b6ffe0d993a1655cf2c5954b963e1f7c7a3c9a82a8ce73a67
3
+ size 32013
examples/favorites/kennard_road_not_taken.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3639a696e552fad795a2ade069da7bf74ca0f49acb895d73996a30102509ebd4
3
+ size 28461
examples/favorites/morgan_freeman_metallic_hydrogen.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d9d1e4d78fe34654336ca28427a3cbc719e524c6536d0668ceb9b7ed5ca33800
3
+ size 35373
examples/favorites/myself_gatsby.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2d669935ebf1a525524736729e7873d278e3ab09bf2f38e822d43436ef916b8
3
+ size 28077
examples/favorites/patrick_stewart_omicron.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1af89a730eaa532f99e04b6dd2b68ac94607bac574cb24de1a97a9a74f713ca
3
+ size 37581
examples/favorites/patrick_stewart_secret_of_life.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a324fcc4b320cda9eba9b0ee9b74f22ff2e3ece03b54cbef2984865879abb88
3
+ size 36525
examples/favorites/robert_deniro_review.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:057b5cfd29d82cb5774e15dff8b613d0b8ab9d61ce486caf5acd4b952d67b92f
3
+ size 36141
examples/favorites/william_shatner_spacecraft_interview.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8c001c8602900e2afd8e15a9b499520c090aaa5db7c8c28ad8343ae5c166a1a
3
+ size 47277
examples/finetuned/lj/1.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4928bae791bcf583b4527fcf6ad45fc51da67973fe04c4b76bd3c6cdba5e8f77
3
+ size 38157
examples/finetuned/lj/2.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c647d43d52092244f8ef78598243a0fc4e24394dc8224cca4a1a8c700c45a4a7
3
+ size 26061
examples/finetuned/lj/3.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f46328a5b9a342471904ad3215bb6302cc30e094d250bce1ec69b5a6c4772768
3
+ size 18477
examples/finetuned/lj/4.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb7cc0ff61c490bbf8b8638b37eee656cf00e6095e9bcbb99a913134f6f7ae81
3
+ size 22893
examples/naturalspeech_comparison/fibers/naturalspeech.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:985c17d9f66813fe5d91cb466f6ab614e8413241527d78f2525bd6a2a3ab92ab
3
+ size 33141
examples/naturalspeech_comparison/fibers/tortoise.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f381fa7eadd8c4c23955e48de770dc49bc8ca8237b380104bae5ea7d8b6bdc9
3
+ size 33453
examples/naturalspeech_comparison/lax/naturalspeech.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe249b3fcc06d08c4241720d7768108e91062ee53d308d30fb484f97085cc4e6
3
+ size 40978
examples/naturalspeech_comparison/lax/tortoise.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44c43087fab836c25d46e4b1ca6afecc8f745e58dad721aae15cf989f76954f5
3
+ size 42285
examples/naturalspeech_comparison/maltby/naturalspeech.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d37bce11874d87ab46fe3614df2535ce6c22a35dbd2c8df9582386e57c5a3e5f
3
+ size 35127
examples/naturalspeech_comparison/maltby/tortoise.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2dc181b24f72a7fa8d6442b19eef876c4b16454aaf7c90f9f8e2afd13cf80b38
3
+ size 36909
examples/prompting/angry.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57130e4861e39e2d51146cfc692f7bfb6d7dec6942add307a3ca1f408494f82d
3
+ size 7629
examples/prompting/happy.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99cd3b7c3fdfbc262573a925e0bde004e9fd589922804b2c209c68ae1bb5a6ca
3
+ size 8301
examples/prompting/sad.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae16ffd08f0ef5024c151d4ba6bb2bea6cb213ce3f1241da89198fe2a6e03072
3
+ size 6285
examples/prompting/scared.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a58a4bd50daad256380435bec57dedf16b017c587c6e94f5127019ea89762f4
3
+ size 6861
examples/riding_hood/angelina.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:413942dd8441d499c6752ecd9f3cd790f2a8af00e90881b3d8ff2db0f4834e03
3
+ size 866157
examples/riding_hood/craig.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52c635563ae37c6cead2beb599245847df40866fe534cc68551d733b500e1013
3
+ size 825645
examples/riding_hood/deniro.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac83e5a28120d31af57f05a87663136cd9227c3c685c3b3d334c250431033463
3
+ size 851181
examples/riding_hood/emma.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a617489873ae94dc607dbae7156d4ae29835a89f2e5ad7e95952bdf94e6369c0
3
+ size 807309
examples/riding_hood/freeman.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5c38334b399b713850161eaddbffb128b65d8dc98deb67c642b355fd080d585
3
+ size 942765
examples/riding_hood/geralt.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5f4c4872c48166f1532a2d2cbb3b6aa6453d4f965cddf6da76403a5d18398d6
3
+ size 788493
examples/riding_hood/halle.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bae0d09786663b56fd72e594dfd275efc02589370957e34469ad0becc874b88c
3
+ size 785229
examples/riding_hood/jlaw.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83eab02adec8b129c0a2c5dc4abad3a5646b0f6de16a3d0ec35fd4263ea5a8bf
3
+ size 666861
examples/riding_hood/lj.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0eadb7a268ad3ac785986f3f925eec49d47bdef19899f109cced14086b359644
3
+ size 817293