Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ei-grad
Created May 18, 2019 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ei-grad/447bd0c867ed73d8e29e598c01e7555a to your computer and use it in GitHub Desktop.
Save ei-grad/447bd0c867ed73d8e29e598c01e7555a to your computer and use it in GitHub Desktop.
speech2text command using Yandex SpeachKit
#!/bin/bash
if [ -z "$YC_API_KEY" ]; then
cat << EOF
Yandex Cloud API Key is needed:
https://cloud.yandex.ru/docs/iam/concepts/authorization/api-key
it would require some hustle with service account and roles:
https://cloud.yandex.ru/docs/speechkit/security/
You can also adjust this script to use the token-based auth, if you like.
Contributions are welcome.
EOF
exit 1
fi
curl \
-X POST \
-v \
-H "Transfer-Encoding: chunked" \
-H "Content-Type: audio/ogg" \
-H "Authorization: Api-Key $YC_API_KEY" \
--data-binary @<(rec -twav - silence 1 0.1 3% 1 1.0 3% | opusenc - -) \
'https://stt.api.cloud.yandex.net/speech/v1/stt:recognize?topic=general'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment