Jan 212015
 

Short list of what I think are high quality resources on open source licenses:

Jun 222013
 

My friends had often asked about adding music to mumble, but all guides that I could find used a virtual sound card under Windows. I wanted a solution that runs on my Linux server, so that my friends can all upload music and selecting the music is open to everyone.

The gist: music player daemon connected via pulseaudio to a regular mumble running in a VNC session.

This guide is for Debian, but other distributions should work similarly.

Ingredients: Pulseaudio

apt-get install pulseaudio pulseaudio-utils pavucontrol

Ingredients: VNC Server

I didn’t have any X on my server, so here are some basics to get a working vnc session, in which we can run mumble:

apt-get install tightvncserver jwm xfonts-base rxvt-unicode-256color

Ingredients: Mumble, mpd

Of course we need a mumble client and mpd:

apt-get install mumble mpd

The key is to start a pulseaudio session for the mpd user on a special sink, then open up a vnc server for the same user and in it connect mumble to that sink. The specially nice part is that you now have all of mpd’s clients as possible front ends to this setup.

PulseAudio

Ok, first let’s create the pulseaudio setup: First edit /etc/pulse/default.pa and comment out the suspend-on-idle module:

# load-module module-suspend-on-idle

Since there isn’t an instance of pulseaudio yet, there is no need to restart anything.

Then edit /etc/mpd.conf, add this section and comment out any other audio_output sections:

audio_output {
        type            "pulse"
        name            "pulse mumble"
        #sink            "mpdmumble"
}

Now restart mpd:

/etc/init.d/mpd restart

, you should now see an instance of pulseaudio for the mpd user:

$ ps aux | grep pulse | grep mpd
mpd       4476  4.5  0.2 372704  5200 ?        Sl   Jun19 190:24 /usr/bin/pulseaudio --start --log-target=syslog

My server doesn’t have any audio hardware (a VM), so I create two sinks: One for mumble as an output device, and an extra sink where the music will flow from the mpd output to the mumble input. We don’t care about the mumble output, but it needs to go somewhere.

$ su -s /bin/bash mpd
$ pactl load-module module-null-sink sink_name=mumble_null sink_properties=device.description="mumble_null_sink"
$ pactl load-module module-null-sink sink_name=mpdmumble sink_properties=device.description="mpdmumble_sink"
$ exit

Now that the sink is available, edit /etc/mpd.conf again, remove the comment from the sink, and restart mpd another time to use it.

Connect mumble

$ vncserver -name mpdmumble -depth 16 -geometry 1024x768

And connect from my Linux desktop:

$ vncviewer -via SERVER :1

Open up two shells, run

$ mumble

in one, and

$ pavucontrol

in the other. In mumble you can just abort the audio wizard and then configure it by hand. Make sure that the Advanced checkbox on the bottom left is checked. The important settings are:

  • Audio Input Select pulseaudio. I wasn’t able to select the sink here, but that’s fine, we can do that using the pulseaudio tools later. Other useful settings: Echo: Disabled, Transmit: Voice Activity, select the sliders so that you have a very small red section, followed by a small yellow section, and finally a large green. This makes mumble transmit when there is any input, but be silence otherwise, so that mumble’s red mouth indicates whether the music is playing or not. Under Compression, move the quality slider all the way to the right to get decent sound quality. Under Audio Processing, move both sliders all the way to the left to disable as much processing as possible.
  • Audio Output Select pulseaudio and the mumble_null_sink.

In the pulseaudio Volume Control we can check that the sinks are set up correctly (if not, just click on the sink name and you can select the one mentioned here):

  • On the Playback tab there should be Music Player Daemon entry using the mpdmumble sink.
  • On the Recording tab the Mumble: Microphone should be using Monitor of mpdmumble. I had to move the volume control for the microphone down to 77%, otherwise there was a horrible clipping sound when playing the music.

Now just add some music to the mpd music directory, and install a mpd client to control the playback. I chose rompr, a web (PHP) client, put up a http-password and now any of my friends can play DJ.

Done, and enjoy the music!

P.S. I don’t have a nice start-up script which will automatically start mumble, so that is an exercise left for the reader.

Resources:

  • http://mpd.wikia.com/wiki/PulseAudio
  • http://askubuntu.com/questions/191203/12-04-sound-keeps-auto-muting-when-idle
  • http://askubuntu.com/questions/85007/pulseaudio-can-not-create-sink-with-specific-name-anymore
Mar 242013
 

I couldn’t find a good guide for running teamspeak3 inside of a chroot. And that’s the only way I’d be running it, given that it is a binary blob… This guide is for a Debian system, should probably work for Ubuntu, but it shouldn’t be hard to adjust to other distributions.

  1. Install jailkit. It’s not in Debian, but it provides a working packaging script that you just have to use to build the package yourself:
    # USE REGULAR USER
    apt-get install build-essential fakeroot
    # download jailkit, see the link above. Extract it.
    cd jailkit-2.15
    dpkg-buildpackage -uc -uc -rfakeroot
    sudo dpkg -i ../jailkit*.deb
    
  2. Configure the chroot, and install teamspeak 3 in it. Note that I’m assuming amd64 here.
    # AS ROOT
    mkdir -p /var/chroot/ts3
    cd /var/chroot/ts3
    
    cat << EOF >> start.sh
    #!/bin/bash
    exec ./ts3server_startscript.sh start
    EOF
    chmod +x start.sh
    
    tar xavf $TEAMSPEAKTARGZ # Replace with where you stored the teamspeak download
    adduser --system --home /var/chroot/ts3/./teamspeak3-server_linux-amd64 \
            --disabled-password --group --shell /start.sh ts3
    mkdir teamspeak3-server_linux-amd64/logs
    chown ts3:ts3 teamspeak3-server_linux-amd64 teamspeak3-server_linux-amd64/logs
    
    jk_jailuser -j $PWD ts3
    cat << EOF >> /etc/jailkit/jk_init.ini
    [ts3]
    devices = /dev/null, /dev/random, /dev/urandom, /dev/zero
    paths = /usr/lib/libstdc++.so.6, /etc/localtime
    users = root
    groups = root
    includesections = uidbasics, netbasics, basicshell
    EOF
    jk-init -v -j $PWD ts3
    
  3. Boot script:

    cat << 'EOF' >> /etc/init.d/teamspeak3
    #!/bin/bash
    ### BEGIN INIT INFO
    # Provides:          teamspeak3
    # Required-Start:    $local_fs $remote_fs $network $named
    # Required-Stop:     $local_fs $remote_fs $network $named
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # X-Interactive:     false
    # Short-Description: Start/stop teamspeak 3 server
    ### END INIT INFO
    
    shm=/var/chroot/ts3/dev/shm
    pidfile=/var/chroot/ts3/teamspeak3-server_linux-amd64/ts3server.pid
    
    case "$1" in
    	start)
    		mount -t tmpfs tmpfs $shm
    		su ts3
    		;;
    	stop)
    		echo -n "Stopping the TeamSpeak 3 server"
    		if ( kill -TERM $(cat $pidfile) 2> /dev/null ); then
    			c=1
    			while [ "$c" -le 300 ]; do
    				if ( kill -0 $(cat $pidfile) 2> /dev/null ); then
    					echo -n "."
    					sleep 1
    				else
    					break
    				fi
    				c=$((++c)) 
    			done
    		fi
    		if ( kill -0 $(cat $pidfile) 2> /dev/null ); then
    			echo "Server is not shutting down cleanly - killing"
    			kill -KILL $(cat $pidfile)
    		else
    			echo "done"
    		fi
    		rm $pidfile
    		umount $shm
    		;;
    	*)
    		echo "Usage: $0 {start|stop}"
    		;;
    esac
    EOF
    chmod +x /etc/init.d/teamspeak3
    insserv teamspeak3
    
  4. Recommended: Block outside access to server query, since it’s a telnet based protocol (unencrypted)
    iptables -A INPUT -p tcp ! -s 127.0.0.1 --dport 10011 -j REJECT
    

The point of this guide is to never run the server outside of the chroot. Also I noticed that if the environment wasn’t set up correctly, and the server ran but had strange error messages in the log and didn’t actually work, I had to delete the database file (ts3server.sqlite) and start from scratch.

That’s it, you’re ready to go. Let me know if I missed something.

Mar 112013
 

I recently started using the awesome window manager again. Running into some issues, I wanted to try out the git master version, but not replace my stable installation.

The recipe is:

  1. Build it for installation in $HOME and install it.
    cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/opt/awesome
    make install
    
  2. Create a testing wrapper script awesome-xephyr and put it into $PATH:
    #!/bin/bash
    
    if [ -z "$AWESOME" ]; then
    AWESOME=awesome
    fi
    
    $AWESOME -k "$@" || exit 1
    
    Xephyr :1 -ac -br -noreset -screen 1152x720 &
    xephyr_pid=$!
    
    sleep 1
    
    DISPLAY=:1.0 $AWESOME "$@" &
    awesome_pid=$!
    
    echo "Press ENTER to kill Xephyr"
    read a
    kill $awesome_pid
    kill $xephyr_pid
    
  3. Run it
    #!/bin/bash
    
    # ;; means the default lua search path
    export AWESOME_PREFIX=$HOME/opt/awesome
    export RC=$HOME/.config/awesome/git.lua  # copied from .build.../awesomerc.lua and adjust the beautiful.init theme path
    
    LUA_PATH=";;$AWESOME_PREFIX/share/awesome/lib/?.lua;$AWESOME_PREFIX/share/awesome/lib/?/init.lua" \
    AWESOME=$AWESOME_PREFIX/bin/awesome \
    exec awesome-xephyr -c $RC
    

P.S. You can possibly tweak this to work without the make install directly from the .build directory.

Sep 232012
 

The biggest confusion that I had when getting this to work is that you can only manipulate the UEFI boot loader when booted in UEFI mode. Since my existing Debian installation, as well as the installer CD booted in BIOS emulation mode, I failed to set up the boot loader at first. Key is the efi shell, which I can conveniently access on my ASUS motherboard by hitting Exit in the EZ mode to get to the Advanced mode, then hitting Exit again.

Links

Update: For proper kernel configuration, see [https://www.kernel.org/doc/Documentation/x86/x86_64/uefi.txt] . Starting with 3.7 I had no kernel output any more without these settings.

Jul 242012
 

So in the day and age where webmail clients are a common access method for email, why are some people still using a native email client? Maybe they’re used to it, or maybe they like it that they offer different usability options. Yes, you can more easily customize an application than a website where any change potentially impacts all your user base.

But then how is it possible that these applications, which have been around a long time, can’t get what seems to be basic options for the power user right? I for one would like to have a sensible default sort order in Thunderbird: I would like to sort by the order the email was received, which allows me to quickly notice new emails, while also seeing a threaded view to accomodate email lists threads.

This is not an unusual configuration, for example gmail works pretty much exactly like that. But how is it possible that this configuration is really difficult to get right in Thunderbird? There is a bug to this extend open since 2004! That is a sad state of desktop applications.

Sources

P.S. Yes, it is open source, and we all can contribute, but that can program knows it’s not so easy to do this for such a large software project.

Dec 112010
 

http://www.daskochrezept.de/rezepte/gefuellte-und-ueberbackene-auberginen-melitzanes-paputsakia_28756.html

http://www.daskochrezept.de/rezepte/israelischer-borschtsch-saft_44424.html

http://www.daskochrezept.de/rezepte/kroatischer-gemuesereis-mit-kaese_85725.html

http://www.daskochrezept.de/rezepte/jaiza-po-russki-russische-eier_1317.html

http://www.daskochrezept.de/rezepte/kwass_65076.html

http://www.daskochrezept.de/rezepte/pilz-kohlrouladen_86884.html

http://www.daskochrezept.de/rezepte/rotes-sauerkraut_88072.html

http://www.daskochrezept.de/rezepte/russische-quarkspeise_20010.html

http://www.daskochrezept.de/rezepte/borschtsch-mit-meerrettichsahne_86037.html

http://www.daskochrezept.de/rezepte/armenisches-omelette-mit-mazun_29.html

http://www.daskochrezept.de/rezepte/boehmische-knoblauchsuppe_11151.html

http://www.russlandjournal.de/rezepte/getraenke/moosbeersaft/

http://www.daskochrezept.de/rezepte/tschech-knoedel_58170.html

http://www.daskochrezept.de/rezepte/scharfe-kaesesuppe_74700.html

http://www.daskochrezept.de/rezepte/schnittlauch-ajvar_84701.html

http://www.daskochrezept.de/rezepte/schopska-bulgarischer-salat_81273.html

http://www.daskochrezept.de/rezepte/wodka-kobieta_107806.html

http://www.daskochrezept.de/rezepte/ajlasan-gemueseeintopf-aus-armenien_105628.html

Nov 092010
 

Many thanks to wishie from #alsa, who wrote most of this file!

# 2008-11-15
#
# This .asoundrc will allow the following:
#
# - upmix stereo files to 5.1 speakers.
# - playback real 5.1 sounds, on 5.1 speakers,
# - allow the playback of both stere(oupmixed) and surround(5.1) sources at the same time.
# - use the 6th and 7th channel (side speakers) as a separate soundcard, i.e. for headphones
#   (This is called the "alternate" output throughout the file, device names prefixed with 'a')
# - play mono sources in stereo (like skype & ekiga) on the alterate output
#
# Make sure you have "8 Channels" and NOT "6 Channels" selected in alsamixer!
#
# Please try the following commands, to make sure everything is working as it should.
#
# To test stereo upmix :      speaker-test -c2 -Ddefault -twav
# To test surround(5.1):      speaker-test -c6 -Dplug:dmix6 -twav
# To test alternative output: speaker-test -c2 -Daduplex -twav
# To test mono upmix:         speaker-test -c1 -Dmonoduplex -twav
#
#
# It may not work out of the box for all cards. If it doesnt work for you, read the comments throughout the file.
# The basis of this file was written by wishie of #alsa, and then modified with info from various sources by 
# squisher.

#Define the soundcard to use
pcm.snd_card {
    type hw
    card 0
    device 0
}

# 8 channel dmix - output whatever audio, to all 8 speakers
pcm.dmix8 {
    type dmix
    ipc_key 1024
    ipc_key_add_uid false
    ipc_perm 0660
    slave {
        pcm "snd_card"
        rate 48000
        channels 8
        period_time 0
        period_size 1024
        buffer_time 0
        buffer_size 5120
    }

# Some cards, like the "nforce" variants require the following to be uncommented. It routes the audio to t he correct speakers.
    bindings {
        0 0
        1 1
        2 4
        3 5
        4 2
        5 3
        6 6
        7 7
    }
}

# upmixing - duplicate stereo data to all 6 channels
pcm.ch51dup {
    type route
    slave.pcm dmix8
    slave.channels 8
    ttable.0.0 1
    ttable.1.1 1
    ttable.0.2 1
    ttable.1.3 1
    ttable.0.4 0.5
    ttable.1.4 0.5
    ttable.0.5 0.5
    ttable.1.5 0.5
}

# this creates a six channel soundcard
# and outputs to the eight channel one
# i.e. for usage in mplayer I had to define in ~/.mplayer/config:
#   ao=alsa:device=dmix6
#   channels=6
pcm.dmix6 {
    type route
    slave.pcm dmix8
    slave.channels 8
    ttable.0.0 1
    ttable.1.1 1
    ttable.2.2 1
    ttable.3.3 1
    ttable.4.4 1
    ttable.5.5 1
}

# share the microphone, i.e. because virtualbox grabs it by default
pcm.microphone {
    type dsnoop
    ipc_key 1027
    slave {
        pcm "snd_card"
    }
}

# rate conversion, needed i.e. for wine
pcm.2chplug {
    type plug
    slave.pcm "ch51dup"
}
pcm.a2chplug {
    type plug
    slave.pcm "dmix8"
}

# routes the channel for the alternative
# 2 channel output, which becomes the 7th and 8th channel 
# on the real soundcard
pcm.alt2ch {
    type route
    slave.pcm "a2chplug"
    slave.channels 8
    ttable.0.6    1
    ttable.1.7    1
}

# skype and ekiga are only mono, so route left channel to the right channel
# note: this gets routed to the alternative 2 channels
pcm.mono_playback {
    type route
    slave.pcm "a2chplug"
    slave.channels 8
    # Send Skype channel 0 to the L and R speakers at full volume
    ttable.0.6    1
    ttable.0.7    1
}

# 'full-duplex' device for use with aoss
pcm.duplex {
    type asym
    playback.pcm "2chplug"
    capture.pcm "microphone"
}

pcm.aduplex {
    type asym
    playback.pcm "alt2ch"
    capture.pcm "microphone"
}

pcm.monoduplex {
    type asym
    playback.pcm "mono_playback"
    capture.pcm "microphone"
}

# for aoss
pcm.dsp0 "duplex"
ctl.mixer0 "duplex"

# softvol manages volume in alsa
# i.e. wine likes this
pcm.mainvol {
    type softvol
    slave.pcm "duplex"
    control {
        name "2ch-Upmix Master"
        card 0
    }
}

#pcm.!default "mainvol"

# set the default device according to the environment
# variable ALSA_DEFAULT_PCM and default to mainvol
pcm.!default {
    @func refer
    name { @func concat 
           strings [ "pcm."
                     { @func getenv
                       vars [ ALSA_DEFAULT_PCM ]
                       default "mainvol"
                     }
           ]
         }
}

# uncomment the following if you want to be able to control
# the mixer device through environment variables as well
#ctl.!default {
#    @func refer
#    name { @func concat 
#           strings [ "ctl."
#                     { @func getenv
#                       vars [ ALSA_DEFAULT_CTL
#                              ALSA_DEFAULT_PCM
#                       ]
#                       default "duplex"
#                     }
#           ]
#         }
#}

Wine

wine unfortunately dosen’t seem to try to open the default device, but the following snippet inserted into your ~/.wine/user.reg will do the trick:

[Software\Wine\Alsa Driver]
"AutoScanCards"="N"
"DeviceCount"="1"
"DeviceCTL1"="default"
"DevicePCM1"="default"
"UseDirectHW"="N"

Older Version

This version doesn’t setup the side speakers as a second soundcard.

# upmix.and.dmix.intel8x0 begins ###
#This asoundrc is for snd_intel8x0 based cards.
#It will allow the following:
#
# upmix stereo files to 5.1 speakers.
# playback real 5.1 sounds, on 5.1 speakers,
# allow the playback of both stere(upmixed) and surround(5.1) sources at the same time.
# upmix mono sound from skype
#
#
#Please try the following commands, to make sure everything is working as it should.
#
# To test stereo upmix : speaker-test -c2 -Ddefault -twav
# To test surround(5.1): speaker-test -c6 -Dplug:dmix6 -twav
#
#
#It may not work out of the box for all cards. If it doesnt work for you, read the comments throughout the file.
#If it still doesnt work with your setup, please speak to me (wishie) in #alsa on irc.freenode.net

#Define the soundcard to use
pcm.snd_card {
    type hw
    card 0
    device 0
}

# 6 channel dmix - output whatever audio, to all 6 speakers
pcm.dmix6 {
    type dmix
    ipc_key 1024
    ipc_key_add_uid false
    ipc_perm 0660
    slave {
        pcm "snd_card"
        #rate 48000
        channels 6
        period_time 0
        period_size 1024
        buffer_time 0
        buffer_size 4096
    }

# Some cards, like the "nforce" variants require the following to be uncommented. It routes the audio to t he correct speakers.
    bindings {
        0 0
        1 1
        2 4
        3 5
        4 2
        5 3
    }
}

# upmixing - duplicate stereo data to all 6 channels
pcm.ch51dup {
    type route
    slave.pcm dmix6
    slave.channels 6
    ttable.0.0 1
    ttable.1.1 1
    ttable.0.2 1
    ttable.1.3 1
    ttable.0.4 0.5
    ttable.1.4 0.5
    ttable.0.5 0.5
    ttable.1.5 0.5
}

# rate conversion, needed i.e. for wine
pcm.2chplug {
    type plug
    slave.pcm "ch51dup"
}

# 'full-duplex' device for use with aoss
pcm.duplex {
    type asym
    playback.pcm "2chplug"
    capture.pcm "hw:0"
}

# change default device:
pcm.!default {
    type softvol
    slave.pcm "duplex"
    control {
        name "2ch Master"
        card 0
    }
}

# for aoss
pcm.dsp0 "duplex"
ctl.mixer0 "duplex"

#pcm.default:0 "default"

# upmix.and.dmix.intel8x0 ends ###

# skype is only mono, so route left channel to the right channel
pcm.skype_playback {
    type route
    slave.pcm "2chplug"
    slave.channels 2
    # Send Skype channel 0 to the L and R speakers at full volume
    ttable.0.0    1
    ttable.0.1    1
}

Resources

Other Sites with .asoundrc Examples