LoginSignup
1
1

More than 3 years have passed since last update.

Raspberry PiでGoogle Assistantを試した時のInvalid sample rate エラーの対処法

Posted at

Raspberry Piでgoogle assistantを入れてgoogle homeみたいに使うという記事はたくさんあるので、手順はそちらで確認してください。
今回は、その時に自分が以下のエラーで時間を取られたのでそのメモです。

動作環境

Raspberry Pi 3B
OS: Rasbian
HDMI接続でスピーカ出力
USBマイク使用

エラー

以下のコードを実行します

googlesamples-assistant-pushtotalk --project-id <your project id> --device-model-id <your model id>

エラーメッセージ

sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]

Invalid sample rateね、なるほど。
とにかく音声のサンプルrateが変なのでそこを直します。

対処法

.asoundrc
というファイルの中身に一行
rate 16000
を足します!それだけ!
参考URL: https://github.com/googlesamples/assistant-sdk-python/issues/155
場所はpcm.speaker{}の中です。

.asoundrc
pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}
pcm.mic {
  type plug
  slave {
    pcm "hw:1,0"
  }
}
pcm.speaker {
  type plug
  slave {
    pcm "hw:0,0"
    rate 16000 #これが必要!!!!!!!!!
  }
}

これで自分は動きました。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1