Microphone not working: Invalid number of channels

Latest attempt to get Rhasspy accept dsnoop was

defaults.pcm.rate_converter "samplerate"

pcm.!default {
   type asym
   playback.pcm "speaker"
   capture.pcm "array"
}

pcm.speaker {
    type plug
    slave.pcm "hw:Headphones"
}

pcm.array {
    type plug
    slave.pcm "dsnooparray"
}

pcm.dsnooparray {
    type dsnoop
    ipc_key 666666
    slave {
        pcm "hw:CameraB409241"
        channels 2
    }
}

in asound.conf

Then selecting arecord in Audio Recording dsnoop:CARD=CameraB409241,DEV=0 won’t give anything back. Only default:CARD=CameraB409241 will.

My microphone is a PS3eye but this won’t make a difference with any other I think.

Again sometimes its just easier to use plughw: and and difference in format and settings plug will resample.
hw: is direct and sometimes you can get errors on format, SR & channels.

Also I never use the device number anyway as apart from snd_aloop never use a card with multiple devices.

PS G morning all enjoy your coffee :slight_smile:

Dont use the dsnoop card directly. It doesn’t have any inbuilt conversion. Always use the abstracted array pcm or alsa default as this is where sample rate conversion and so on is inserted in the chain with it beeing of type plug.
You need to either manually define the usage array pcm or use alsa default.
Both the options you are choosing will either not work because of missing samplerate conversion or the second will work but will circumvent the dsnoop and access the hw directly i think.

Meaning if you set pcms then you can just call them direct with a arecord -D dsnooparray

PS just drop the channels setting for now and see how you go.
Rhaspy prob wants mono

   channels 4
   }
 route_policy sum
}

But that does create weird notch filters that the PS3 prob flattened with eq.
You can not really do it as its eq is very different if sound is coming front or back to from the sides.

The problem of @kart-able is that he wants to still be able to record from the mic even if Rhasspy is using it.
The asound he posted above works no problem for recording from it with multiple devices (i tested that). Just not with Rhasspy as it doesn’t seem to want to just use the dafault with arecord.

Yeah why I posted the above as it sums to mono as rhasspy calls a mono stream doesn’t it?

Or set just a single channel as rhasspy should be able to use the default but also from memory if you do a search you can add a hint description and that should list the pcms in the gui.

Very good idea @rolyan_trauts
@kart-able add this to your asound.conf in the array pcm:

pcm.array {
    type plug
    slave.pcm "dsnooparray"
    hint {
        show on
        description "this is an array"
    }
}

and see if Rhasspy lists the array pcm for you to choose in the dropdown.

Ps:
@4cello this could also be something for you to try

1 Like

You can’t add that to a dsnoop pcm. You would have to also insert that into the abstracted array pcm

1 Like

Try that and see if default works

Yes I used

"microphone": {
  "system": "arecord",
  "arecord": {
    "device": "array"
  }
}

I mentionned dsnoop:CARD=CameraB409241,DEV=0 as it is the option offered by default for dsnoop in the dropdown list. But no option works.

Your suggestion with

hint {
    show on
    description "this is an array"
}

in the array pcm does not help either. There is no additional option offered in the dropdown list. Which should mean Rhasspy ignores the content of asound.conf or what?

No might just mean portaudio or whatever lib is just listing hw: devices and ignoring pcms
Should still use the default you set

Just had it before with other apps sometimes unless the hint is added they do not list so was worth a try

This is true for the Docker image because of how finicky PulseAudio is regarding user ids. I basically have to know your user id at build time to be able to construct the right image :frowning:

I need to revisit this again and see if anything has changed in Docker. Switching to podman may also help, as its designed to run without a root-level daemon.

Assuming this is about the Docker image, arecord outside the container and inside the container are completely different.

On a PulseAudio system, arecord is a lie and properly uses PulseAudio instead. Inside the Rhasspy Docker container, there is no PulseAudio and it literally blocks /dev/snd

What about those instances where there is pulseaudio on the host but we don’t want to use it but instead access the alsa layer directly?

I’m not sure if there’s a way without disabling PulseAudio. I haven’t spent a lot of time trying to figure this out, though.

I’m still working on a Rhasspy AppImage, and I’m hoping this will provide an easy way for people to get the “Docker experience” without all the pains of accessing the microphone.

1 Like

I confirm I have a Docker installation of Rhasspy.

1 Like

This any interest to you @synesthesiam

I have no idea but though of this conv.

1 Like