Is it possible to change, via terminal, the volume for the Headphone without it being plugged in?

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read how to get help
Post Reply
antrrax
Level 1
Level 1
Posts: 21
Joined: Thu Sep 27, 2018 11:53 am

Is it possible to change, via terminal, the volume for the Headphone without it being plugged in?

Post by antrrax »

Is it possible to change, via terminal, the volume for the Headphone without it being plugged in?

I tried using the amixer but was unsuccessful:

Image
image 1, Headphone not connected - I changed the speaker volume to 100% ---> OK
$ amixer -c0 -q sset Master Unmute 100%



Image
image 2, Headphone not connected - I changed the headphones volume to 38% ---> That's wrong. It does not work as I want
$ amixer -c0 -q sset Headphone Unmute 38%
When I plug in the headphone it changes to image 3 below



Image
image 3, Headphone connected - Master goes to 65 and headphone to 100
User avatar
MrEen
Level 21
Level 21
Posts: 14131
Joined: Mon Jun 12, 2017 8:39 pm

Re: Is it possible to change, via terminal, the volume for the Headphone without it being plugged in?

Post by MrEen »

Hi antrrax.

While what you want may be possible, I think you'll be fighting an uphill battle. There are many steps in the process for volume control, and we usually are only affected by the Master column in alsamixer.

To give you an example of what I mean, I ran alsamixer and moved the Headphones down from 100% while the Master column was somewhere around 50%. I left that window open, then used the scroll wheel on my mouse over the sound icon in the panel. Headphones immediately jumped back to 100% and the Master moved by small increments based on my scrolling speed.

Essentially, we control the Master column and the others just play along. Once Master gets down to 0, only then does the Headphones level start dropping, which drops from 100 to 0 in about three clicks of the wheel.

If you really want to tackle this, I would think you'll need to edit files in /usr/share/pulseaudio/alsa-mixer/paths/ at a minimum.

It's possible all you're wanting is to make sure your ears don't get blasted when you plug in the headphones, in which case lowering the Master first much like what you did in your example will suffice.
Post Reply

Return to “Hardware Support”