This is light demo of Telethon, Yandex Speech Kit and telegram capabilities to improve your life a bit. You can run this bot and recognize annoying audio messages to text if you dislike them or simply can't listen right away.
You can try @sp2txt_bot yourself. Just record a voice message, or forward one and wait couple of seconds.
- Get your Yandex.SpeechKit API key at Yandex Developer Center. Paste it inside
- Make sure Bot Father approves of your intentation to create another bot. If so, get a token.
- Install dependencies required for audio processing.
$ sudo apt-get update && apt-get install ffmpeg
# or, for Mac
$ brew install ffmpeg
Installation tested on Debian Wheezy and Ubuntu 16.04. If you have troubles with opus-tools, check out notes below.
- Install dependancies and run bot with:
$ git clone https://github.com/Hiyorimi/speech2textbot.git
$ cd speech2textbot
$ cp env_example .env
$ pipenv shell
(speech2textbot)$ pipenv install
You can also paste key directly in code, it's a bit dirty. In that case, provide a token when launching a bot
$ sed -i "s/SPEECH_KIT_API\ \=\ ''/SPEECH_KIT_API\ \=\ 'your-yandex-speech-kit-api-here'/g" speech2textbot.py
On Mac you should add '' after -i:
$ sed -i '' "s/\=\ ''/\=\ 'your-yandex-speech-kit-api-here'/g" speech2textbot.py
(speech2textbot)$ python speech2textbot.py
$ docker build -t speech2txtbot_docker .
$ docker run -d --name=speech2txtbot speech2txtbot_docker
docker run -d --name=speech2txtbot speech2txtbot_docker /bin/sh -c "while true; do sleep 2; df -h; done"
docker exec -it speech2txtbot /bin/sh
I would be grateful for any ideas for improvement, feel free to fork, copy and modify.
You can register your BOTAN_TOKEN at @Botaniobot to track bot users. Don't forget to include token into your .env file.
If you can't build audiotools and fail to install opus-tools and opusfile from packages, you might want to build OPUS from source.
Since there is no installation guide, some tips. First of all, install system libs:
$ apt-get install vorbis-tools libogg-dev libmpg123 libmp3lame-dev libmp3lame0 ffmpeg
- Get opus, opus-tools and opusfile archives, unpack them with tar -xzf [file]
- cd into directory and run
$ ./configure
$ ./make
$ ./make install
You might need to install additional dependencies.