উত্তর:
ধরে নিই যে আপনি ALSA ড্রাইভার ব্যবহার করছেন, চালান:
amixer set Master mute
amixer set Master unmute
বা, আপনি কেবল ব্যবহার করতে পারেন:
amixer set Master toggle
নিঃশব্দ চালু এবং বন্ধ করতে।
sudo amixerমিলে যাওয়া আউটপুটটিতে লাইনটি চালিয়ে এবং খুঁজে পেয়ে আমি প্রতিস্থাপনটি পেয়েছিSimple mixer control 'Speaker',0
যখন অন্যরা না করল তখন এটি আমার পক্ষে কাজ করেছিল:
amixer -q -D pulse sset Master toggle
এটি প্রথম উত্তরের নেটিটির মন্তব্য সম্পর্কে বাদামের লিঙ্কটি থেকে :
আমার সর্বনাম তিনি / তাঁর
amixer -q -D pulse sset Master muteএবং amixer -q -D pulse sset Master unmute। উবুন্টু 16.04
আমার সেটআপে কখনও কখনও অ্যামিক্সার সশব্দ কিছু কারণে ব্যর্থ হয়। অতএব আমি ব্যবহার করছি আমার স্ক্রিপ্টগুলিতে প্যাকটেল :
নিঃশব্দ করা:
pactl set-sink-mute 0 1
এবং সশব্দ:
pactl set-sink-mute 0 0
উবুন্টু 12.10 এ পরীক্ষা করা হয়েছে।
টার্মিনাল এ নিঃশব্দ করতে টাইপ করুন
amixer set Master mute
আদর্শ
amixer set Master unmute
আমার উবুন্টু ১০.১০ তে পরীক্ষা করা হয়েছে।
পিএস: আকর্ষণীয় প্রশ্নের জন্য +1।
আপনি যদি ব্যবহার করেন তবে alsaগরিক উত্তর অনুসরণ করুন।
পালস অডিও ভাল, তবে এত সহজ নয়: 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;