diff --git a/setup.cfg b/setup.cfg index 0b988c4..869fc2e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = edge-tts -version = 2.0.6 +version = 2.0.7 author = rany author_email = ranygh@riseup.net description = Microsoft Edge's TTS diff --git a/src/edgeTTS/__init__.py b/src/edgeTTS/__init__.py index 73e4313..8ecb555 100755 --- a/src/edgeTTS/__init__.py +++ b/src/edgeTTS/__init__.py @@ -120,7 +120,7 @@ class Communicate: message+="" + "" + text + '' return message - async def run(self, msg, sentenceBoundary=False, wordBoundary=False, codec="audio-24khz-48kbitrate-mono-mp3", voice="Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)", pitch="+0Hz", rate="+0%", volume="+0%", customspeak=False): + async def run(self, msgs, sentenceBoundary=False, wordBoundary=False, codec="audio-24khz-48kbitrate-mono-mp3", voice="Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)", pitch="+0Hz", rate="+0%", volume="+0%", customspeak=False): sentenceBoundary = str(sentenceBoundary).lower() wordBoundary = str(wordBoundary).lower() @@ -128,6 +128,9 @@ class Communicate: wsmax = 2 ** 16 overhead = len(self.mkssmlmsg("", voice, pitch, rate, volume, customspeak=False).encode('utf-8')) msgs = _minimize(escape(removeIncompatibleControlChars(msg)), b" ", wsmax - overhead) + else: + if type(msgs) is str: + msgs = [msgs] async with websockets.connect( wssUrl + "&ConnectionId=" + connectId(),