Metadata-Version: 2.1
Name: media
Version: 0.1.4
Summary: A Media Toolkit. Text-to-speech is currently available.
Home-page: https://ahamega.com/support
Author: leesoar
Author-email: core@111.com
License: MIT
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.4: Fixed some issues.
        * 0.1.3:
            * Added phonemes to improve pronunciation.
            * Updated the documentation.
        * 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
        > See "[Get the keys for your resource - Azure](https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource)"
        
        ### Text-to-speech
        ```python
        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)
        ```
        
        ### Use phonemes to improve pronunciation
        ```python
        from media import Voice, SSML
        
        voice = Voice("YourSubscriptionKey", "YourServiceRegion")
        ssml = SSML()
        # If you want to modify the phoneme of a word, add '[]' in text
        ssml.voice = {
            "text": "His name is Mike [Zhou]",
            "phonemes": [{
                "word": "Zhou",
                "alphabet": "ups",  # default: sapi
                "ph": "JH AU",
            }]
        }
        voice.speak(ssml)
        ```
        > The values ​​of `alphabet` and `ph` can refer to here, see: "[Use phonemes to improve pronunciation - Azure](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/speech-synthesis-markup?tabs=csharp#use-phonemes-to-improve-pronunciation)"
        
        ### Error detection
        ```python
        success = voice.speak()
        if not success:
            # do something...
            print(voice.error)
            # do something...
        ```
        
        ### View the generated XML for SSML
        ```python
        from media import SSML
        
        ssml = SSML()
        # for human
        print(ssml)
        # for program
        ssml.dump()
        ```
        
        ## Full Example
        Text-to-speech, in a different tone.
        ```python
        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:
        ```python
        voice.save(ssml)
        ```
        
        If you want to save and customize the name or location:
        ```python
        voice.save(ssml, path="这是可以说的吗.mp3")
        ``` 
Keywords: media,text-to-speech,azure
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.3.0
Description-Content-Type: text/markdown
