Audio config: Difference between revisions

From Hackerspace Amersfoort
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Install jackd1 (not jackd2 since it depends on dbus, meh).
Install jackd2 from /root/jackd2, which is a jackd2 compiled without dbus (--dbus removed from debian/rules in the debian source package).
Make sure to enable rtprio and memlock permissions, the jackd installer on debian asks for this.
Make sure to enable rtprio and memlock permissions, the jackd installer on debian asks for this.
Put this in /etc/environment
<pre><nowiki>
export JACK_PROMISCUOUS_SERVER=""
</nowiki></pre>


Make a new file /root/jackd_start, chmod to 755 and put this in it:
Make a new file /root/jackd_start, chmod to 755 and put this in it:
Line 65: Line 60:
# Exit if the package is not installed
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
[ -x "$DAEMON" ] || exit 0
#JACK_PROMISCUOUS_SERVER is exported here and in /etc/environment
#this tells jackd and libjack to use /dev/shm/jack instead of /dev/shm/jack-<uid>
#and to set the permissions to 777
export JACK_PROMISCUOUS_SERVER=""


#allow rtprio and mem locking
#allow rtprio and mem locking
ulimit -l unlimited
ulimit -l unlimited
ulimit -r 95
ulimit -r 95
</nowiki></pre>
And
<pre><nowiki>
user "mpd"
</nowiki></pre>
into
<pre><nowiki>
user "bitlair"
</nowiki></pre>
Then run as root:
<pre><nowiki>
dpkg-statoverride --remove /var/run/mpd
dpkg-statoverride --add bitlair audio 755 /var/run/mpd
chown -R bitlair:audio /var/lib/mpd
chown -R bitlair:audio /var/run/mpd
chown -R bitlair:audio /var/log/mpd
</nowiki></pre>
</nowiki></pre>


Use this /etc/asound.conf file
Use this /etc/asound.conf file
<pre><nowiki>
<pre><nowiki>
pcm.!default {
    type plug
    slave { pcm "jack" }
}
pcm.jack {
    type jack
    playback_ports {
        0 system:playback_1
        1 system:playback_2
        2 system:playback_3
        3 system:playback_4
        4 system:playback_5
        5 system:playback_6
    }
    capture_ports {
        0 system:capture_1
        1 system:capture_2
    }
}
ctl.mixer0 {
    type hw
    card 0
}
ctl.jack51 {
ctl.jack51 {
     type hw
     type hw
Line 102: Line 137:
         card Audigy
         card Audigy
     }
     }
}
</nowiki></pre>
In /etc/mpd.conf comment the current audio output, and use this instead:
<pre><nowiki>
audio_output {     
      type    "jack"     
      name    "mpd"   
}
}
</nowiki></pre>
</nowiki></pre>

Latest revision as of 21:01, 5 September 2012

Install jackd2 from /root/jackd2, which is a jackd2 compiled without dbus (--dbus removed from debian/rules in the debian source package). Make sure to enable rtprio and memlock permissions, the jackd installer on debian asks for this.

Make a new file /root/jackd_start, chmod to 755 and put this in it:

#!/bin/bash

#make sure jackd and bobdsp are terminated when this script ends
cleanup()
{
  killall jackd
  killall bobdsp
  exit 0
}
trap cleanup SIGINT
trap cleanup SIGTERM

#JACK_PROMISCUOUS_SERVER is exported here and in /etc/environment
#this tells jackd and libjack to use /dev/shm/jack instead of /dev/shm/jack-<uid>
#and to set the permissions to 777, however umask needs to be set to 0 first
export JACK_PROMISCUOUS_SERVER=""

#allow rtprio and mem locking
ulimit -l unlimited
ulimit -r 95

#start bobdsp
su -l bitlair -c "cd /home/bitlair/bobdsp; ./build/bobdsp -f -d"

#start jackd with -l passed to su to make the environment a login shell, restart when it dies
#jackd needs to run as root, probably because it needs to send signals to its clients
while [ 1 ]
do
  su -l -c "mkdir ~/.jackd; umask 0; jackd -R -d alsa -d jack51 -r 48000 -p 1024 -n 2 -i 2 -o 6 2>&1 | tee ~/.jackd/jackd.log" || true
  sleep 1
done

Put this in /etc/rc.local

/root/jackd_start&

At the top of /etc/init.d/mpd change

#!/bin/sh

to

#!/bin/bash

Then change

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

into

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

#allow rtprio and mem locking
ulimit -l unlimited
ulimit -r 95

And

user				"mpd"

into

user				"bitlair"

Then run as root:

dpkg-statoverride --remove /var/run/mpd
dpkg-statoverride --add bitlair audio 755 /var/run/mpd

chown -R bitlair:audio /var/lib/mpd
chown -R bitlair:audio /var/run/mpd
chown -R bitlair:audio /var/log/mpd

Use this /etc/asound.conf file

pcm.!default {
    type plug
    slave { pcm "jack" }
}

pcm.jack {
    type jack
    playback_ports {
        0 system:playback_1
        1 system:playback_2
        2 system:playback_3
        3 system:playback_4
        4 system:playback_5
        5 system:playback_6
    }
    capture_ports {
        0 system:capture_1
        1 system:capture_2
    }
}

ctl.mixer0 {
    type hw
    card 0
}

ctl.jack51 {
    type hw
    #card 0
    card Audigy
}

pcm.jack51 {
    # "asym" allows for different
    # handling of in/out devices
    type asym
    playback.pcm {
         # route for mmap workaround
         type plug
         slave.pcm "surround51:CARD=Audigy"
         #slave.pcm "surround51"
         slave.channels 6
         route_policy duplicate
    }
    capture.pcm {
        # 2 channels only
        type hw
        #card 0
        card Audigy
    }
}

In /etc/mpd.conf comment the current audio output, and use this instead:

audio_output {       
       type    "jack"       
       name    "mpd"     
}