Skip to main content

Rhasspy 3 (v2)

ALSA

Lister les cartes audio:

arecord -l

aplay-l

Mettre par défaut une carte:

/etc/asound.conf

pcm.!default {
    type plug
    slave.pcm {
        type hw
        card 2
    }
}

Config

programs:
  mic:
    arecord:
      command: |
        arecord -q -r 16000 -c 1 -f S16_LE -t raw -
      adapter: |
        mic_adapter_raw.py --rate 16000 --width 2 --channels 1
  snd:
    mplayer:
      command: |
        mplayer - -cache 1024 -volume 7 -rawaudio channels=1:rate=22050:samplesize=2 -demuxer rawaudio
      adapter: |
        snd_adapter_raw.py --rate 22050 --width 2 --channels 1
  wake:
    porcupine1:
      command: |
        .venv/bin/python3 bin/porcupine_stream.py --model "${model}" "${sensitivities}" --lang_model "${lang_model}" 
      template_args:
        model: "${data_dir}/framboise_linux.ppn"
        lang_model: "${data_dir}/porcupine_params_fr.pv"
        sensitivities: "0.6"
  asr:
    whisper-cpp.client:
      command: |
        client_unix_socket.py var/run/whisper-cpp.socket
    larynx2:
      command: |
        client_unix_socket.py var/run/vosk.socket
  handle:
    date_time:
      command: |
        bin/date_time.py
      adapter: |
        handle_adapter_text.py
    ratatouille:
      command: |
        bin/converse.py "${url}"
      adapter: |
        handle_adapter_text.py
      template_args:
        url: "http://127.0.0.1:5555"
  tts:
    piper.client:
      command: |
        client_unix_socket.py var/run/piper.socket
servers:
  asr:
    whisper-cpp:
      command: |
        script/server "${data_dir}/ggml-small.bin"
    vosk:
      command: |
        script/server "${data_dir}/vosk-model-fr-0.22"
  tts:
    piper:
      command: |
        script/server "${model}"
      template_args:
        model: "${data_dir}/fr-siwis-low.onnx"

pipelines:
  default:
    mic:
      name: arecord
    wake:
      name: porcupine1
    asr:
      name: vosk.client
    handle:
      name: ratatouille
    tts:
      name: piper.client
    snd:
      name: mplayer

Customisation wake word

config/programs/wake/porcupine1/bin/porcupine_stream.py

if keyword_index >= 0:
    os.system("/usr/bin/mplayer -volume 10 /srv/rhasspy/media/long-oiseau.mp3 &>/dev/null &")
	write_event(
    ...

Tester tts

script/run bin/tts_speak.py 'Bonjour'

Tester ratatouille

echo "est-ce qu'il va pleuvoir de demain" | config/programs/handle/ratatouille/bin/converse.py http://10.10.10.11:5555