Skip to content

Commit

Permalink
config/startup changes for 5.4 kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
kdoren committed Dec 11, 2020
1 parent 79f4a6c commit d419792
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Wired ethernet connection required
* USB audio interface required (i.e. Behringer UM2)
* Can be easily configured to automatically connect to a Jamulus server on startup, then shutdown after a time (i.e. 2 hours)
* realtime kernel and default settings for minimal Jamulus delay
* Default settings for minimal Jamulus delay
* Requires a Jamulus server, in same area for lowest delay. Use a public server, or host your own.

### Simple hardware platform
Expand Down Expand Up @@ -64,8 +64,9 @@ Raspberry Pi + Audio Interface + Headphone Amp. Can be attached to a board with
| JAMULUS_TIMEOUT | *shutdown timer if auto-connecting* | 120m | /home/pi/.config/Jamulus/jamulus_start.conf |
| AJ_SNAPSHOT | *filename of alsa-jack patch configuration* | ajs-um2-stereo.xml | /home/pi/.config/Jamulus/jamulus_start.conf |
| MASTER_LEVEL | *master output level for USB interface* | 75% | /home/pi/.config/Jamulus/jamulus_start.conf |
| CAPTURE_LEVEL | *capture level for USB interface* | 50% | /home/pi/.config/Jamulus/jamulus_start.conf |
| DEVICE | *alsa device ID of USB interface* | hw:1,0 | /etc/jackdrc.conf
| CAPTURE_LEVEL | *capture level for USB interface* | 75% | /home/pi/.config/Jamulus/jamulus_start.conf |
| JAMULUS_ALSA_DEVICE | *alsa device of USB interface* | card 2 | /home/pi/.config/Jamulus/jamulus_start.conf |
| DEVICE | *alsa device ID of USB interface* | hw:2,0 | /etc/jackdrc.conf
| PERIOD | *Jack Audio samples per period* | 64 | /etc/jackdrc.conf |
| NPERIODS | *Jack Audio number of periods per buffer* | 5 | /etc/jackdrc.conf |

Expand Down
2 changes: 1 addition & 1 deletion stage3/06-install-jamulus/files/jackdrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# exec is used to 'morph' the shell interpreter process into jackd process, saving some system resources.
[[ -f /etc/jackdrc.conf ]] && source /etc/jackdrc.conf
JACK_COMMAND="/usr/bin/jackd -t 2000 -R -P 95 -d alsa -d ${DEVICE:-hw:1,0} -r 48000 -p ${PERIOD:-64} -n ${NPERIODS:-5} -X seq -s -S"
JACK_COMMAND="/usr/bin/jackd -t 2000 -R -P 95 -d alsa -d ${DEVICE:-hw:2,0} -r 48000 -p ${PERIOD:-64} -n ${NPERIODS:-5} -X seq -s -S"
exec $JACK_COMMAND
10 changes: 7 additions & 3 deletions stage3/06-install-jamulus/files/jackdrc.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#
# configuraton parameters for /etc/jackdrc
#
# DEVICE=hw:1,0
# PERIOD=64
# NPERIODS=5
# DEVICE=<device> # alsa device ID of USB interface (default: hw:2,0)
# PERIOD=<period> # Jack Audio samples per period (default: 64)
# NPERIODS=<nperiods> # Jack Audio number of periods per buffer (default: 5)

DEVICE=hw:2,0
PERIOD=64
NPERIODS=5
3 changes: 2 additions & 1 deletion stage3/06-install-jamulus/files/jamulus_start.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
# CAPTURE_LEVEL=<level%> # force alsamixer capture level to this value when starting. (default: unset)
# AJ_SNAPSHOT=<snapshot_file_name> # file name of alsa/jack connection snapshot, default: ajs-um2-stereo_only.xml (2 input channels fed separately to Jamulus)
# JAMULUS_TIMEOUT=<timeout> # if auto-connecting to JAMULUS_SERVER, time out and shut down after <timeout> (default "120m")
# JAMULUS_ALSA_DEVICE=<alsa_device> # Alsa card of USB Interface (default "card 2")

JAMULUS_SERVER=
MASTER_LEVEL="75%"
CAPTURE_LEVEL="50%"
CAPTURE_LEVEL="75%"
AJ_SNAPSHOT=ajs-um2-stereo.xml
JAMULUS_TIMEOUT=120m
19 changes: 16 additions & 3 deletions stage3/06-install-jamulus/files/jamulus_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,32 @@ if [ -f ~/.config/Jamulus/jamulus_start.conf ]; then
source ~/.config/Jamulus/jamulus_start.conf
fi

# if $JAMULUS_ALSA_DEVICE is not set, set a default.
# newer kernel uses card 1 for bcm2835 Headphones,
# in that case use card 2 for default USB audio device
if [ -z "$JAMULUS_ALSA_DEVICE" ]; then
aplay -l | grep -qP "^card 1:.*Headphones"
if [ $? -eq 0 ]; then
JAMULUS_ALSA_DEVICE="card 2"
else
JAMULUS_ALSA_DEVICE="card 1"
fi
fi

[[ -z "$AJ_SNAPSHOT" ]] && AJ_SNAPSHOT="ajs-um2-stereo.xml"
[[ -z "$JAMULUS_TIMEOUT" ]] && JAMULUS_TIMEOUT="120m"

ALSA_READY=no
until [[ $ALSA_READY == "yes" ]]; do
aplay -l | grep -q "card 1"
aplay -l | grep -q "$JAMULUS_ALSA_DEVICE"
PLAY_RESULT=$?
arecord -l | grep -q "card 1"
arecord -l | grep -q "$JAMULUS_ALSA_DEVICE"
RECORD_RESULT=$?
if [[ "$PLAY_RESULT" == "0" ]] && [[ "$RECORD_RESULT" == "0" ]]; then
ALSA_READY=yes
else
echo "ALSA Device not available: PLAY_RESULT: $PLAY_RESULT, RECORD_RESULT: $RECORD_RESULT"
echo "ALSA Device not available: PLAY_RESULT for $ALSA_PLAY_DEVICE: $PLAY_RESULT, RECORD_RESULT for $ALSA_RECORD_DEVICE: $RECORD_RESULT"
sleep 5
fi
done

Expand Down

0 comments on commit d419792

Please sign in to comment.