A few questions on controlling audio input gain and output volume

Hi,
Really nice that Pisound micro eventually made it to production! I’m reading its docs (Pisound Micro Mapper - Pisound Micro Documentation) and I see how one can control ALSA’s playback volume. The provided example is with a rotary encoder.

  1. If done with a potentiometer, a single one is enough to control both audio output channels? Or do I need a sterer pot for that?
  2. Is it possible to change the pot’s profile, from linear to turn it to logarithmic so you can get a better volume control?
  3. (pretty dummy, I guess) If I use Pure Data with ALSA and control ALSA’s output volume with a pot, that’s enough, right? I don’t need to do anything on the Pd side to control the audio output volume?
  4. Is there some way to control the gain for the audio input, similar to how it is done in Pisound? I couldn’t tell from the examples in the documentation.

Cheers

1 Like

One mono pot is enough, it by default should map to both channels, unless you explicitly specify it to work on a single channel in the mapping. Also you can map the same control to multiple parameters.

The ALSA mixer controls themselves are a bit nonlinear, so first give it a try with linear potentiometers. Changing the curve would be possible in Pisound Micro Mapper, but it’s not implemented yet.

Yes, the ALSA mixer controls control the volumes just before the signal reaches the software, and just before it goes to the physical outputs, so in PD, you can pretty much have 100% sound level, and rely on ALSA mixer for adjusting the volume.

The input gain is not identical to Pisound, it’s controlled through the ALSA mixer’s controls.

1 Like

Hi Giedrius, thanks for the heads up! A couple more questions:

  1. Can the main audio output and the headphones output be controlled by two separate pots, or do I need to do this in analog circuitry?
  2. Is it possible to provide examples on how to control the input gain? The docs are pretty complete, but I can’t seem to find out how I can go about that.

Yes, you can map ALSA mixer volume controls for HP and LINE OUT to separate potentiometers.

You can find all the available ALSA control names using:

amixer -D hw:pisoundmicro controls

Try this config, change the pin to the one you are using:

{
    "$schema": "https://blokas.io/json/pisound-micro-schema.json",
    "version": 1,
    "controls": {
        "pisound-micro": {
            "gain_pot": {
                "type": "analog_in",
                "pin": "B23"
            }
        },
        "alsa": {
            "hw:pisoundmicro": [
                "Capture Volume"
            ]
        }
    },
    "mappings": [
        [ "gain_pot", "->", "Capture Volume" ]
    ]
}

It should control this ALSA mixer control:

In the “controls” section, you declare the kinds of controls you want to be using from various different subsystems (Pisound Micro, ALSA, MIDI, OSC). In the “mappings” section you refer to these controls by name (or assigned aliases, useful in case multiple systems have the same name), and define the relations between them. Analog potentiometers should be used as one sided control with <- or -> mapping direction. However, Encoders or some MIDI / OSC controls can be kept in sync, so whenever you change the volume through ALSA mixer directly, the encoder value can be aware of the change, and subsequent rotation of the encoder would be in reference of the new position.

1 Like