Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
pip install espeakui
python-espeak - The custom version that's here on Github
xclip - For clipboard mode only. Install for your system with something like sudo apt-get install xclip
or pacman -S xclip
or other.
An untested Windows and OSX version is available using pyperclip. Change XCLIP_MODE = True
to False
in espeakui.py
to activate. The reason for not using pyperclip by default is that pyperclip defaults to the wrong clipboard for xclip on Linux and doesn't have an option to change clipboards.
guess_language (optional) - For automatically detecting the text language and picking the voice for that language. Install with pip install guess_language
.
Run
python -m espeakui.espeakui
A contentless window opens. It accepts these keys.
space
Pause/resume[
Slow down]
Speed upUp arrow
Seek forwardDown arrow
Seek backwardLeft arrow
Seek forward lessRight arrow
Seek backward lesss
Zoom: speaks the text around the current cursor at a much slower pace and then resumes normal speech.l
Load a text file "text" and read it (replaces what is currently being read). Mainly for non-clipboard mode.q
Quitn, p
Previous file/next file when running in directory mode.Seeking is possible while paused and "preview" of the text surrounding the new cursor position is played.
There are four modes of operation (with corresponding command line option):
-nc
-c
-f <file path>
-d <directory path>
Clipboard mode is the most used but needs xclip
to be installed.
There's an alternative curses interface with the same keybindings. It uses urwid.
pip install urwid
python -m espeakui.espeak_urwid
Suggestion: I've setup a keyboard shortcut to call python espeakui.py
in my windows manager. Then just highlight text somewhere and hit the keyboard shortcut.
espeakui
to catch more errors in the same amount of time. (Yes, it was used to proofread this readme although there are probably still some errors.)An end-of-line earcon can be enabled by uncommenting the line in the play_wave
function at the beginning of espeaker.py
. Requires the play
binary from SoX (or substitute your own; it must be non-blocking).
The rest of the features are a hodgepodge of personal preferences. Hopefully espeakui is small enough to be modified to your own liking.
espeakui.py
depends on espeaker.py
which can be used independently as a library. It also provides some classes not used by espeakui.py
.
import espeak
from espeakui.espeaker import FileEspeak
espeak.init(playback=False)
file_espeak = FileEspeak(open("test.wav", "w"))
file_espeak.say("Hello world")
espeaker.FileEspeak
writes its output to a file instead of playing back.
espeaker.SubprocessEspeak
pipes the wave content to a subprocess.
import espeak
from espeakui.espeaker import SubprocessEspeak
espeak.init(playback=False)
subprocess_espeak = SubprocessEspeak(command="aplay")
subprocess_espeak.say("Hello world")
will use aplay
to playa the audio output.
Espeaker
provides an API that resembles audio file playback: play
, pause
, stop
. Speaker parameter changes (rate, pitch, volume, etc) appear to take effect immediately when this Espeaker
is speaking.
For example, run this in the interpreter
import espeak
from espeakui import espeaker
espeak.init()
espeaker = espeaker.Espeaker()
text = "\n".join("\n".join(["{} little bugs in the code.".format(i),
"{} bugs in the code.".format(i),
"Fix one bug. Compile it again.",
"{} little bugs in the code.".format(i+1)])
for i in range(99, 150))
espeaker.play(text)
# Wait a bit between each command
espeaker.rate = 300
espeaker.rate = 100
espeaker.pitch = 70
espeaker.pitch = 30
espeaker.punctuation = 'all'
# To make it stop
espeaker.pause()
Sending large amounts of text to espeak is too fragile. If you miss a bit you have to restart the entire thing. If some parts are uninteresting its not possible to skip through it. But large amounts of text is where espeak is really useful. An audio/video player's interface on the other hand is very good for playback. So I made this, a TTS with (some of) mplayer's playback interface.
Another way would be to use espeak -w
and then call mplayer
but this involves waiting while espeak writes the wav file and the file is created for nothing if only listened through halfway through. And even with -af scaletempo
, there's some distortion, especially when sped up more than 2x.
Ideas that may be worth trying
FAQs
A text-to-speech interface with mplayer-like bindings, using espeak-ng
We found that espeakui-ng demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.