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.1: Text-to-speech is currently available.
Quick Start
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.1.tar.gz
(7.3 kB
view details)
Built Distribution
media-0.1.1-py3-none-any.whl
(7.2 kB
view details)
File details
Details for the file media-0.1.1.tar.gz
.
File metadata
- Download URL: media-0.1.1.tar.gz
- Upload date:
- Size: 7.3 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 | 6fc5232ff71b1db742c76502a8859e94b8de95ebf1d2c6488570aafc5c21f5c6 |
|
MD5 | 50ed59f01b35517b12c73df58847cc05 |
|
BLAKE2b-256 | d16109c0a0b5a18ace63b0e880024ece29d5f275a8cb81b7b1dd86d5f4bc3a93 |
File details
Details for the file media-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: media-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.2 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 | 6c20c70a22a46c0fa271bd0549f2bdacfe4f6ddb92cdef923dae12053b8b3d29 |
|
MD5 | d58a49af7e5b0f4ff643d2dc3f4beba6 |
|
BLAKE2b-256 | eaec8ceb464295eba2112f380cbe7fb84d96476e3cec02c3ad3720f7d3361f20 |