commit
a73335b8d0
7 changed files with 82 additions and 102 deletions
|
@ -1,6 +1,10 @@
|
||||||
# The IPC key of dmix or dsnoop plugin must be unique
|
# The IPC key of dmix or dsnoop plugin must be unique
|
||||||
# If 555555 or 666666 is used by other processes, use another one
|
# If 555555 or 666666 is used by other processes, use another one
|
||||||
|
|
||||||
|
|
||||||
|
# use samplerate to resample as speexdsp resample is bad
|
||||||
|
defaults.pcm.rate_converter "samplerate"
|
||||||
|
|
||||||
pcm.!default {
|
pcm.!default {
|
||||||
type asym
|
type asym
|
||||||
playback.pcm "playback"
|
playback.pcm "playback"
|
||||||
|
@ -19,14 +23,14 @@ pcm.capture {
|
||||||
|
|
||||||
pcm.dmixed {
|
pcm.dmixed {
|
||||||
type dmix
|
type dmix
|
||||||
slave.pcm "hw:0,0"
|
slave.pcm "hw:seeed2micvoicec"
|
||||||
ipc_key 555555
|
ipc_key 555555
|
||||||
}
|
}
|
||||||
|
|
||||||
pcm.array {
|
pcm.array {
|
||||||
type dsnoop
|
type dsnoop
|
||||||
slave {
|
slave {
|
||||||
pcm "hw:0,0"
|
pcm "hw:seeed2micvoicec"
|
||||||
channels 2
|
channels 2
|
||||||
}
|
}
|
||||||
ipc_key 666666
|
ipc_key 666666
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# The IPC key of dmix or dsnoop plugin must be unique
|
# The IPC key of dmix or dsnoop plugin must be unique
|
||||||
# If 555555 or 666666 is used by other processes, use another one
|
# If 555555 or 666666 is used by other processes, use another one
|
||||||
|
|
||||||
|
# use samplerate to resample as speexdsp resample is bad
|
||||||
|
defaults.pcm.rate_converter "samplerate"
|
||||||
|
|
||||||
pcm.!default {
|
pcm.!default {
|
||||||
type asym
|
type asym
|
||||||
playback.pcm "playback"
|
playback.pcm "playback"
|
||||||
|
@ -9,22 +12,22 @@ pcm.!default {
|
||||||
|
|
||||||
pcm.playback {
|
pcm.playback {
|
||||||
type plug
|
type plug
|
||||||
slave.pcm "hw:0,0"
|
slave.pcm "hw:ALSA"
|
||||||
}
|
}
|
||||||
|
|
||||||
pcm.dmixed {
|
# pcm.dmixed {
|
||||||
type dmix
|
# type dmix
|
||||||
slave.pcm "hw:0,0"
|
# slave.pcm "hw:0,0"
|
||||||
ipc_key 555555
|
# ipc_key 555555
|
||||||
}
|
# }
|
||||||
|
|
||||||
pcm.ac108 {
|
pcm.ac108 {
|
||||||
type plug
|
type plug
|
||||||
slave.pcm "multiapps"
|
slave.pcm "hw:seeed4micvoicec"
|
||||||
}
|
}
|
||||||
|
|
||||||
pcm.multiapps {
|
# pcm.multiapps {
|
||||||
type dsnoop
|
# type dsnoop
|
||||||
ac108-slavepcm "hw:1,0"
|
# ac108-slavepcm "hw:1,0"
|
||||||
ipc_key 666666
|
# ipc_key 666666
|
||||||
}
|
# }
|
||||||
|
|
|
@ -1,68 +1,56 @@
|
||||||
# The IPC key of dmix or dsnoop plugin must be unique
|
# The IPC key of dmix or dsnoop plugin must be unique
|
||||||
# If 555555 or 666666 is used by other processes, use another one
|
# If 555555 or 666666 is used by other processes, use another one
|
||||||
|
|
||||||
|
# use samplerate to resample as speexdsp resample is bad
|
||||||
|
defaults.pcm.rate_converter "samplerate"
|
||||||
|
|
||||||
pcm.!default {
|
pcm.!default {
|
||||||
type asym
|
type asym
|
||||||
playback.pcm "playback"
|
playback.pcm "ac101"
|
||||||
capture.pcm "ac108"
|
capture.pcm "ac108"
|
||||||
}
|
}
|
||||||
|
|
||||||
pcm.playback {
|
|
||||||
type plug
|
|
||||||
slave {
|
|
||||||
rate 48000
|
|
||||||
format S32_LE
|
|
||||||
pcm "hw:1,0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pcm.dmixed {
|
|
||||||
type dmix
|
|
||||||
slave.pcm "hw:0,0"
|
|
||||||
ipc_key 555555
|
|
||||||
}
|
|
||||||
|
|
||||||
pcm.ac108 {
|
pcm.ac108 {
|
||||||
type plug
|
type plug
|
||||||
slave.pcm "multiapps"
|
|
||||||
}
|
|
||||||
|
|
||||||
pcm.multiapps {
|
|
||||||
type dsnoop
|
|
||||||
slave {
|
slave {
|
||||||
rate 48000
|
rate 48000
|
||||||
format S32_LE
|
format S32_LE
|
||||||
pcm "hw:1,0"
|
pcm "hw:seeed8micvoicec"
|
||||||
}
|
}
|
||||||
ipc_key 666666
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# pcm.multiapps {
|
||||||
|
# type dsnoop
|
||||||
|
# slave {
|
||||||
|
# rate 48000
|
||||||
|
# format S32_LE
|
||||||
|
# pcm "hw:seeed8micvoicec"
|
||||||
|
# }
|
||||||
|
# ipc_key 666666
|
||||||
|
# }
|
||||||
|
|
||||||
pcm.ac101 {
|
pcm.ac101 {
|
||||||
type plug
|
type plug
|
||||||
slave {
|
slave {
|
||||||
pcm {
|
pcm {
|
||||||
type dmix
|
type route
|
||||||
ipc_key 1048576
|
|
||||||
slave {
|
slave {
|
||||||
pcm "hw:1,0"
|
pcm "hw:seeed8micvoicec"
|
||||||
format S32_LE
|
format S32_LE
|
||||||
# rate 16000
|
|
||||||
channels 8
|
channels 8
|
||||||
}
|
}
|
||||||
bindings {
|
ttable.0.0 1
|
||||||
# map 2 channels input to
|
ttable.1.1 1
|
||||||
# first 2 channels of 8 output
|
ttable.0.2 1
|
||||||
0 0
|
ttable.1.3 1
|
||||||
1 1
|
ttable.0.4 1
|
||||||
0 2
|
ttable.1.5 1
|
||||||
1 3
|
ttable.0.6 1
|
||||||
0 4
|
ttable.1.7 1
|
||||||
1 5
|
|
||||||
0 6
|
|
||||||
1 7
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
channels 2
|
channels 2
|
||||||
|
rate 48000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
install.sh
16
install.sh
|
@ -20,7 +20,7 @@ marker="0.0.0"
|
||||||
|
|
||||||
apt update
|
apt update
|
||||||
apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel
|
apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel
|
||||||
apt-get -y install dkms git i2c-tools
|
apt-get -y install dkms git i2c-tools libasound2-plugins
|
||||||
|
|
||||||
# locate currently installed kernels (may be different to running kernel if
|
# locate currently installed kernels (may be different to running kernel if
|
||||||
# it's just been updated)
|
# it's just been updated)
|
||||||
|
@ -82,6 +82,20 @@ mkdir /etc/voicecard || true
|
||||||
cp *.conf /etc/voicecard
|
cp *.conf /etc/voicecard
|
||||||
cp *.state /etc/voicecard
|
cp *.state /etc/voicecard
|
||||||
|
|
||||||
|
#create git repo
|
||||||
|
git_email=$(git config --global --get user.email)
|
||||||
|
git_name=$(git config --global --get user.name)
|
||||||
|
if [ "x${git_email}" == "x" ] || [ "x${git_name}" == "x" ] ; then
|
||||||
|
echo "setup git config"
|
||||||
|
git config --global user.email "respeaker@seeed.cc"
|
||||||
|
git config --global user.name "respeaker"
|
||||||
|
fi
|
||||||
|
echo "git init"
|
||||||
|
git --git-dir=/etc/voicecard/.git init
|
||||||
|
echo "git add --all"
|
||||||
|
git --git-dir=/etc/voicecard/.git --work-tree=/etc/voicecard/ add --all
|
||||||
|
echo "git commit -m \"origin configures\""
|
||||||
|
git --git-dir=/etc/voicecard/.git --work-tree=/etc/voicecard/ commit -m "origin configures"
|
||||||
|
|
||||||
cp seeed-voicecard /usr/bin/
|
cp seeed-voicecard /usr/bin/
|
||||||
cp seeed-voicecard.service /lib/systemd/system/
|
cp seeed-voicecard.service /lib/systemd/system/
|
||||||
|
|
|
@ -3,30 +3,14 @@
|
||||||
[General]
|
[General]
|
||||||
auto-profiles = no
|
auto-profiles = no
|
||||||
[Mapping seeed-source]
|
[Mapping seeed-source]
|
||||||
device-strings = ac108
|
device-strings = hw:%f
|
||||||
channel-map = front-left,front-right,rear-left,rear-right
|
channel-map = front-left,front-right,rear-left,rear-right
|
||||||
exact-channels = false
|
exact-channels = false
|
||||||
fallback = yes
|
fallback = yes
|
||||||
paths-input = seeed-source
|
paths-input = seeed-source
|
||||||
priority = 3
|
priority = 3
|
||||||
direction = input
|
direction = input
|
||||||
[Mapping seeed-sink]
|
|
||||||
device-strings = playback
|
|
||||||
channel-map = front-left,front-right
|
|
||||||
exact-channels = false
|
|
||||||
fallback = yes
|
|
||||||
paths-output = seeed-sink
|
|
||||||
direction = output
|
|
||||||
priority = 2
|
|
||||||
[Profile output:seeed-sink+input:seeed-source]
|
|
||||||
output-mappings = seeed-sink
|
|
||||||
input-mappings = seeed-source
|
|
||||||
priority = 100
|
|
||||||
skip-probe = yes
|
|
||||||
[Profile output:seeed-sink]
|
|
||||||
output-mappings = seeed-sink
|
|
||||||
priority = 4
|
|
||||||
skip-probe = yes
|
|
||||||
[Profile input:seeed-source]
|
[Profile input:seeed-source]
|
||||||
input-mappings = seeed-source
|
input-mappings = seeed-source
|
||||||
priority = 5
|
priority = 5
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[General]
|
[General]
|
||||||
auto-profiles = no
|
auto-profiles = no
|
||||||
[Mapping seeed-8ch]
|
[Mapping seeed-8ch]
|
||||||
device-strings = hw:1,0
|
device-strings = hw:%f
|
||||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
|
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
|
||||||
exact-channels = false
|
exact-channels = false
|
||||||
fallback = yes
|
fallback = yes
|
||||||
|
@ -11,7 +11,7 @@ paths-input = seeed-8ch
|
||||||
priority = 3
|
priority = 3
|
||||||
direction = input
|
direction = input
|
||||||
[Mapping seeed-2ch]
|
[Mapping seeed-2ch]
|
||||||
device-strings = hw:1,0
|
device-strings = hw:%f
|
||||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
|
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
|
||||||
exact-channels = false
|
exact-channels = false
|
||||||
exact-channels = false
|
exact-channels = false
|
||||||
|
|
|
@ -36,56 +36,43 @@ is_1a=$(i2cdetect -y 1 0x1a 0x1a | grep 1a | awk '{print $2}')
|
||||||
is_35=$(i2cdetect -y 1 0x35 0x35 | grep 35 | awk '{print $2}')
|
is_35=$(i2cdetect -y 1 0x35 0x35 | grep 35 | awk '{print $2}')
|
||||||
is_3b=$(i2cdetect -y 1 0x3b 0x3b | grep 3b | awk '{print $2}')
|
is_3b=$(i2cdetect -y 1 0x3b 0x3b | grep 3b | awk '{print $2}')
|
||||||
|
|
||||||
|
rm /etc/asound.conf
|
||||||
|
rm /var/lib/alsa/asound.state
|
||||||
|
|
||||||
if [ "x${is_1a}" == "x1a" ] && [ "x${is_35}" == "x" ] ; then
|
if [ "x${is_1a}" == "x1a" ] && [ "x${is_35}" == "x" ] ; then
|
||||||
echo "install 2mic"
|
echo "install 2mic"
|
||||||
dtoverlay seeed-2mic-voicecard
|
dtoverlay seeed-2mic-voicecard
|
||||||
sleep 1
|
sleep 1
|
||||||
hw=$(aplay -l | grep seeed2micvoicec | awk '{print $2}' | sed 's/://')
|
|
||||||
|
|
||||||
cp /etc/voicecard/asound_2mic.conf /etc/asound.conf
|
echo "create 2mic asound configure file"
|
||||||
|
ln -s /etc/voicecard/asound_2mic.conf /etc/asound.conf
|
||||||
|
|
||||||
echo "get old hw number"
|
echo "create 2mic asound status file"
|
||||||
old=$(cat /etc/asound.conf | grep hw: | awk 'NR==1 {print $2}' | sed 's/\"//g')
|
ln -s /etc/voicecard/wm8960_asound.state /var/lib/alsa/asound.state
|
||||||
|
|
||||||
echo "replace new hw:${hw},0"
|
|
||||||
sed -i -e "s/${old}/hw:${hw},0/g" /etc/asound.conf
|
|
||||||
|
|
||||||
cp /etc/voicecard/wm8960_asound.state /var/lib/alsa/asound.state
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x" ] ; then
|
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x" ] ; then
|
||||||
echo "install 4mic"
|
echo "install 4mic"
|
||||||
dtoverlay seeed-4mic-voicecard
|
dtoverlay seeed-4mic-voicecard
|
||||||
sleep 1
|
sleep 1
|
||||||
hw=$(arecord -l | grep seeed4micvoicec | awk '{print $2}' | sed 's/://')
|
|
||||||
|
|
||||||
cp /etc/voicecard/asound_4mic.conf /etc/asound.conf
|
echo "create 4mic asound configure file"
|
||||||
|
ln -s /etc/voicecard/asound_4mic.conf /etc/asound.conf
|
||||||
|
|
||||||
echo "get slavepcm line number"
|
echo "create 4mic asound status file"
|
||||||
line=$(grep -n ac108-slavepcm /etc/asound.conf | awk '{print $1}' | sed 's/://')
|
ln -s /etc/voicecard/ac108_asound.state /var/lib/alsa/asound.state
|
||||||
|
|
||||||
echo "delete ${line} slavepcm hw number"
|
|
||||||
sed -i -e "${line}d" /etc/asound.conf
|
|
||||||
|
|
||||||
echo "insert slavepcm hw:${hw},0"
|
|
||||||
sed -i "${line}i slave.pcm \"hw:${hw},0\"" /etc/asound.conf
|
|
||||||
|
|
||||||
cp /etc/voicecard/ac108_asound.state /var/lib/alsa/asound.state
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x35" ] ; then
|
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x35" ] ; then
|
||||||
echo "install 6mic"
|
echo "install 6mic"
|
||||||
dtoverlay seeed-8mic-voicecard
|
dtoverlay seeed-8mic-voicecard
|
||||||
sleep 1
|
sleep 1
|
||||||
hw=$(aplay -l | grep seeed8micvoicec | awk '{print $2}' | sed 's/://')
|
|
||||||
|
|
||||||
cp /etc/voicecard/asound_6mic.conf /etc/asound.conf
|
echo "create 6mic asound configure file"
|
||||||
|
ln -s /etc/voicecard/asound_6mic.conf /etc/asound.conf
|
||||||
|
|
||||||
old=$(cat /etc/asound.conf | grep hw: | awk 'NR==1 {print $2}' | sed 's/\"//g')
|
echo "create 6mic asound status file"
|
||||||
|
ln -s /etc/voicecard/ac108_6mic.state /var/lib/alsa/asound.state
|
||||||
sed -i -e "s/${old}/hw:${hw},0/g" /etc/asound.conf
|
|
||||||
|
|
||||||
cp /etc/voicecard/ac108_6mic.state /var/lib/alsa/asound.state
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alsactl restore
|
alsactl restore
|
||||||
|
|
Loading…
Reference in a new issue