Komut satırından sesini nasıl kapatıyorsunuz?


Yanıtlar:


71

ALSA sürücüsünü kullandığınızı varsayarsak, şunu çalıştırın:

amixer set Master mute   
amixer set Master unmute

Veya, sadece kullanabilirsiniz:

amixer set Master toggle

Sesi açmak ve kapatmak için.


6
benim / sistemim için (kesin), bu sadece bir yönden gider: kapalı / sessiz. Açma veya açma, müziği geri getirme. Neden olabileceği ile ilgili herhangi bir fikir??
— Natty


1
Bu çözüm saf Alsa içindir. Pulseaudio'lu Alsa için Tim'in cevabındaki komutu kullanın . Ya da komuta dokunmayın ve Alsa'yı bu cevaptaki gibi yapılandırın . Aksi halde, @Ntyty'nin Natty'nin sonuçlarını açamaması sorunu ile ilgili çılgınlığı.
— tanius

Ubuntu Server 14.04'te "Master" basit bir kontrol olarak mevcut değildi. Onun yerine "Hoparlör" kullandım. Ben çalıştırarak ikame bulundu sudo amixerve eşleşen çıktı hattını bulmaSimple mixer control 'Speaker',0
— brycemcd

48

Bu diğerleri benim için çalıştığında benim için çalıştı:

amixer -q -D pulse sset Master toggle

Bu, natty'nin ilk cevaba yaptığı yorumla ilgili cevizdeki bağlantıdan :

Zamirlerim O / O'dur


1
Ben de yeni kontrol ettim, 14.04'te de çalışıyor.
— Tim,

1
yaptım :) - Burada kubuntu (Ubuntu 14.04.2 LTS). Teşekkür.
— hakre

1
-D pulseAlsa pulseaudio ile birlikte kullanıldığında bu seçenek gereklidir (ve soru pulseaudio olarak etiketlendiğinden, bu kabul edilen cevap olmalıdır). Bu çözüm hakkında daha fazla ayrıntı için , askubuntu'da buraya ve buraya bakın.
— tanius

Not: @goric tarafından kabul edilen cevap kulaklık veya kulaklık takılıyken çalışmaz, bunu kullanın.
— UniversallyUniqueID

Veya, "geçiş" den daha az belirsizce, amixer -q -D pulse sset Master muteve kullanabilirsiniz amixer -q -D pulse sset Master unmute. Ubuntu'da harika çalışıyor 16.04
— CPBL 13

23

Kurulumumda bazen amixer unmute nedense başarısız oluyor. Bu yüzden komut dosyalarımda pactl kullanıyorum :

Susturmak:

pactl set-sink-mute 0 1

ve aç:

pactl set-sink-mute 0 0

Ubuntu 12.10'da test edilmiştir.


Hala Ubuntu 15.10'da çalışıyor.
— tanius,

Bu, modern Ubuntu versiyonlarında işlemi gerçekleştirmenin doğru yoludur. 16.04'te çalışıyor (karıştırıcı yok).
— Marcus,

16

Terminal tipinde bu sesi kapatmak için

amixer set Master mute

tip

amixer set Master unmute

Ubuntu 10.10 üzerinde test edildi.

Not: ilginç soru için +1.


1

Kullanıyorsanız, alsagoric cevap izleyin.

PulseAudio daha iyi, ama o kadar basit değil: pactl set-sink-mute 0 1İlk cihaz için çalışın, ancak başka bir lavabo çıkışından kulaklık kullanıyorsanız kullanmayın.

En iyisi kontrol etmek pactl infove Default Sinkkullanmaktır.

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

Sonra sessize almak için:

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

Veya sesini aç:

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

Notumda pulseaudio'yu yönetmek için bir senaryo yazdım. Kullanmak istiyorsanız, farklı kaydedin volume, yürütme izinleri sağlayın chmod +x volumeve yolunuza ekleyin ln -sv $PWD/volume /usr/local/bin/. İşte betiğim:

#!/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;
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.