marcusmolchany / polly-telegram-bot

Telegram bot that runs on AWS Lambda and takes text and converts it to an audio file using AWS Polly
3 stars 2 forks source link

Convert Polly file to OGG Opus #1

Open marcusmolchany opened 7 years ago

marcusmolchany commented 7 years ago

Currently the call to aws polly returns an mp3 and is sent to telegram as an audio file sendAudio. Ideally we would use the sendVoice command so that the audio file would appear as a voice message. Polly can only return mp3, ogg vorbis or raw pcm audio files. Telegram can only send ogg opus files as voice messages.

We need a way to convert the polly synthesized file into an ogg opus file.

https://core.telegram.org/bots/api/#sendvoice http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Polly.html#synthesizeSpeech-property

alialeksandr commented 7 years ago

Hello! Don't you know if this issue is solved in some way?

marcusmolchany commented 7 years ago

Hey @alialeksandr, it looks like the sendVoice command still only works with ogg opus. I think your best bet is to use node-ogg to decode the ogg vorbis file and encode that as an ogg opus file.