[アップデート] リアルタイム音声会話が可能な音声合成モデルとして、 Amazon Nova Sonic が登場しました
こんにちは!クラウド事業本部コンサルティング部のたかくに(@takakuni_)です。
リアルタイム音声会話が可能な音声合成モデルとして、 Amazon Nova Sonic が登場しました。
Amazon Nova Sonic
Amazon Nova Sonic は音声データをインプットとして、音声やテキストを生成する LLM です。
Converse のような従来のリクエスト/レスポンスパターンとは異なり、双方向のストリーミング API(InvokeModelWithBidirectionalStream)を利用することで、リアルタイムにインタラクティブな会話を実現しています。
ニュアンスの理解
Amazon といえば、 Alexa が音声認識可能な AI アシスタントとして広く認識されています。
今回の Amazon Nova とはどのように違うのでしょうか。Amazon 側のニュース記事が非常に参考になりました。
Alexa で難しかった会話の中で生まれるニュアンスの理解を、音声理解と音声生成を単一のモデルに統合することで Amazon Nova では実現しているようです。
Today Amazon announced Amazon Nova Sonic, a new foundation model that unifies speech understanding and speech generation into a single model, to enable more human-like voice conversations in AI applications.
後ほど解説しますが、LLM との会話は一連のセッションを通じて行われており、会話のコンテキストを維持しながら、回答を生成します。
また、従来の音声認識 AI アシスタントでは、音声認識、理解と応答生成を行う LLM、テキスト読み上げを複数のサブシステムで組み合わせて作成されていたアプローチだったのが、Nova Sonic では音声認識からテキスト読み上げまでオールインワンで実装しているため、話し手の自然な間やためらいまでも理解して通話できるようになっています。
Nova Sonic takes a new approach to solve these challenges. Instead of using different models, it unifies the understanding and generation capabilities into a single model. This unification enables the model to adapt the generated voice response to the acoustic context (e.g., tone, style) and the spoken input, resulting in more natural dialogue. Nova Sonic even understands the nuances of human conversation, including the speaker’s natural pauses and hesitations, waiting to speak until the appropriate time, and gracefully handling barge-ins.
一連の流れ
Nova Sonic との一連の流れは以下になります。
- セッションの初期化
- 入力ストリームの開始
- システムプロンプトの理解
- オーディオから入力をストリーミング形式で取得
- Tool Use の返答(必要に応じて)
- アプリケーションの応答(必要に応じて)
- Tool Use の結果を返す(必要に応じて)
- 出力ストリーム
- トランスクリプトの生成(自動音声認識)
- Tool Use の返答(必要に応じて)
- オーディオ出力
Python 向け Amazon Nova Sonic 用 SDK のリリース
実験的なと表記されているため、GA しているのかが微妙なニュアンスですが、 Python 向けに新たに aws_sdk_bedrock_runtime
がリリースされています。
Python developers can use this new experimental SDK that makes it easier to use the bidirectional streaming capabilities of Amazon Nova Sonic.
他の SDK でも対応予定とのことでした。
Python developers can use this new experimental SDK that makes it easier to use the bidirectional streaming capabilities of Amazon Nova Sonic. We’re working to add support to the other AWS SDKs.
ラップされていない通常の SDK の場合は、他の言語でもサポートされています。
やってみる
前置きが長くなりましたが、実際に触ってみましょう。サンプルコードが用意されているため、今回はこちらを利用します。
README に記載されている通りに環境準備を進めます。
# Create a virtual environment
python -m venv .venv
# Activate the virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
# .venv\Scripts\activate
python -m pip install -r requirements.txt --force-reinstall
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-east-1"
途中、portaudio
が見つからないエラーが発生する可能性があります。
(.venv) takakuni@ console-python % python -m pip install -r requirements.txt --force-reinstall
Collecting pyaudio>=0.2.13 (from -r requirements.txt (line 1))
Using cached PyAudio-0.2.14.tar.gz (47 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting rx>=3.2.0 (from -r requirements.txt (line 2))
Using cached Rx-3.2.0-py3-none-any.whl.metadata (4.6 kB)
Collecting smithy-aws-core>=0.0.1 (from -r requirements.txt (line 3))
Using cached smithy_aws_core-0.0.1-py3-none-any.whl.metadata (432 bytes)
Collecting pytz (from -r requirements.txt (line 4))
Using cached pytz-2025.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting aws_sdk_bedrock_runtime (from -r requirements.txt (line 5))
Using cached aws_sdk_bedrock_runtime-0.0.2-py3-none-any.whl.metadata (1.9 kB)
Collecting aws-sdk-signers (from smithy-aws-core>=0.0.1->-r requirements.txt (line 3))
Using cached aws_sdk_signers-0.0.3-py3-none-any.whl.metadata (3.4 kB)
Collecting smithy-core (from smithy-aws-core>=0.0.1->-r requirements.txt (line 3))
Using cached smithy_core-0.0.2-py3-none-any.whl.metadata (347 bytes)
Collecting smithy-http (from smithy-aws-core>=0.0.1->-r requirements.txt (line 3))
Using cached smithy_http-0.0.1-py3-none-any.whl.metadata (366 bytes)
Collecting smithy-aws-event-stream<0.1.0 (from aws_sdk_bedrock_runtime->-r requirements.txt (line 5))
Using cached smithy_aws_event_stream-0.0.1-py3-none-any.whl.metadata (192 bytes)
Collecting smithy-json<0.1.0 (from aws_sdk_bedrock_runtime->-r requirements.txt (line 5))
Using cached smithy_json-0.0.1-py3-none-any.whl.metadata (396 bytes)
Collecting awscrt>=0.23.10 (from smithy-http[awscrt]<0.1.0->aws_sdk_bedrock_runtime->-r requirements.txt (line 5))
Using cached awscrt-0.26.1-cp311-abi3-macosx_10_15_universal2.whl.metadata (7.0 kB)
Collecting ijson>=3.3.0 (from smithy-json<0.1.0->aws_sdk_bedrock_runtime->-r requirements.txt (line 5))
Using cached ijson-3.3.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (21 kB)
Using cached Rx-3.2.0-py3-none-any.whl (199 kB)
Using cached smithy_aws_core-0.0.1-py3-none-any.whl (12 kB)
Using cached pytz-2025.2-py2.py3-none-any.whl (509 kB)
Using cached aws_sdk_bedrock_runtime-0.0.2-py3-none-any.whl (72 kB)
Using cached smithy_aws_event_stream-0.0.1-py3-none-any.whl (14 kB)
Using cached smithy_core-0.0.2-py3-none-any.whl (53 kB)
Using cached smithy_http-0.0.1-py3-none-any.whl (35 kB)
Using cached smithy_json-0.0.1-py3-none-any.whl (8.9 kB)
Using cached aws_sdk_signers-0.0.3-py3-none-any.whl (21 kB)
Using cached awscrt-0.26.1-cp311-abi3-macosx_10_15_universal2.whl (3.2 MB)
Using cached ijson-3.3.0-cp312-cp312-macosx_11_0_arm64.whl (56 kB)
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyaudio (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
/private/var/folders/39/6fw1g3mx65jbvjcr74h2s27w0000gn/T/pip-build-env-_4c34e_1/overlay/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
********************************************************************************
Please consider removing the following classifiers in favor of a SPDX license expression:
License :: OSI Approved :: MIT License
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
self._finalize_license_expression()
running bdist_wheel
running build
running build_py
creating build/lib.macosx-14.5-arm64-cpython-312/pyaudio
copying src/pyaudio/__init__.py -> build/lib.macosx-14.5-arm64-cpython-312/pyaudio
running build_ext
building 'pyaudio._portaudio' extension
creating build/temp.macosx-14.5-arm64-cpython-312/src/pyaudio
clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -DMACOS=1 -I/usr/local/include -I/usr/include -I/opt/homebrew/include -I/Users/takakuni/Desktop/amazon-nova-samples/speech-to-speech/sample-codes/console-python/.venv/include -I/Users/takakuni/.asdf/installs/python/3.12.4/include/python3.12 -c src/pyaudio/device_api.c -o build/temp.macosx-14.5-arm64-cpython-312/src/pyaudio/device_api.o
src/pyaudio/device_api.c:9:10: fatal error: 'portaudio.h' file not found
9 | #include "portaudio.h"
| ^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyaudio)
以下の記事にしたがい、Homebrew でインストールしました。
brew install portaudio
アプリケーションを実行してみましょう。
python python nova_sonic.py
マイクアクセスが問われるため、有効化します。
Amazon Nova Sonic とお話ししてみました。リアルタイムに会話できていますね。
制限事項
いくつか制約事項があるため最後に紹介します。
まず初めにリージョンはバージニア北部で提供されています。
また、言語は英語(アメリカ英語、イギリス英語)が提供されており、それぞれ ID が割り振られています。
ちなみに、多言語対応を予定しているそうです。
At launch, Amazon Nova Sonic provides robust speech understanding for American and British English across various speaking styles and acoustic conditions, with additional languages coming soon.
コンテキスト長は 32 K でセッション最大時間はデフォルトで 8 分です。
Amazon Nova Sonic handles user interruptions gracefully without dropping the conversational context and is robust to background noise. The model supports a context window of 32K tokens for audio with a rolling window to handle longer conversations and has a default session limit of 8 minutes.
料金面は以下のとおりです。
- Price per 1,000 input tokens
- Speech:$0.0034
- Text:$0.00006
- Price per 1,000 output tokens
- Speech:$0.0136
- Text:$0.00024
Text の料金は、音声からテキストへの文字起こし、Tool Use や会話履歴の追加などのケースで利用します。
最新情報は Amazon Bedrock の料金ページをご覧ください。
まとめ
以上、「リアルタイム音声会話が可能な音声合成モデルとして、 Amazon Nova Sonic が登場しました」でした。普段私は音声認識を使っていないため、サンプルアプリケーションを動かしただけで、非常に感動してしまいました。
Tool Use などを組み合わられれば、普段の生活にエージェントが出てくるような予感がしました。
このブログがどなたかの参考になれば幸いです。クラウド事業本部コンサルティング部のたかくに(@takakuni_)でした!