명령 줄에서 어떻게 음소거합니까?


답변:


71

ALSA 드라이버를 사용한다고 가정하고 다음을 실행하십시오.

amixer set Master mute   
amixer set Master unmute

또는 다음을 사용할 수 있습니다.

amixer set Master toggle

음소거를 켜거나 끕니다.


6
나 / 내 시스템 (정확한)의 경우, 이것은 편도입니다 : 꺼짐 / 음소거 음악을 토글하거나 음소거 해제하지 마십시오. 왜 그런지에 대한 아이디어?
— natty에 대해 nutty


1
이 솔루션은 순수한 Alsa를위한 것입니다. pulseaudio가있는 Alsa의 경우 Tim 's answer 명령을 사용하십시오 . 또는 명령을 터치하지 말고이 답변 에서처럼 Alsa를 구성하십시오 . 그렇지 않으면 결과를 음소거 해제 할 수 없다는 natty의 문제에 대한 @nutty.
— tanius

Ubuntu Server 14.04에서는 "마스터"를 간단한 제어로 사용할 수 없었습니다. 대신 "스피커"를 사용했습니다. sudo amixer일치하는 출력에서 ​​행을 찾아서 대체를 찾았습니다.Simple mixer control 'Speaker',0
— brycemcd

48

다른 사람들이하지 않았을 때 이것은 나를 위해 일했습니다.

amixer -q -D pulse sset Master toggle

이것은 natty의 의견 에 대한 열매가 많은 링크에서 첫 번째 답변에 대한 것입니다.

내 대명사는


1
또한 방금 확인했는데 14.04에서도 작동합니다.
— Tim

1
그것을 했어 :)-kubuntu here (우분투 14.04.2 LTS). 고마워.
— hakre

1
이 -D pulse옵션은 Alsa가 pulseaudio와 함께 사용될 때 필요합니다 (질문에 pulseaudio 태그가 붙어 있기 때문에 이것이 정답입니다). 이 솔루션에 대한 자세한 내용은 askubuntu의 여기 및 여기 를 참조 하십시오 .
— tanius

참고 : 헤드폰이나 이어폰이 연결되어있는 경우 @goric이 수락 한 답변이 작동하지 않습니다.
— UniversallyUniqueID

또는, "토글"보다 모호하게, 당신은 사용할 수 있습니다 amixer -q -D pulse sset Master mute및 amixer -q -D pulse sset Master unmute. 우분투 16.04에서 훌륭하게 작동
— CPBL

23

내 설정에서 때로는 믹서 믹서 음소거가 어떤 이유로 실패합니다. 따라서 스크립트에서 pactl 을 사용하고 있습니다 .

음소거

pactl set-sink-mute 0 1

그리고 음소거 해제 :

pactl set-sink-mute 0 0

우분투 12.10에서 테스트되었습니다.


여전히 우분투 15.10에서 작동합니다.
— tanius

마찬가지로, 이것은 현대 우분투 버전에서 작업을 수행하는 올바른 방법입니다. 16.04에서 작동합니다 (아약서는 작동하지 않습니다).
— Marcus

16

터미널에서 이것을 묵음

amixer set Master mute

유형

amixer set Master unmute

우분투 10.10에서 테스트되었습니다.

추신 : 흥미로운 질문에 +1.


1

당신이 alsagoric 응답 을 따르고 있다면.

PulseAudio가 더 좋지만 간단하지는 않습니다 pactl set-sink-mute 0 1. 첫 번째 장치에서 작업을 수행하지만 다른 싱크 출력의 헤드폰을 사용하는 경우에는 수행하지 마십시오.

더 나은 방법으로 확인하는 것입니다 pactl info그리고 얻을 Default Sink사용할 수 있습니다.

DEFAULT_SINK=$(pactl info | grep "Default Sink" | cut -d " " -f3)

그런 다음 음소거합니다.

pactl set-sink-mute "$DEFAULT_SINK" "1"

또는 음소거 해제 :

pactl set-sink-mute "$DEFAULT_SINK" "0"

펄스 오디오를 관리하는 스크립트를 작성했습니다. 사용하려면로 저장하고 volume실행 권한을 제공 한 후 chmod +x volume경로에 추가하십시오 ln -sv $PWD/volume /usr/local/bin/. 여기 내 스크립트 :

#!/bin/bash
# script name: volume
# Author: glaudistong at gmail.com
# depends on: yad, coreutils, pulseaudio

ps -ef | grep "yad" | grep -E "Volume [^+\-]" | tr -s " " | cut -d " " -f2 | xargs -i kill "{}" 2>/dev/null
DEFAULT_SINK=$(pactl info | grep "Default Sink" | cut -d " " -f3)
DEFAULT_SOURCE=$(pactl info | grep "Default Source" | cut -d " " -f3)
case "$1" in 
    init)
    {
        ps -fe | grep yad | grep -q volume ||
        {
         yad --notification --command "volume up" --text "+ Volume +" --image ~/Pictures/volume-up-dark.png &
         yad --notification --command "volume down" --text "- Volume -" --image ~/Pictures/volume-down-dark.png &
        }
    };;
    up)
    {
        pactl set-sink-volume "$DEFAULT_SINK" +5%
        P=$(pactl list | grep -E "Name: $DEFAULT_SINK$|Volume" | grep "Name:" -A1 | tail -1 | cut -d% -f1 | cut -d/ -f2 | tr -d " ")
        iconl="$(echo -ne "\U1F50A")"
        iconr="$(echo -ne "\U1F56A")"
        timeout .6 yad --progress --percentage "$P" --timeout 1 --no-buttons --undecorated --text="$iconl Volume $P% $iconr" --no-focus --center --skip-taskbar --on-top &
    };;
    down)
    {
        pactl set-sink-volume "$DEFAULT_SINK" -5%
        P=$(pactl list | grep -E "Name: $DEFAULT_SINK$|Volume" | grep "Name:" -A1 | tail -1 | cut -d% -f1 | cut -d/ -f2 | tr -d " ")
        iconl="$(echo -ne "\U1F509")"
        iconr="$(echo -ne "\U1F569")"
        timeout .6 yad --progress --percentage "$P" --timeout 1 --no-buttons --undecorated --text="$iconl Volume $P% $iconr" --no-focus --center --skip-taskbar --on-top &
    };;
    mute)
    {
        ismute=$(pactl list | grep -E "Name: $DEFAULT_SINK$|Mute" | grep "Name:" -A1 | tail -1 |cut -d: -f2| tr -d " ")
        if [ "$ismute" == no ]; then
            s=1
            P=0
            icon="$(echo -ne "\U1F507")"
        else
            P=$(pactl list | grep -E "Name: $DEFAULT_SINK$|Volume" | grep "Name:" -A1 | tail -1 | cut -d% -f1 | cut -d/ -f2 | tr -d " ")
            icon="🔊"
            s=0
        fi
        pactl set-sink-mute "$DEFAULT_SINK" "$s"
        echo $s > /sys/devices/platform/thinkpad_acpi/leds/platform::mute/brightness
        timeout .6 yad --progress --percentage "$P" --timeout 1 --no-buttons --undecorated --text="$icon Volume $P%" --no-focus --center --skip-taskbar --on-top &
    };;
    mic-up)
    {
        pactl set-source-volume "$DEFAULT_SOURCE" +5%
        P=$(pactl list | grep -E "Name: $DEFAULT_SOURCE$|Volume" | grep "Name:" -A1 | tail -1 | cut -d% -f1 | cut -d/ -f2 | tr -d " ")
        icon="$(echo -en "\U1F3A4")"
        timeout .6 yad --progress --percentage "$P" --timeout 1 --no-buttons --undecorated --text="$icon Volume Mic $P%" --no-focus --center --skip-taskbar --on-top &
    };;
    mic-down)
    {
        pactl set-source-volume "$DEFAULT_SOURCE" -5%
        icon="$(echo -en "\U1F3A4")"
        P=$(pactl list | grep -E "Name: $DEFAULT_SOURCE$|Volume" | grep "Name:" -A1 | tail -1 | cut -d% -f1 | cut -d/ -f2 | tr -d " ")
        timeout .6 yad --progress --percentage "$P" --timeout 1 --no-buttons --undecorated --text="$icon Volume Mic $P%" --no-focus --center --skip-taskbar --on-top &
    };;
    mic-mute)
    {
        ismute=$(pactl list | grep -E "Name: $DEFAULT_SOURCE$|Mute" | grep "Name:" -A1 | tail -1 |cut -d: -f2| tr -d " ")
        if [ "$ismute" == no ]; then
            s=1
            P=0
            icon="$(echo -en "\U1F507\U1F3A4")"
        else
            P=$(pactl list | grep -E "Name: $DEFAULT_SOURCE$|Volume" | grep "Name:" -A1 | tail -1 | cut -d% -f1 | cut -d/ -f2 | tr -d " ")
            s=0
            icon="$(echo -en "\U1F3A4")"
        fi
        pactl set-source-mute "$DEFAULT_SOURCE" "$s"
        echo $s > /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
        timeout .6 yad --progress --percentage "$P" --timeout 1 --no-buttons --undecorated --text="$icon Volume Mic $P%" --no-focus --center --skip-taskbar --on-top &
    };;
    *)
        echo invalid option;;
esac;
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.