Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use equalizer with softvol #3

Open
timothyjward opened this issue Jul 31, 2020 · 6 comments
Open

Unable to use equalizer with softvol #3

timothyjward opened this issue Jul 31, 2020 · 6 comments
Assignees

Comments

@timothyjward
Copy link

Hi, I've tried using the equalizer (and seen it work) but I don't seem to be able to use it in conjunction with a software volume control.

What I want is something like the following asound.conf:

pcm.!default {
    type plug
    slave.pcm "equal"
}

pcm.plugequal {
    type plug
    slave.pcm "equal"
}

ctl.equal {
    type equal;
}

pcm.equal {
    type equal;
    slave.pcm "plugsoftvolume"
}

pcm.plugsoftvolume {
    type plug
    slave.pcm "softvolume"
}

pcm.softvolume {
    type            softvol
    slave {
        pcm         "plughw:2,0"
    }
    control {
        name        "SoftMaster"
        card        2
        device      0
    }
max_dB 0.0
min_dB -50.0
resolution 100
}

I want it this way around because the equalizer will work much better with the full input signal, and then the final volume control can be used to adjust the overall volume. Unfortunately when I do this I get:

aplay: pcm_params.c:170: snd1_pcm_hw_param_get_min: Assertion !snd_interval_empty(i)' failed.`

I don't see any reason why the equalizer plugin should require that it outputs to a hardware device (the docs even suggest it should be possible to target dmix).

@raedwulf
Copy link
Owner

I'll have a look into this, thanks!

@raedwulf raedwulf self-assigned this Aug 3, 2020
@JasonLG1979
Copy link

@timothyjward Try putting softvol before equal. Something like this (you don't need to use quotes for strings that don't have special chars):

pcm.!default {
    type softvol
    max_dB 0.0
    min_dB -50.0
    resolution 100
    slave.pcm plugequal
    control {
        name SoftMaster
        card 2
    }
}

pcm.plugequal {
    type plug
    slave.pcm equal
}

pcm.equal {
    type equal;
    slave.pcm "plughw:2,0"
}

ctl.equal {
    type equal
}

ctl.!default {
    type hw
    card 2
}

@stekliPes
Copy link

I know this is quite a late answer, but I am using a very similar configuration (plug -> softvol -> plug -> equal -> softvol -> dmix) configuration and i found that simply adding "rate: unchanged" to the plug before equal, see below:

pcm.!default {
  type asym
  playback.pcm preequal
  capture.pcm null
}

pcm.preequal {
  type plug
  slave.pcm equal
  slave.rate unchanged
}

ctl.equal {
  type equal
  controls /etc/equal.state
}

pcm.equal {
  type equal
  slave.pcm master
  controls /etc/equal.state
}

ctl.master {
  type hw
  card 0
}

pcm.master {
  type plug
  slave {
    pcm  master_volume
  }
}

pcm.master_volume {
  type softvol
  slave.pcm master_switch
  control {
    name "Master Volume"
    card 0
  }
  min_dB -127.5
  max_dB 0.0
}

pcm.master_switch {
  type softvol
  slave.pcm analog_out
  control {
    name "Master Switch"
    card 0
  }
  resolution 2
}
pcm.analog_out {
   type dmix
   ipc_key 1024
   slave {
       pcm "hw:0,0"
       channels 2
       period_size 1200
       buffer_size 12000
    }
}

@ygoe
Copy link

ygoe commented Dec 4, 2021

Any news here? I've tried setting that rate option but it's ineffective. I understand the original post's explanation to do the equalizer first and then the volume scaling and that's what I prefer, too. I get another error message, though:

ALSA lib pcm_params.c:2226:(snd1_pcm_hw_refine_slave) Slave PCM not usable
Broken configuration for playback: no configurations available: Invalid argument
Setting of hwparams failed: Invalid argument

I can use the equalizer directly with the hardware, but it'll play at full volume and make a very loud cracking sound at the start of each file. Or I can use the volume and mixer, but without the equalizer. I'd like to have both! Without the cracks.

Changing the order of equal and softvol doesn't change anything either.

@raedwulf
Copy link
Owner

Unfortunately sorry, I don't have time to maintain this, I'm looking for someone to take on maintenance of the repository.

@Lauszus
Copy link

Lauszus commented Apr 21, 2022

Here's a configuration that I have been using:

# Use the PCM "dmix" plugin
pcm.dmixer {
    type dmix
    ipc_key 1024
    ipc_perm 0666
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 8192
        rate 44100
        channels 2
    }
}

# Use the PCM "softvol" plugin and route the output to "dmixer"
pcm.softvol {
    type softvol
    slave.pcm "dmixer"
    control {
        name "PCM"
        card 0
    }
}

# Create a control - use "alsamixer -D softvol" to use it
ctl.softvol {
    type hw
    card 0
}

# Use the PCM "equal" plugin and route the output to "softvol"
pcm.equal {
    type equal
    slave.pcm "plug:softvol"
}

# Create a control - use "alsamixer -D equal" to use it
ctl.equal {
    type equal
}

# Override the default PCM, so "equal" is used
pcm.!default {
    type plug
    slave.pcm "equal"
}

# Make the "equal" control the default
ctl.!default {
    type equal
}

The result is equal -> softvol -> dmix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants