alekssamos / msspeech

not official API for Microsoft speech synthesis from Microsoft Edge web browser read aloud
https://pypi.org/project/msspeech/
57 stars 10 forks source link

(problem and solution) save the audio in data buffer #61

Open emmendoza2794 opened 7 months ago

emmendoza2794 commented 7 months ago

@alekssamos Thank you very much for this tool, I barely know it and it is perfect for some projects I am working on.

Problem: When trying to save the audio file in a data buffer, the following error is displayed

msspeech/__init__.py, line 520, in _synthesize

     bc += await f.write(resp[1])

TypeError: object int can't be used in 'await' expression

My code

file = BytesIO()
await mss.synthesize(data.text.strip(), file)
file.seek(0)

Solution: remove the await and it worked for me.