rhasspy / wyoming-satellite

Remote voice satellite using Wyoming protocol
MIT License
578 stars 83 forks source link

Use different pipelines depending on the wakeword #7

Open bogorad opened 8 months ago

bogorad commented 8 months ago

e.g., "hey Claude" for Anthropic, "Hey Gemini" for google, etc.

HarvsG commented 8 months ago

I started a feature request: https://community.home-assistant.io/t/voice-multiple-voice-assistants-1-wake-word-and-pipeline/658620

bogorad commented 8 months ago

I started a feature request:

voted :)

pkkrusty commented 7 months ago

Also voted.

llluis commented 7 months ago

You can already have this in the current version: start 2 satellites. :) I have it working with 2 different wake words connected to different pipelines. This is great for having different languages or test different assistants without breaking the current one.

With 2 assistants running on a Raspberry Pi Zero 2, it rarely stays beyond 20% CPU. I'm using local wake word with openwakeword.

To have it done, you have to configure audio (alsa) to allow sharing mic and output. You have also to manually specify the zeroconf host name (as the default is the mac address) and configure different ports for each.

@synesthesiam I would suggest to change the zeroconf host name from the mac to the satellite name so that would be transparent. If you agree, I can send a PR.

bogorad commented 7 months ago

I'm using local wake word with openwakeword.

are you running one copy of OWW?

llluis commented 7 months ago

I'm using local wake word with openwakeword.

are you running one copy of OWW?

No, one pair openwakeword + satellite per assistant (responding to different wake words). The led service is the same and respond to both instances of the satellite.

llluis commented 7 months ago

I'm using local wake word with openwakeword.

are you running one copy of OWW?

Your question got me thinking and I decided to look at the code and give it a try. It happens @synesthesiam is brillant: OpenWakeWord already supports multiple WW at the same time.

So, you need just one copy of OWW with multiple pre-load arguments, one for each word.

And then you can run as many satellites as you want, connected to the same service and it all works great. And no more CPU increase and the word detection is the only (and now single) heavy process.

I would mark this issue as closed. :)

bogorad commented 7 months ago

I would mark this issue as closed. :)

nope :)

llluis commented 7 months ago

I would mark this issue as closed. :)

nope :)

The reason being… ?

bogorad commented 7 months ago

The reason being… ?

Because it's a waste. If I want three languages and HA control, it'd be four instances of W-Satellite.

HarvsG commented 7 months ago

I would mark this issue as closed. :)

nope :)

The reason being… ?

Also, as far as I can tell, whilst it might support > 1 wakeword it doesn't trigger >1 pipeline in most use cases users want one pipeline per wakeword. Also it would be good if the entities were also created per wakeword.

bogorad commented 7 months ago

far as I can tell, whilst it might support > 1 wakeword it doesn't trigger >1 pipeline

this solution does.

llluis commented 7 months ago

Also, as far as I can tell, whilst it might support > 1 wakeword it doesn't trigger >1 pipeline in most use cases users want one pipeline per wakeword. Also it would be good if the entities were also created per wakeword.

The wake word service just trigger the satelitte (s). Each satellite instance have it's own pipeline and own entities in home assistant and are independent.

In my test setup, each wake word responds in different language from different assistants in HA.

bogorad commented 6 months ago

To have it done, you have to configure audio (alsa) to allow sharing mic and output. You have also to manually specify the zeroconf host name (as the default is the mac address) and configure different ports for each.

How were you able to do that? I configured alsa and was able to record from two processes running on the host, but inside docker one container somehow gets exclusive access.

/etc/asound.conf:

pcm.multimic {
    type dsnoop
    ipc_key 1025
    ipc_perm 0666
    slave {
        pcm "hw:CARD=P3200M,DEV=0"
        channels 1
    }
}

and docker-compose:

  sat-chewbacca:
    image: w-sat
    container_name: sat-chewbacca
    hostname: sat-chewbacca
    privileged: true
    devices:
      - /dev/snd
    group_add:
      - 29
    volumes:
      - /etc/asound.conf:/etc/asound.conf:ro
      - /usr/share/alsa:/usr/share/alsa:ro
    ports:
      - "10100:10100"
    command:
      - "--uri"
      - "tcp://0.0.0.0:10100"
      - "--name"
      - "dining-chewbacca"
      - "--mic-command"
      - "arecord -r 16000 -c 1 -f S16_LE -t raw -D multimic"
      - "--snd-command"
      - "aplay   -r 22050 -c 1 -f S16_LE -t raw -D plughw:CARD=P3200M,DEV=0 --nonblock"
      - "--debug"
      - "--wake-word-name"
      - "hey_chewbacca"
      - "--wake-uri"
      - "tcp://oww:10400"
ddppddpp commented 4 months ago

You can already have this in the current version: start 2 satellites. :) I have it working with 2 different wake words connected to different pipelines. This is great for having different languages or test different assistants without breaking the current one.

With 2 assistants running on a Raspberry Pi Zero 2, it rarely stays beyond 20% CPU. I'm using local wake word with openwakeword.

To have it done, you have to configure audio (alsa) to allow sharing mic and output. You have also to manually specify the zeroconf host name (as the default is the mac address) and configure different ports for each.

@synesthesiam I would suggest to change the zeroconf host name from the mac to the satellite name so that would be transparent. If you agree, I can send a PR.

Can you please share how you managed to configure alsa so that the mic and speaker are shared between 2 satellite processes?

arischmod commented 3 months ago

Voted ;)