Skip to content

Commit

Permalink
Merge pull request #348 from willwade/espeak-fixes-word-timing-ffmpeg
Browse files Browse the repository at this point in the history
Remove FFMPEG, rework onSynth in espeak to finish correctly
  • Loading branch information
willwade authored Oct 28, 2024
2 parents 41c720c + 151d292 commit 12145bc
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 136 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/python_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ jobs:
- if: runner.os == 'Linux'
run: |
sudo apt-get update -q -q
sudo apt-get install --yes espeak espeak-ng ffmpeg libespeak1
espeak --version
sudo apt-get install --yes espeak-ng libespeak1
espeak-ng --version
ffmpeg --version || true
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@

+ If you are on a linux system and if the voice output is not working , then :

Install espeak , ffmpeg and libespeak1 as shown below:
Install espeak and libespeak1 as shown below:

```
sudo apt update && sudo apt install espeak ffmpeg libespeak1
sudo apt update && sudo apt install espeak libespeak1
```

## Usage :
Expand Down Expand Up @@ -90,7 +90,7 @@ engine.stop()


"""Saving Voice to a file"""
# On linux make sure that 'espeak' and 'ffmpeg' are installed
# On linux make sure that 'espeak' is installed
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()

Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Installation

+ If you are on a linux system and if the voice output is not working , then :

Install espeak , ffmpeg and libespeak1 as shown below:
Install espeak and libespeak1 as shown below:

::

sudo apt update && sudo apt install espeak ffmpeg libespeak1
sudo apt update && sudo apt install espeak-ng libespeak1


Usage :
Expand Down Expand Up @@ -65,7 +65,7 @@ Usage :
engine.stop()

"""Saving Voice to a file"""
# On linux make sure that 'espeak' and 'ffmpeg' are installed
# On linux make sure that 'espeak' are installed
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()

Expand Down
1 change: 0 additions & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,3 @@ code-block:: bash
.. _espeak: http://espeak.sourceforge.net/
.. _virtualenv: https://pypi.python.org/pypi/virtualenv/1.10.1
.. _pip: https://pypi.python.org/pypi/pip
.. _ffmpeg: https://www.ffmpeg.org/
37 changes: 21 additions & 16 deletions example/main.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
import pyttsx3
engine = pyttsx3.init() # object creation

engine = pyttsx3.init() # object creation

""" RATE"""
rate = engine.getProperty('rate') # getting details of current speaking rate
print(rate) #printing current voice rate
engine.setProperty('rate', 125) # setting up new voice rate
rate = engine.getProperty("rate") # getting details of current speaking rate
print(rate) # printing current voice rate
engine.setProperty("rate", 125) # setting up new voice rate


"""VOLUME"""
volume = engine.getProperty('volume') #getting to know current volume level (min=0 and max=1)
print(volume) #printing current volume level
engine.setProperty('volume',1.0) # setting up volume level between 0 and 1
volume = engine.getProperty(
"volume"
) # getting to know current volume level (min=0 and max=1)
print(volume) # printing current volume level
engine.setProperty("volume", 1.0) # setting up volume level between 0 and 1

"""VOICE"""
voices = engine.getProperty('voices') #getting details of current voice
#engine.setProperty('voice', voices[0].id) #changing index, changes voices. 0 for male
engine.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female
voices = engine.getProperty("voices") # getting details of current voice
# engine.setProperty('voice', voices[0].id) #changing index, changes voices. 0 for male
engine.setProperty(
"voice", voices[1].id
) # changing index, changes voices. 1 for female

"""PITCH"""
pitch = engine.getProperty('pitch') #Get current pitch value
print(pitch) #Print current pitch value
engine.setProperty('pitch', 75) #Set the pitch (default 50) to 75 out of 100
pitch = engine.getProperty("pitch") # Get current pitch value
print(pitch) # Print current pitch value
engine.setProperty("pitch", 75) # Set the pitch (default 50) to 75 out of 100

engine.say("Hello World!")
engine.say('My current speaking rate is ' + str(rate))
engine.say("My current speaking rate is " + str(rate))
engine.runAndWait()
engine.stop()


"""Saving Voice to a file"""
# On linux make sure that 'espeak' and 'ffmpeg' are installed
engine.save_to_file('Hello World', 'test.mp3')
# On linux make sure that 'espeak' is installed
engine.save_to_file("Hello World", "test.mp3")
engine.runAndWait()
Loading

0 comments on commit 12145bc

Please sign in to comment.