とりあえず無料体験版。subscription keyが必要なので登録しておく。
- 5,000 トランザクション (各機能につき 1 分あたり 20 回)。
- エンドポイント: https://api.cognitive.microsoft.com/sts/v1.0
- キー 1: a1ca82ec719246069d33b9bae105a185(これはもちろん偽物)
- キー 2: b6dd564df62b4c31b03a448eec8cccc1
- rest apiとclient librariesの2通りある。client librariesはc#, java, javascript, obj-cで使えて、websocketを使っているのでrest apiより長時間の音声認識が可能。
公式サイトにこんな表があるので、client librariesを使った方が良さそう(markdownの表を書きたくなったのでわざわざ書いた)。
use cases | rest apis | client libraries |
---|---|---|
Convert a short spoken audio, for example, commands (audio length < 15 s) without interim results | Yes | Yes |
Convert a long audio (> 15 s) | No | No |
Stream audio with interim results desired | No | Yes |
Understand the text converted from audio using LUIS | No | Yes |
以下はいじってみたい人向け。音声認識を試すだけならgithubリポジトリのreadmeにlink to the sampleというのがあって、そこから試すことができるので、自分でインストールする必要はない。(この場合もsubscription keyは必要)
javascriptのサンプルをインストール
npmとgulpが必要なので事前にインストール。
ここの通りにnodeをインストール。これでnpmもインストールされる。その後、ここの通りにgulpをインストール。以下、そのコマンド。
sudo yum install -y gcc-c++ make
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum install -y nodejs
sudo npm install -g npm
cd [speech apiのリポをクローンするディレクトリ]
npm init # 適当に作る
sudo npm install -g gulp # グローバル
sudo npm install gulp --save # ローカル
次に、サンプルをgithubからクローンして使う。以下の手順はここを参考に。
git clone https://github.com/Azure-Samples/SpeechToText-WebSockets-Javascript
cd SpeechToText-WebSockets-Javascript
npm run bundle
これで完了。
speech to textを試す
SpeechToText-WebSockets-Javascript/samples/browser/Sample.html
をブラウザで開くと試せる。こんな感じ。言語選択、マイク入力かオーディオファイル(wav)か、などを選べる。