├── .gitignore
├── .isort.cfg
├── .projectile
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.md
├── check.sh
├── mycroft_plugin_tts_mimic3
├── VERSION
├── __init__.py
└── py.typed
├── mypy.ini
├── pylintrc
├── requirements.txt
├── requirements_dev.txt
├── setup.cfg
└── setup.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .idea
3 | *.log
4 | tmp/
5 |
6 | *.py[cod]
7 | *.egg
8 | build
9 | htmlcov
10 |
11 | .venv/
12 | __pycache__/
13 | .mypy_cache/
14 | *.egg-info/
15 | dist/
16 | build/
17 |
18 | flycheck_*.py
19 |
--------------------------------------------------------------------------------
/.isort.cfg:
--------------------------------------------------------------------------------
1 | [settings]
2 | multi_line_output=3
3 | include_trailing_comma=True
4 | force_grid_wrap=0
5 | use_parentheses=True
6 | line_length=88
7 |
--------------------------------------------------------------------------------
/.projectile:
--------------------------------------------------------------------------------
1 | - /.venv/
2 | - /.mypy_cache/
3 | - /plugin_tts_mimic3/.mypy_cache/
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
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.
202 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include requirements.txt
2 | include requirements_dev.txt
3 | include LICENSE
4 | include README.md
5 | include mycroft_plugin_tts_mimic3/VERSION
6 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # Copyright 2022 Mycroft AI Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | .PHONY: dist
17 |
18 | dist:
19 | python3 setup.py sdist
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Mimic 3 Text to Speech Plugin
2 |
3 | Text to speech plugin for [Mycroft](https://mycroft.ai) using [Mimic 3](https://github.com/MycroftAI/mimic3).
4 |
5 | * [Available voices](https://github.com/MycroftAI/mimic3-voices)
6 | * [Documentation](https://mycroft-ai.gitbook.io/docs/mycroft-technologies/mimic-tts/coming-soon-mimic-3)
7 |
8 |
9 | ## Installation
10 |
11 | Install the necessary system packages:
12 |
13 | ``` sh
14 | sudo apt-get install libespeak-ng1
15 | ```
16 |
17 | On 32-bit ARM platforms (a.k.a. `armv7l` or `armhf`), you will also need some extra libraries:
18 |
19 | ``` sh
20 | sudo apt-get install libatomic1 libgomp1 libatlas-base-dev
21 | ```
22 |
23 | Then, ensure that you're using the latest `pip`:
24 |
25 | ```sh
26 | mycroft-pip install --upgrade pip
27 | ```
28 |
29 | Next, install the TTS plugin in Mycroft:
30 |
31 | ```sh
32 | mycroft-pip install mycroft-plugin-tts-mimic3[all]
33 | ```
34 |
35 | Removing `[all]` will install support for English only.
36 |
37 | Additional language support can be selectively installed by replacing `all` with a two-character language code, such as `de` (German) or `fr` (French).
38 | See [`setup.py`](https://github.com/MycroftAI/mimic3/blob/master/setup.py) for an up-to-date list of language codes.
39 |
40 | Enable the plugin in your [mycroft.conf](https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/customizations/mycroft-conf) file:
41 |
42 | ``` sh
43 | mycroft-config set tts.module mimic3_tts_plug
44 | ```
45 |
46 | or you can manually add the following to `mycroft.conf` with `mycroft-config edit user`:
47 |
48 | ``` json
49 | "tts": {
50 | "module": "mimic3_tts_plug"
51 | }
52 | ```
53 |
54 |
55 | ## Plugin Options
56 |
57 | Additional settings can be configured in `mycroft.conf`:
58 |
59 | ``` json
60 | "tts": {
61 | "module": "mimic3_tts_plug",
62 | "mimic3_tts_plug": {
63 | "voice": "en_US/cmu-arctic_low", // default voice
64 | "speaker": "fem", // default speaker
65 | "length_scale": 1.0, // speaking rate
66 | "noise_scale": 0.667, // speaking variablility
67 | "noise_w": 1.0 // phoneme duration variablility
68 | }
69 | }
70 | ```
71 |
--------------------------------------------------------------------------------
/check.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Copyright 2022 Mycroft AI Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 | set -eo pipefail
17 |
18 | # Directory of *this* script
19 | this_dir="$( cd "$( dirname "$0" )" && pwd )"
20 |
21 | module_name='mycroft_plugin_tts_mimic3'
22 | src_dir="${this_dir}/${module_name}"
23 |
24 | # Path to virtual environment
25 | : "${venv:=${src_dir}/.venv}"
26 |
27 | if [ -d "${venv}" ]; then
28 | # Activate virtual environment if available
29 | source "${venv}/bin/activate"
30 | fi
31 |
32 | # Format code
33 | black "${src_dir}"
34 | isort "${src_dir}"
35 |
36 | # Check
37 | flake8 "${src_dir}"
38 | pylint "${src_dir}"
39 | mypy "${src_dir}"
40 |
41 | echo 'OK'
42 |
--------------------------------------------------------------------------------
/mycroft_plugin_tts_mimic3/VERSION:
--------------------------------------------------------------------------------
1 | 0.1.5
2 |
--------------------------------------------------------------------------------
/mycroft_plugin_tts_mimic3/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2022 Mycroft AI Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | import io
16 | import logging
17 | import re
18 | import typing
19 | import wave
20 | from pathlib import Path
21 |
22 | try:
23 | from mycroft.messagebus.message import Message
24 | from mycroft.tts import TTS, TTSValidator
25 | from mycroft.tts.cache import AudioFile
26 | from mycroft.util.log import LOG
27 | except ImportError:
28 | # Dummy classes for use outside of Mycroft
29 | class DummyMessage:
30 | def __init__(self, msg_type, data=None, context=None):
31 | self.msg_type = msg_type
32 | self.data = data or {}
33 | self.context = context or {}
34 |
35 | class DummyCache:
36 | def __init__(self):
37 | self.cached_sentences: typing.Dict[str, typing.Any] = {}
38 |
39 | def clear(self):
40 | pass
41 |
42 | class DummyTTS:
43 | def __init__(
44 | self,
45 | lang,
46 | config,
47 | validator,
48 | audio_ext="wav",
49 | phonetic_spelling=True,
50 | ssml_tags=None,
51 | ):
52 | self.lang = lang
53 | self.config = config
54 | self.validator = validator
55 | self.cache = DummyCache()
56 |
57 | class DummyTTSValidator:
58 | def __init__(self, tts):
59 | self.tts = tts
60 |
61 | class DummyAudioFile:
62 | def __init__(self, cache_dir: Path, sentence_hash: str, file_type: str):
63 | self.name = f"{sentence_hash}.{file_type}"
64 | self.path = cache_dir.joinpath(self.name)
65 |
66 | Message = DummyMessage
67 | TTS = DummyTTS
68 | TTSValidator = DummyTTSValidator
69 | AudioFile = DummyAudioFile
70 | LOG = logging.getLogger("mimic3")
71 |
72 |
73 | from mimic3_tts import (
74 | AudioResult,
75 | Mimic3Settings,
76 | Mimic3TextToSpeechSystem,
77 | SSMLSpeaker,
78 | )
79 |
80 |
81 | class Mimic3TTSPlugin(TTS):
82 | """Mycroft interface to Mimic3."""
83 |
84 | def __init__(self, lang, config):
85 | self.lang = lang
86 |
87 | voice: typing.Optional[str] = config.get("voice")
88 | preload_voices: typing.Optional[typing.List[str]] = config.get("preload_voices")
89 |
90 | self.tts = Mimic3TextToSpeechSystem(
91 | Mimic3Settings(
92 | voice=config.get("voice"),
93 | language=config.get("language"),
94 | voices_directories=config.get("voices_directories"),
95 | voices_url_format=config.get("voices_url_format"),
96 | speaker=config.get("speaker"),
97 | length_scale=config.get("length_scale"),
98 | noise_scale=config.get("noise_scale"),
99 | noise_w=config.get("noise_w"),
100 | voices_download_dir=config.get("voices_download_dir"),
101 | use_deterministic_compute=config.get(
102 | "use_deterministic_compute", False
103 | ),
104 | )
105 | )
106 |
107 | super().__init__(lang, config, Mimic3Validator(self), "wav")
108 |
109 | if voice:
110 | self.tts.preload_voice(voice)
111 |
112 | if preload_voices:
113 | for voice in preload_voices:
114 | self.tts.preload_voice(voice)
115 |
116 | preloaded_cache = config.get("preloaded_cache")
117 | if preloaded_cache:
118 | self.persistent_cache_dir = Path(preloaded_cache)
119 | self.persistent_cache_dir.mkdir(parents=True, exist_ok=True)
120 | self._load_existing_audio_files()
121 |
122 | def get_tts(self, sentence, wav_file):
123 | """Synthesize audio using Mimic3 on device"""
124 |
125 | sentence, ssml = self._apply_text_hacks(sentence)
126 | wav_bytes = self._synthesize(sentence, ssml=ssml)
127 |
128 | # Write WAV to file
129 | Path(wav_file).write_bytes(wav_bytes)
130 |
131 | return (wav_file, None)
132 |
133 | def _apply_text_hacks(self, sentence: str) -> typing.Tuple[str, bool]:
134 | """Mycroft-specific workarounds for text.
135 |
136 | Returns: (text, ssml)
137 | """
138 |
139 | # HACK: Mycroft gives "eight a.m.next sentence" sometimes
140 | sentence = sentence.replace(" a.m.", " a.m. ")
141 | sentence = sentence.replace(" p.m.", " p.m. ")
142 |
143 | # A I -> A.I.
144 | sentence = re.sub(
145 | r"\b([A-Z](?: |$)){2,}",
146 | lambda m: m.group(0).strip().replace(" ", ".") + ". ",
147 | sentence,
148 | )
149 |
150 | # Assume SSML if sentence begins with an angle bracket
151 | ssml = sentence.strip().startswith("<")
152 |
153 | # HACK: Speak single letters from Mycroft (e.g., "A;")
154 | if (len(sentence) == 2) and sentence.endswith(";"):
155 | letter = sentence[0]
156 | ssml = True
157 | sentence = f'{letter}'
158 | else:
159 | # HACK: 'A' -> spell out
160 | sentence, subs_made = re.subn(
161 | r"'([A-Z])'",
162 | r'\1',
163 | sentence,
164 | )
165 | if subs_made > 0:
166 | ssml = True
167 |
168 | return (sentence, ssml)
169 |
170 | def _synthesize(self, text: str, ssml: bool = False) -> bytes:
171 | """Synthesize audio from text and return WAV bytes"""
172 | with io.BytesIO() as wav_io:
173 | wav_file: wave.Wave_write = wave.open(wav_io, "wb")
174 | wav_params_set = False
175 |
176 | with wav_file:
177 | try:
178 | if ssml:
179 | # SSML
180 | results = SSMLSpeaker(self.tts).speak(text)
181 | else:
182 | # Plain text
183 | self.tts.begin_utterance()
184 | self.tts.speak_text(text)
185 | results = self.tts.end_utterance()
186 |
187 | for result in results:
188 | # Add audio to existing WAV file
189 | if isinstance(result, AudioResult):
190 | if not wav_params_set:
191 | wav_file.setframerate(result.sample_rate_hz)
192 | wav_file.setsampwidth(result.sample_width_bytes)
193 | wav_file.setnchannels(result.num_channels)
194 | wav_params_set = True
195 |
196 | wav_file.writeframes(result.audio_bytes)
197 | except Exception as e:
198 | if not wav_params_set:
199 | # Set default parameters so exception can propagate
200 | wav_file.setframerate(22050)
201 | wav_file.setsampwidth(2)
202 | wav_file.setnchannels(1)
203 |
204 | raise e
205 |
206 | wav_bytes = wav_io.getvalue()
207 |
208 | return wav_bytes
209 |
210 | def _load_existing_audio_files(self):
211 | """Find the TTS audio files already in the persistent cache."""
212 | glob_pattern = "*." + self.audio_ext
213 | for file_path in self.persistent_cache_dir.glob(glob_pattern):
214 | sentence_hash = file_path.name.split(".")[0]
215 | audio_file = AudioFile(
216 | self.persistent_cache_dir, sentence_hash, self.audio_ext
217 | )
218 | self.cache.cached_sentences[sentence_hash] = audio_file, None
219 |
220 |
221 | class Mimic3Validator(TTSValidator):
222 | """Mycroft TTS validator for Mimic 3"""
223 |
224 | def __init__(self, tts):
225 | super().__init__(tts)
226 |
227 | def validate_lang(self):
228 | # TODO: Check against model language
229 | pass
230 |
231 | def validate_connection(self):
232 | pass
233 |
234 | def get_tts_class(self):
235 | return Mimic3TTSPlugin
236 |
--------------------------------------------------------------------------------
/mycroft_plugin_tts_mimic3/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MycroftAI/plugin-tts-mimic3/67552a4167752caa2998efb75d55e588a81a4d92/mycroft_plugin_tts_mimic3/py.typed
--------------------------------------------------------------------------------
/mypy.ini:
--------------------------------------------------------------------------------
1 | [mypy]
2 |
3 | [mypy-setuptools.*]
4 | ignore_missing_imports = True
5 |
6 | [mypy-mycroft.*]
7 | ignore_missing_imports = True
8 |
9 |
--------------------------------------------------------------------------------
/pylintrc:
--------------------------------------------------------------------------------
1 | [MESSAGES CONTROL]
2 | disable=
3 | format,
4 | abstract-class-little-used,
5 | abstract-method,
6 | cyclic-import,
7 | duplicate-code,
8 | global-statement,
9 | import-outside-toplevel,
10 | inconsistent-return-statements,
11 | locally-disabled,
12 | not-context-manager,
13 | redefined-variable-type,
14 | too-few-public-methods,
15 | too-many-arguments,
16 | too-many-branches,
17 | too-many-instance-attributes,
18 | too-many-lines,
19 | too-many-locals,
20 | too-many-public-methods,
21 | too-many-return-statements,
22 | too-many-statements,
23 | too-many-boolean-expressions,
24 | unnecessary-pass,
25 | unused-argument,
26 | broad-except,
27 | too-many-nested-blocks,
28 | invalid-name,
29 | unused-import,
30 | no-self-use,
31 | fixme,
32 | useless-super-delegation,
33 | missing-module-docstring,
34 | missing-class-docstring,
35 | missing-function-docstring,
36 | import-error,
37 | relative-beyond-top-level
38 |
39 | [FORMAT]
40 | expected-line-ending-format=LF
41 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | mycroft-mimic3-tts<1.0
2 |
--------------------------------------------------------------------------------
/requirements_dev.txt:
--------------------------------------------------------------------------------
1 | black==22.3.0
2 | coverage==5.0.4
3 | flake8==3.7.9
4 | mypy==0.910
5 | pylint==2.10.2
6 | pytest==5.4.1
7 | pytest-cov==2.8.1
8 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | # To work with Black
3 | max-line-length = 88
4 | # E501: line too long
5 | # W503: Line break occurred before a binary operator
6 | # E203: Whitespace before ':'
7 | # D202 No blank lines allowed after function docstring
8 | # W504 line break after binary operator
9 | ignore =
10 | E501,
11 | W503,
12 | E203,
13 | D202,
14 | W504
15 |
16 | # F401 import unused
17 | per-file-ignores =
18 | mimic3_tts/__init__.py:F401
19 |
20 | [isort]
21 | multi_line_output = 3
22 | include_trailing_comma=True
23 | force_grid_wrap=0
24 | use_parentheses=True
25 | line_length=88
26 | indent = " "
27 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # Copyright 2022 Mycroft AI Inc.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 | from collections import defaultdict
17 | from pathlib import Path
18 |
19 | import setuptools
20 | from setuptools import setup
21 |
22 | this_dir = Path(__file__).parent
23 | module_dir = this_dir / "mycroft_plugin_tts_mimic3"
24 |
25 | # -----------------------------------------------------------------------------
26 |
27 | # Load README in as long description
28 | long_description: str = ""
29 | readme_path = this_dir / "README.md"
30 | if readme_path.is_file():
31 | long_description = readme_path.read_text(encoding="utf-8")
32 |
33 | requirements = []
34 | requirements_path = this_dir / "requirements.txt"
35 | if requirements_path.is_file():
36 | with open(requirements_path, "r", encoding="utf-8") as requirements_file:
37 | requirements = requirements_file.read().splitlines()
38 |
39 | version_path = module_dir / "VERSION"
40 | with open(version_path, "r", encoding="utf-8") as version_file:
41 | version = version_file.read().strip()
42 |
43 | # -----------------------------------------------------------------------------
44 |
45 | # dependency => [tags]
46 | extras = {}
47 |
48 | # Create language-specific extras
49 | for lang in [
50 | "de",
51 | "es",
52 | "fa",
53 | "fr",
54 | "it",
55 | "nl",
56 | "ru",
57 | "sw",
58 | ]:
59 | extras[f"mycroft-mimic3-tts[{lang}]"] = [lang]
60 |
61 | # Add "all" tag
62 | for tags in extras.values():
63 | tags.append("all")
64 |
65 | # Invert for setup
66 | extras_require = defaultdict(list)
67 | for dep, tags in extras.items():
68 | for tag in tags:
69 | extras_require[tag].append(dep)
70 |
71 | # -----------------------------------------------------------------------------
72 |
73 | PLUGIN_ENTRY_POINT = "mimic3_tts_plug = mycroft_plugin_tts_mimic3:Mimic3TTSPlugin"
74 | setup(
75 | name="mycroft_plugin_tts_mimic3",
76 | version=version,
77 | description="Text to speech plugin for Mycroft using Mimic3",
78 | url="http://github.com/MycroftAI/plugin-tts-mimic3",
79 | author="Michael Hansen",
80 | author_email="michael.hansen@mycroft.ai",
81 | license="Apache-2.0",
82 | packages=setuptools.find_packages(),
83 | package_data={"mycroft_plugin_tts_mimic3": ["VERSION", "py.typed"]},
84 | install_requires=requirements,
85 | extras_require=extras_require,
86 | classifiers=[
87 | "Development Status :: 3 - Alpha",
88 | "Intended Audience :: Developers",
89 | "Topic :: Text Processing :: Linguistic",
90 | "License :: OSI Approved :: Apache Software License",
91 | "Programming Language :: Python :: 3.7",
92 | "Programming Language :: Python :: 3.8",
93 | "Programming Language :: Python :: 3.9",
94 | ],
95 | keywords="mycroft plugin tts mimic mimic3",
96 | entry_points={"mycroft.plugin.tts": PLUGIN_ENTRY_POINT},
97 | )
98 |
--------------------------------------------------------------------------------