Bitcoin donations are welcome:14snQXeLcnJtWUduKZ6rC2MHdPYrYar1Tw

Sunday, June 2, 2013

Linux script to mute and unmute both Master and PCM

Updated my debian distro recently, and trying to make amixer mute and unmute only the Master channel caused some problems. Why do I use this cmd for this job? Because I'm linking my multimedia buttons to amixer to mute and unmute my audio.

Created a bash script called mute, which I put in /usr/bin/mute and chmod 755. It looks like this:

if amixer get Master|grep off; then
amixer set Master,0 unmute
amixer set PCM,0 unmute
notify-send "[ ] Mute"
else
amixer set Master,0 mute
amixer set PCM,0 mute
notify-send "[X] Mute"
fi

You can of course decide to remove the "notify-send" cmd, if you don't want any notifications.

amixer and alsamixer wont run as regular user

Recently got this problem after upgrading my debian distro. Searched around for a solution and got the help I needed from debian forums.

The problem looks like this:
user@computer:~$ amixer
ALSA lib control_ext.c:664:(snd_ctl_ext_create) ctl_ext: Plugin version mismatch

amixer: Mixer attach default error: No such device or address
user@computer:~$ alsamixer
ALSA lib control_ext.c:664:(snd_ctl_ext_create) ctl_ext: Plugin version mismatch

cannot open mixer: No such device or address
user@computer:~$ 

user@computer:~$ ls -l /dev/snd/
total 0
drwxrwxrwx  2 root audio      60 Jun  1 17:52 by-path
crw-rw-rwT+ 1 root audio 116,  8 Jun  1 17:52 controlC0
crw-rw-rwT+ 1 root audio 116,  7 Jun  1 17:52 hwC0D0
crw-rw-rwT+ 1 root audio 116,  6 Jun  1 17:52 hwC0D1
crw-rw-rwT+ 1 root audio 116,  5 Jun  1 18:59 pcmC0D0c
crw-rw-rwT+ 1 root audio 116,  4 Jun  1 22:46 pcmC0D0p
crw-rw-rwT+ 1 root audio 116,  3 Jun  1 17:52 pcmC0D6c
crw-rw-rwT+ 1 root audio 116,  2 Jun  1 17:52 pcmC0D6p
crw-rw-rwT+ 1 root audio 116,  1 Jun  1 17:52 seq
crw-rw-rwT+ 1 root audio 116, 33 Jun  1 17:52 timer
user@computer:~$ 
user@computer:~$ which amixer
/usr/bin/amixer
user@computer:~$ ls -l /usr/bin/ | grep amixer
-rwxr-xr-x 1 root   root       59588 Jan 10 02:46 alsamixer
-rwxr-xr-x 1 root   root       51280 Jan 10 02:46 amixer
-rwxr-xr-x 1 root   root       56076 Nov 23  2011 gnome-alsamixer
user@computer:~$ 
user@computer:~$ groups 
user disk dialout cdrom floppy audio video plugdev netdev fuse

The solution? It was simply deleting the .pulse directory in my home directory.

Thanks goes out to debian forums and the user dmuc for this one.

Saturday, June 1, 2013

Fix stuttering flash in chrome

There has been quite some problems with pepperflash 11.7.700.203 in chrome lately, specifically with youtube. It has been stuttering a lot and made it impossible to watch anything.

Managed to fix this with a workaround.

Here's the solution:
First, go to "chrome://plugins/" in your browser. Locate pepperflash and disable it. Next look for a folder where other plugins are located where you can put your new plugin. I'm using /home/user/.mozilla/plugins/.

Next go to Adobe Flash official webpage at http://get.adobe.com/flashplayer/ and download the latest .tar.gz package with the plugin. I'm using version 11.2.202.285. After downloading it, head to it's folder in the terminal, extract it:
tar -zxvf packagename.tar.gz
..and you will get a lot of files and folders you don't need, except libflashplayer.so. Copy this file to the directory you chose earlier.

Restart chrome, check in "chrome://plugins/" again that the new plugin is loaded, and you should be fine!