How to disable automatic gain control

Hello,

I’m working on a project using the Matrix Voice and the sounddevice package for Python. For this, I’ve got the kernel modules installed. It seems that there is some kind of automatic gain control that’s happening in the background, and I can’t seem to disable it. Here is my /etc/asound.conf (I’ve tried adding min_dB and max_dB, which do not seem to have much effect):

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

pcm.mic {
   type softvol
   slave {
     pcm "array"
   }
   control {
     name "MicArray Master"
        card "MATRIXIOSOUND"
   }
   min_dB 0.0
   max_dB 0.0
}

pcm.speaker {
  type plug
  slave {
    pcm "hw:0,0"
    rate 16000
  }
}

pcm.array {
  type plug
  slave {
    pcm "hw:MATRIXIOSOUND"
  }
}

pcm.channel_1 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  0
}

pcm.channel_2 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  1
}

pcm.channel_3 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  2
}

pcm.channel_4 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  3
}

pcm.channel_5 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  4
}

pcm.channel_6 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  5
}

pcm.channel_7 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  6
}

pcm.channel_8 {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings.0  7
}

pcm.all_channels {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:2,0"
        channels 8
    }
    bindings {
            0 0
            0 1
            0 2
            0 3
            0 4
            0 5
            0 6
            0 7
    }
}

Any help would be appreciated!

Hello @sgmustadio!

Apologies for the delay.

Testing a config right now. Will send it shortly!

Best,
Samreen

Hi @sgmustadio,

What tests have shown you that there may be automatic gain control?

Algorithmically, we only touch gain here in the kernel modules and while I didn’t write them, I believe those gain scaling factors are required for the mic data to have a reasonable amplitude and not to “control” it.

We thought the gain control you spoke of could be coming from the softvol type in ALSA, but making the MATRIX mic array a type plug instead had no effect so we would need more information to find what is causing your issue.

Best,
Samreen

No worries! I was capturing raw audio and summing up the absolute values in a given time slice to give me an idea of the “energy” in each time slice (about 0.5 seconds for each slice). I noticed that if I played a continuous loud sound, the energy would spike up and then go back down, telling me that there’s some kind of automatic leveling going on.