Comments (11)
You can do it in two ways:
-
Using
aspeak
API, but the API might change in future versions (The API is not considered stable now. That's why I didn't document it in README.md).from aspeak import Synthesizer
Create a
Synthesizer
instance. Here is the constructor:aspeak/src/aspeak/synthesizer.py
Lines 10 to 12 in 5d452b8
For
audio_config
andaudio_format
, please refer to azure cognitive services documentation. You can also look at__main__.py
and figure it out by yourself.Call
text_to_speech
/ssml_to_speech
method at your choice:
aspeak/src/aspeak/synthesizer.py
Line 67 in 5d452b8
aspeak/src/aspeak/synthesizer.py
Line 70 in 5d452b8
-
Using
azure-cognitiveservices-speech
directly.
You can useaspeak
to obtain a trial token (Note that the token will expire after a short period of time. A call torenew()
will renew the token):from aspeak import Token token = Token()
Then you can use Microsoft's official
azure-cognitiveservices-speech
with this trial token.
Here is an example to create an instance ofSpeechConfig
using a trial token:import azure.cognitiveservices.speech as speechsdk cfg = speechsdk.SpeechConfig(auth_token=token.token, region=token.region)
from aspeak.
I did manage to synthesize it but over time it's stops working, so I assume it's the token being expired. I did try to make a define to renew the token on keyboard press but it didn't work, as it seemed like I needed to return it; could you give me a concrete example on how to refresh the token?
from aspeak.
I did manage to synthesize it but over time it's stops working, so I assume it's the token being expired. I did try to make a define to renew the token on keyboard press but it didn't work, as it seemed like I needed to return it; could you give me a concrete example on how to refresh the token?
If you are using the Synthesizer
API, it should handle the expiration automatically.
If you just use aspeak
as a way to obtain a token and then use azure-cognitiveservices-speech
directly, you need to recreate the SpeechConfig
object after you renewed the token.
from aspeak.
An easy to use python API is on the way(#12 ), I will provide examples after implementing that feature.
from aspeak.
Using the second method, I just can't call simply Token.renew()
, doesn't work.
from aspeak.
Using the second method, I just can't call simply
Token.renew()
, doesn't work.
Yes, you need to recreate SpeechConfig
and even SpeechSynthesizer
after the renew.
from aspeak.
When will you get the API running?
from aspeak.
When will you get the API running?
Maybe I will release a preview version this weekend.
from aspeak.
When will you get the API running?
A prerelease version v2.0.0.dev1 has been released. I will write the documentations later. There are examples in https://github.com/kxxt/aspeak/tree/feat/api/src/examples
from aspeak.
The functional API has been stabilized in v2.0.0.dev2
Documentation available at https://github.com/kxxt/aspeak/blob/feat/api/DEVELOP.md
from aspeak.
from aspeak.
Related Issues (20)
- hyper-0.14.25.crate: 1 vulnerabilities (highest severity is: 7.5) - autoclosed HOT 1
- Add an CLI arg to disable colored output HOT 1
- Add `audio` feature for crate HOT 2
- the free version may refer to this page:https://speech.microsoft.com/audiocontentcreation HOT 2
- Better error handling HOT 1
- Pass key/auth token via environment variable HOT 1
- Add support get voice list in lib HOT 1
- Question #19017 HOT 1
- No examples on v5.2.0 HOT 3
- Provide REST Mode HOT 3
- feat: batch processing API HOT 2
- tokio-tungstenite-0.19.0.crate: 4 vulnerabilities (highest severity is: 9.1) - autoclosed HOT 1
- reqwest-0.11.18.crate: 1 vulnerabilities (highest severity is: 5.5) - autoclosed HOT 1
- Python Binding: provide .pyi file
- colored-2.0.0.crate: 1 vulnerabilities (highest severity is: 9.8) - autoclosed HOT 1
- aspeak does not support python3.9 or above HOT 1
- Publish python wheels for apple silicon Macs HOT 1
- tokio-tungstenite-0.20.1.crate: 1 vulnerabilities (highest severity is: 7.5) - autoclosed HOT 1
- 400 error HOT 3
- tokio-tungstenite-0.21.0.crate: 2 vulnerabilities (highest severity is: 7.5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspeak.