A Media Toolkit. Text-to-speech is currently available.
Project description
Media
A Media Toolkit.
Text-to-speech is currently available.
Other features will be developed in the future.
Thanks for Microsoft Azure!
Release Note
-
0.1.2:
- Added a link to the official site (Azure) to get the key
- Fixed some issues.
-
0.1.1: Text-to-speech is currently available.
Quick Start
Get the keys
Text-to-speech
from media import Voice
text = "One Piece! Dragon Ball! Doraemon! Naruto!"
voice = Voice("YourSubscriptionKey", "YourServiceRegion")
# use English
voice.speak(text)
# use Japanese
voice.speak(text, lang=Voice.LANG.JA_JP, voice_name=Voice.NAME.FEMALE.JA_JP_NANAMI)
# Save the voice file to the local
voice.save(text)
View the generated XML for SSML
from media import SSML
ssml = SSML()
# for human
print(ssml)
# for program
ssml.dump()
Full Example
Text-to-speech, in a different tone.
from media import Voice, SSML
voice = Voice("YourSubscriptionKey", "YourServiceRegion")
ssml = SSML(lang=SSML.LANG.ZH_CN, voice_name=SSML.NAME.FEMALE.ZH_CN_XIAO_XUAN)
ssml.voice = "啊?"
ssml.voice = {
"text": "这是可以说的吗?",
"role": SSML.ROLE.YOUNG_ADULT_FEMALE,
"style": SSML.STYLE.CHEERFUL,
"rate": SSML.RATE.MEDIUM,
}
ssml.voice = {
"text": "啊,可以可以",
"name": SSML.NAME.FEMALE.ZH_CN_XIAO_MO,
"style": SSML.STYLE.FEARFUL,
"role": SSML.ROLE.OLDER_ADULT_FEMALE,
"degree": "2",
}
ssml.voice = {
"text": "没事没事",
"name": SSML.NAME.FEMALE.ZH_CN_XIAO_MO,
"style": SSML.STYLE.SAD,
"role": SSML.ROLE.OLDER_ADULT_FEMALE,
"degree": "2",
"rate": SSML.RATE.FAST,
}
# It will play the generated speech
voice.speak(ssml)
If you want to save:
voice.save(ssml)
If you want to save and customize the name or location:
voice.save(ssml, path="这是可以说的吗.mp3")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
media-0.1.2.tar.gz
(7.5 kB
view details)
Built Distribution
media-0.1.2-py3-none-any.whl
(7.4 kB
view details)
File details
Details for the file media-0.1.2.tar.gz
.
File metadata
- Download URL: media-0.1.2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.0.2rc1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e2da18cf13d31d80dcbb13631203e3ec3e93683b1e6231782c59ccfff6aca06 |
|
MD5 | 49057f5d2e0003d24220981b87da6e1b |
|
BLAKE2b-256 | df9ac49057707d95980cb93e25ac1d88839f75846a83f6473a31a9e85ae44325 |
File details
Details for the file media-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: media-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.0.2rc1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 736576f88c21f7d6a9e4ce128f9f4816af5ae08e467bc25a89a0fc1b3b9447b8 |
|
MD5 | 769ece9edb02bfa238f98e3dc5498d2d |
|
BLAKE2b-256 | f9c56e4f999386899473a548853102de34ea75f9a6c6f93187ac3f5962c33cb0 |