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.
TTS-Wrapper makes it easier to use text-to-speech APIs by providing a unified and easy-to-use interface.
Contributions are welcome! Check our contribution guide.
TTS-Wrapper makes it easier to use text-to-speech APIs by providing a unified and easy-to-use interface.
Currently the following services are supported:
Install using pip.
pip install TTS-Wrapper
Note: for each service you want to use, you have to install the required packages.
Example: to use google
and watson
:
pip install TTS-Wrapper[google, watson]
For PicoTTS you need to install the package on your machine. For Debian (Ubuntu and others) install the package libttspico-utils
and for Arch (Manjaro and others) there is a package called aur/pico-tts
.
Simply instantiate an object from the desired service and call synth()
.
from tts_wrapper import PollyTTS, PollyClient
tts = PollyTTS(client=PollyClient())
tts.synth('<speak>Hello, world!</speak>', 'hello.wav')
Notice that you must create a client object to work with your service. Each service uses different authorization techniques. Check out the documentation to learn more.
You can change the default voice and lang like this:
PollyTTS(voice='Camila', lang='pt-BR')
Check out the list of available voices for Polly, Google, Microsoft, and Watson.
You can also use SSML markup to control the output of compatible engines.
tts.synth('<speak>Hello, <break time="3s"/> world!</speak>', 'hello.wav')
It is recommended to use the ssml
attribute that will create the correct boilerplate tags for each engine:
tts.synth(tts.ssml.add('Hello, <break time="3s"/> world!'), 'hello.wav')
Learn which tags are available for each service: Polly, Google, Microsoft, and Watson.
To setup credentials to access each engine, create the respective client.
If you don't explicitly define credentials, boto3
will try to find them in your system's credentials file or your environment variables. However, you can specify them with a tuple:
from tts_wrapper import PollyClient
client = PollyClient(credentials=(region, aws_key_id, aws_access_key))
Point to your Oauth 2.0 credentials file path:
from tts_wrapper import GoogleClient
client = GoogleClient(credentials='path/to/creds.json')
Just provide your subscription key, like so:
from tts_wrapper import MicrosoftClient
client = MicrosoftClient(credentials='TOKEN')
If your region is not the default "useast", you can change it like so:
client = MicrosoftClient(credentials='TOKEN', region='brazilsouth')
Pass your API key and URL to the initializer:
from tts_wrapper import WatsonClient
client = WatsonClient(credentials=('API_KEY', 'API_URL'))
These clients dont't require authorization since they run offline.
from tts_wrapper import PicoClient, SAPIClient
client = PicoClient()
# or
client = SAPIClient()
By default, all audio will be a wave file but you can change it to a mp3 using the format
option:
tts.synth('<speak>Hello, world!</speak>', 'hello.mp3', format='mp3)
Licensed under the MIT License.
FAQs
TTS-Wrapper makes it easier to use text-to-speech APIs by providing a unified and easy-to-use interface.
We found that tts-wrapper 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.