You are not logged in.
Pages: 1
Topic closed
I want to know how I can lower or increase volume in the terminal.
amixer set Master 2+
I tried that, it gives:
avid@davidarch:~$ amixer set Master 2+
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 24540 [37%] [on]
Front Right: Playback 24540 [37%] [on]
david@davidarch:~$
But it doesn't work :S
Any ideas? Thank you.
Last edited by ephan (2012-07-16 21:55:43)
Offline
ALSA or pulse audio or...
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
ALSA or pulse audio or...
Honestly, I'm not even sure which I'm using, I can't recall. But alsamixer works, so it should be alsa.
Offline
Try
amixer set Master playback 1+
amixer set Master playback -1
amixer set Master toggle
Offline
$ ps aux | grep pulse
If it is pulse, https://aur.archlinux.org/packages.php?ID=51529
Last edited by graysky (2012-07-15 18:41:08)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
None of those worked, except for "amixer set Master toggle" to toggle the sound. "amixer -c 0 set PCM 3dB+" worked though. Thank you!
Also, how can I get the sound percentage? Thank you.
Offline
...are you using pulse?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
...are you using pulse?
No.
Offline
None of those worked, except for "amixer set Master toggle" to toggle the sound. "amixer -c 0 set PCM 3dB+" worked though. Thank you!
Try using
amixer -q sset PCM 1+
amixer -q sset PCM 1-
then.
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
I already found a way, but for the record: "amixer: Unable to find simple control 'PCM'" is the output.
Offline
Also, how can I get the sound percentage? Thank you.
Maybe this will work.
$ amixer get Master | tail -1 | awk '{print$4}'
Offline
ephan wrote:Also, how can I get the sound percentage? Thank you.
Maybe this will work.
$ amixer get Master | tail -1 | awk '{print$4}'
or just awk
awk '/%/ {gsub(/[\[\]]/,""); print $4}' <(amixer sget Master)
Offline
x33a wrote:ephan wrote:Also, how can I get the sound percentage? Thank you.
Maybe this will work.
$ amixer get Master | tail -1 | awk '{print$4}'
or just awk
awk '/%/ {gsub(/[\[\]]/,""); print $4}' <(amixer sget Master)
That little snippet is returning the value, not the percentage:
david@davidarch:~$ awk '/%/ {gsub(/[\[\]]/,""); print $4}' <(amixer sget Master)
65536
65536
david@davidarch:~$ awk '/%/ {gsub(/[\[\]]/,""); print $4}' <(amixer sget Master)
7202
7202
david@davidarch:~$ awk '/%/ {gsub(/[\[\]]/,""); print $4}' <(amixer sget Master)
0
0
david@davidarch:~$
Since I don't know bash, I'll just cook some Perl magic to get the percentage.
The first one is also a value:
david@davidarch:~$ amixer get Master | tail -1 | awk '{print$4}'
0
david@davidarch:~$ amixer get Master | tail -1 | awk '{print$4}'
391
david@davidarch:~$ amixer get Master | tail -1 | awk '{print$4}'
521
david@davidarch:~$ amixer get Master | tail -1 | awk '{print$4}'
48972
david@davidarch:~$
Is there a way to get percentage using bash? If there isn't, no problem, but if there is, that'd be even simpler.
Thank you
Offline
Try changing $4 to $5 in the above commands.
EDIT: if that doesn't work post the output of
amixer get Master
Here's mine (shows [off] for muted, which could be changed to whatever by replacing $7 with the required string):
amixer get Master | awk '/^ *Front Left.*/ {print $7=="[off]"?$7:$5}'
Last edited by skanky (2012-07-16 10:26:53)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
None of those worked, except for "amixer set Master toggle" to toggle the sound. "amixer -c 0 set PCM 3dB+" worked though. Thank you!
Also, how can I get the sound percentage? Thank you.
Just curious, is it possible that none of the suggestions work because they involve the Master channel, while the PCM channel is turned very far/all the way down? Turn PCM all the way up, then try the earlier commands; there's no reason they shouldn't work if you have functioning sound on your system.
Offline
Try changing $4 to $5 in the above commands.
EDIT: if that doesn't work post the output ofamixer get Master
Here's mine (shows [off] for muted, which could be changed to whatever by replacing $7 with the required string):
amixer get Master | awk '/^ *Front Left.*/ {print $7=="[off]"?$7:$5}'
That was, erm, perfect? Thanks a ton.
Offline
No problem - can you mark the thread as solved, please?
Just for future reference, I'd find a simple beginner's guide to awk (and sed, maybe). You don't need to know much, but $4 is the fourth field, with default delimiter as a space. If that's all you're doing, then cut will do the job fine, but awk can do so much more. The manual for both is useful, but with awk a guide is better at first go. If you can understand perl, then it won't be difficult.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Limits: Playback 0 - 65536
If you use "amixer set Master 2+", you have to press it a few hundred times to notice any effect.
From the Openbox wiki:
$ amixer set Master 5%+
$ amixer set Master 5%-
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
x33a wrote:ephan wrote:Also, how can I get the sound percentage? Thank you.
Maybe this will work.
$ amixer get Master | tail -1 | awk '{print$4}'
or just awk
awk '/%/ {gsub(/[\[\]]/,""); print $4}' <(amixer sget Master)
That's much better. My awk knowledge is just limited to printing stuff
Offline
I want to know how I can lower or increase volume in the terminal.
amixer set Master 2+
I tried that, it gives:
avid@davidarch:~$ amixer set Master 2+ Simple mixer control 'Master',0 Capabilities: pvolume pswitch pswitch-joined penum Playback channels: Front Left - Front Right Limits: Playback 0 - 65536 Mono: Front Left: Playback 24540 [37%] [on] Front Right: Playback 24540 [37%] [on] david@davidarch:~$
But it doesn't work :S
Any ideas? Thank you.
That does work, but you are changing it by 2 on a scale of 65536. Try amixer set Master 2%+ (or 5%+ whatever you want ).
Offline
Woo! Changing the percentage worked much better, thank you!
Offline
Pulse audio lets you adjust the volume like so:
pactl set-sink-volume 0 30%
pactl set-sink-volume 0 -30%
pactl set-sink-volume 0 +30%
You might need to edit the '0' param depending on the device your using. '1' worked for me, I'm using the PCM channel
https://wiki.archlinux.org/index.php/Pu … o/Examples
Last edited by dirtydan (2019-06-25 04:08:57)
Offline
Six year old thread and you are just pasting from the wiki? Don't do that:
https://wiki.archlinux.org/index.php/Co … bumping.22
Closing
Offline
Pages: 1
Topic closed