Skip to content

Commit

Permalink
Include pitch adjustments for Linux OS
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Sep 9, 2023
1 parent 9bc29b8 commit 846b21e
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if __name__ == '__main__':
- **MICROPHONE_INDEX**: Defaults to `None` - _Use [peripherals.py](https://github.com/thevickypedia/Jarvis_UI/blob/main/modules/peripherals.py) to get the index values_
- **VOICE_NAME**: Defaults to the author's favorite per the OS. _Name of the voice supported by the OperatingSystem_
- **VOICE_RATE**: Defaults to the value in `py3-tts` module - _Speed/rate at which the text should be spoken_
- **VOICE_PITCH**: Defaults to the value in `py3-tts` module - _Currently available only for Linux OS_
<br><br>
- **VOICE_TIMEOUT**: Defaults to `3` - _Timeout for listener once wake word is detected - Awaits for a speech to begin until this limit_
- **VOICE_PHRASE_LIMIT**: Defaults to `None` - _Timeout for phrase once listener is activated - Listener will be deactivated after this limit_
Expand Down
3 changes: 2 additions & 1 deletion docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ <h3>Optional<a class="headerlink" href="#optional" title="Permalink to this head
<br><br></p></li>
<li><p><strong>MICROPHONE_INDEX</strong>: Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code> - <em>Use <a class="reference external" href="https://github.com/thevickypedia/Jarvis_UI/blob/main/modules/peripherals.py">peripherals.py</a> to get the index values</em></p></li>
<li><p><strong>VOICE_NAME</strong>: Defaults to the author’s favorite per the OS. <em>Name of the voice supported by the OperatingSystem</em></p></li>
<li><p><strong>VOICE_RATE</strong>: Defaults to the value in <code class="docutils literal notranslate"><span class="pre">py3-tts</span></code> module - <em>Speed/rate at which the text should be spoken</em>
<li><p><strong>VOICE_RATE</strong>: Defaults to the value in <code class="docutils literal notranslate"><span class="pre">py3-tts</span></code> module - <em>Speed/rate at which the text should be spoken</em></p></li>
<li><p><strong>VOICE_PITCH</strong>: Defaults to the value in <code class="docutils literal notranslate"><span class="pre">py3-tts</span></code> module - <em>Currently available only for Linux OS</em>
<br><br></p></li>
<li><p><strong>VOICE_TIMEOUT</strong>: Defaults to <code class="docutils literal notranslate"><span class="pre">3</span></code> - <em>Timeout for listener once wake word is detected - Awaits for a speech to begin until this limit</em></p></li>
<li><p><strong>VOICE_PHRASE_LIMIT</strong>: Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code> - <em>Timeout for phrase once listener is activated - Listener will be deactivated after this limit</em></p></li>
Expand Down
1 change: 1 addition & 0 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if __name__ == '__main__':
- **MICROPHONE_INDEX**: Defaults to `None` - _Use [peripherals.py](https://github.com/thevickypedia/Jarvis_UI/blob/main/modules/peripherals.py) to get the index values_
- **VOICE_NAME**: Defaults to the author's favorite per the OS. _Name of the voice supported by the OperatingSystem_
- **VOICE_RATE**: Defaults to the value in `py3-tts` module - _Speed/rate at which the text should be spoken_
- **VOICE_PITCH**: Defaults to the value in `py3-tts` module - _Currently available only for Linux OS_
<br><br>
- **VOICE_TIMEOUT**: Defaults to `3` - _Timeout for listener once wake word is detected - Awaits for a speech to begin until this limit_
- **VOICE_PHRASE_LIMIT**: Defaults to `None` - _Timeout for phrase once listener is activated - Listener will be deactivated after this limit_
Expand Down
2 changes: 2 additions & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ <h2 id="V">V</h2>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.voice_pitch">voice_pitch (jarvis_ui.modules.models.EnvConfig attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.voice_rate">voice_rate (jarvis_ui.modules.models.EnvConfig attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.voice_timeout">voice_timeout (jarvis_ui.modules.models.EnvConfig attribute)</a>
Expand Down
5 changes: 5 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,11 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading"
<span class="sig-name descname"><span class="pre">voice_phrase_limit</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">float</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">PositiveInt</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#jarvis_ui.modules.models.EnvConfig.voice_phrase_limit" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="jarvis_ui.modules.models.EnvConfig.voice_pitch">
<span class="sig-name descname"><span class="pre">voice_pitch</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">PositiveInt</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">PositiveFloat</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#jarvis_ui.modules.models.EnvConfig.voice_pitch" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="jarvis_ui.modules.models.EnvConfig.voice_rate">
<span class="sig-name descname"><span class="pre">voice_rate</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">PositiveInt</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">PositiveFloat</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#jarvis_ui.modules.models.EnvConfig.voice_rate" title="Permalink to this definition"></a></dt>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions jarvis_ui/executables/audio_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def instantiate_audio_driver() -> pyttsx3.Engine:
driver.setProperty("voice", voices[ind_d].id)
if env.voice_rate:
driver.setProperty("rate", env.voice_rate)
if env.voice_pitch:
driver.setProperty("pitch", env.voice_pitch)
break
else:
logger.info("Using default voice model.")
Expand Down
4 changes: 4 additions & 0 deletions jarvis_ui/modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class Config(BaseConfig):
If the voice name is not present for the OperatingSystem.
"""

if env.voice_pitch and settings.operating_system in ("Windows", "Darwin"):
warnings.warn(
"Voice pitch adjustment is currently supported only in Linux operating system."
)
if env.request_url[-1] != "/":
env.request_url += "/"

Expand Down
1 change: 1 addition & 0 deletions jarvis_ui/modules/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class EnvConfig(BaseSettings):
# Built-in speaker config (Unused if speech synthesis is used)
voice_name: str = Field(default=None)
voice_rate: Union[PositiveInt, PositiveFloat] = Field(default=None)
voice_pitch: Union[PositiveInt, PositiveFloat] = Field(default=None)

voice_timeout: Union[float, PositiveInt] = Field(default=3)
voice_phrase_limit: Union[float, PositiveInt] = Field(default=5)
Expand Down
6 changes: 6 additions & 0 deletions release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release Notes
=============

v2.2 (09/09/2023)
-----------------
- Includes stability and performance improvements
- Improved static audio responses specific to the operating system
- Includes a feature to adjust voice pitch for Linux users

v2.1 (08/30/2023)
-----------------
- Improves overall stability
Expand Down

0 comments on commit 846b21e

Please sign in to comment.