Skip to main content

not official API for Microsoft speech synthesis from Microsoft Edge web browser read aloud

Project description

msspeech

not official API for Microsoft speech synthesis from Microsoft Edge web browser read aloud

Installation

pip install --upgrade msspeech

or

poetry add msspeech

After updating an already installed library To update the list of voices, run the command in your terminal:

msspeech-update-voices

or

poetry run msspeech-update-voices

Notes

Bad news

Since the first of July 2022, the list of voices and the API as a whole has been very much limited!

But there is also good news

They returned back some male voices and added new languages, as well as made support for emotional styles. Despite the fact that styles appeared in JSON, you still won't be able to use them, SSML does not perceive them. SSML is very limited here, so there is no point in supporting it.

The official documentation is not suitable for this API. It seems this API uses undocumented SSML markup.

https://docs.microsoft.com/ru-ru/azure/cognitive-services/speech-service/language-support#text-to-speech

Using

the pitch and rate values are set as a percentage from -100 to +100, that is, it can be a negative, positive number, or zero for the default value.

examples: -30, 40, 0

The volume should be a fractional number from 0.1 to 1.0, but in fact it doesn't work for some reason.

The maximum synthesize text length is approximately 31000 characters per request.

from CLI

synthesize text:

msspeech Guy hello --filename audio.mp3

update voices list:

msspeech-update-voices

From python

import asyncio
from msspeech import MSSpeech


async def main():
	mss = MSSpeech()
	print("Geting voices...")
	voices = await mss.get_voices_list()
	print("searching Russian voice...")
	for voice in voices:
		if voice["Locale"] == "ru-RU":
			print("Russian voice found:", voice["FriendlyName"])
			await mss.set_voice(voice["Name"])


	print("*" * 10)
	filename = "audio.mp3"
	# with open("s.txt", encoding="UTF8") as f: text:str = f.read()
	text = "Или написать текст здесь"
	print("waiting...")
	await mss.set_rate(1)
	await mss.set_pitch(0)
	await mss.set_volume(1)
	await mss.synthesize(text.strip(), filename)
	print("*"*10)
	print("SUCCESS! OK!")
	print("*"*10)

if __name__ == "__main__":
	asyncio.run(main())

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

msspeech-3.7.8.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

msspeech-3.7.8-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file msspeech-3.7.8.tar.gz.

File metadata

  • Download URL: msspeech-3.7.8.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.10 Linux/5.15.0-1020-azure

File hashes

Hashes for msspeech-3.7.8.tar.gz
Algorithm Hash digest
SHA256 4491faf282a189164585386f558fcd9768488dd53d17cf619f95d5be50bcaca8
MD5 79bb756d867cc628a8b895381d71575e
BLAKE2b-256 68813077547c54082ddc65b383a5a39fd383bf83f7eb51f76993288c0ccd60cf

See more details on using hashes here.

Provenance

File details

Details for the file msspeech-3.7.8-py3-none-any.whl.

File metadata

  • Download URL: msspeech-3.7.8-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.10 Linux/5.15.0-1020-azure

File hashes

Hashes for msspeech-3.7.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5aec2c4f21e32489fcba99b16cfb06975dac3d454b675ee1fff54be9d9814c5a
MD5 27efa8d72e8d91eca44050ac9bed64da
BLAKE2b-256 7cb4791542bf0ae746d655912005ca5472dac262325ca2b5e27357791b2f4ada

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page