From 2d58fc19c7d34b2c702479fb250418aab51727de Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Thu, 6 Apr 2017 19:38:59 +0200 Subject: [PATCH] Added audio scripts --- audio/71Remap/71remap.sh | 13 ++++ audio/AudioKontrol1/AudioKontrolPort2.sh | 20 +++++++ audio/AudioKontrol1/audioKontrol1_asoundrc | 70 ++++++++++++++++++++++ audio/README.MD | 7 +++ 4 files changed, 110 insertions(+) create mode 100644 audio/71Remap/71remap.sh create mode 100755 audio/AudioKontrol1/AudioKontrolPort2.sh create mode 100644 audio/AudioKontrol1/audioKontrol1_asoundrc create mode 100644 audio/README.MD diff --git a/audio/71Remap/71remap.sh b/audio/71Remap/71remap.sh new file mode 100644 index 0000000..cb906e0 --- /dev/null +++ b/audio/71Remap/71remap.sh @@ -0,0 +1,13 @@ +# Installation: +# Get device name using this command: pacmd list-sinks | grep surround +# Remove "pacmd" and add to /etc/pulse/default.pa + +# Notes; +# Additional line required for 7.1 instead of 5.1 +# Verify right-left mapping for center/lfe device + +pacmd load-module module-remap-sink sink_name="Channel12" remix=no master=alsa_output.pci-0000_00_1b.0.analog-surround-51 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right sink_properties=device.description="Channel12" + +pacmd load-module module-remap-sink sink_name="Channel34" remix=no master=alsa_output.pci-0000_00_1b.0.analog-surround-51 channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right sink_properties=device.description="Channel34" + +pacmd load-module module-remap-sink sink_name="Channel56" remix=no master=alsa_output.pci-0000_00_1b.0.analog-surround-51 channels=2 master_channel_map=front-center,lfe channel_map=front-left,front-right sink_properties=device.description="Channel56" diff --git a/audio/AudioKontrol1/AudioKontrolPort2.sh b/audio/AudioKontrol1/AudioKontrolPort2.sh new file mode 100755 index 0000000..756ad72 --- /dev/null +++ b/audio/AudioKontrol1/AudioKontrolPort2.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# change samplerate in /etc/pulse/daemon.conf config to 192000 +# verify with: +# less /proc/asound/card1/pcm0p/sub1/hw_params + + +# get name and card_name using: pacmd list-sinks + +id=`pacmd dump | grep -e load.*Kontrol.* | head -n 1 | sed "s/.*device_id=\"//g" | sed "s/\".*//g"` + +pacmd load-module module-alsa-card device_id="$id" name="usb-Native_Instruments_Audio_Kontrol_1_SN-SN-2U38Y8KE8O-00-AudioKontrol1.analog-stereo" card_name="alsa_card.usb-Native_Instruments_Audio_Kontrol_1_SN-SN-2U38Y8KE8O-01-AudioKontrol1" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1" sink_properties=device.description=AudioKontrol34 + +# sink_properties="device.description='Audio Kontrol 3/4'" + +# warning: device id might change!!!! + + +# OLD CODE= +# pacmd load-module module-alsa-card device_id="$id" name="usb-Native_Instruments_Audio_Kontrol_1_SN-SN-2U38Y8KE8O-01-AudioKontrol1" card_name="alsa_card.usb-Native_Instruments_Audio_Kontrol_1_SN-SN-2U38Y8KE8O-01-AudioKontrol1" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1" sink_properties="device.description='Audio Kontrol 3/4'" diff --git a/audio/AudioKontrol1/audioKontrol1_asoundrc b/audio/AudioKontrol1/audioKontrol1_asoundrc new file mode 100644 index 0000000..854778d --- /dev/null +++ b/audio/AudioKontrol1/audioKontrol1_asoundrc @@ -0,0 +1,70 @@ +# Makes the subdevices aka channel 1&2 and 3&4 available for alsa applications +pcm_slave.sl12 { + pcm "hw:AudioKontrol1,0,0" + format S24_3BE + channels 2 + rate 192000 +} + +pcm.channel12 { + type plug + slave sl12 + #slave.pcm pulse +} + +pcm_slave.sl34 { + pcm "hw:AudioKontrol1,0,1" + format S24_3BE + channels 2 + rate 192000 +} + +pcm.channel34 { + type plug + slave sl34 + #slave.pcm pulse +} + +# create a virtual four-channel device with two sound devices: +# This is in fact two interleaved stereo streams in +# different memory locations, so JACK will complain that it +# cannot get mmap-based access. see below. +pcm.multi { + type multi; + slaves.a.pcm "hw:AudioKontrol1,0,0"; + slaves.a.channels 2; + slaves.b.pcm "hw:AudioKontrol1,0,1"; + slaves.b.channels 2; + bindings.0.slave a; + bindings.0.channel 0; + bindings.1.slave a; + bindings.1.channel 1; + bindings.2.slave b; + bindings.2.channel 0; + bindings.3.slave b; + bindings.3.channel 1; +} + +# JACK will be unhappy if there is no mixer to talk to, so we set +# this to the usb card. +ctl.multi { + type hw; + card AudioKontrol1; +} + +# This creates a 4 channel interleaved pcm stream based on +# the multi device. JACK will work with this one. +pcm.ttable { + type route; + slave.pcm "multi"; + slave.channels 4; + ttable.0.0 1; + ttable.1.1 1; + ttable.2.2 1; + ttable.3.3 1; +} +# see above. +ctl.ttable { + type hw; + card AudioKontrol1; +} diff --git a/audio/README.MD b/audio/README.MD new file mode 100644 index 0000000..627e417 --- /dev/null +++ b/audio/README.MD @@ -0,0 +1,7 @@ +# Scripts to configure audio devices in Linux + +## 7.1. Remapping +Remaps a 5.1 surround sound card to 3 individual stereo devices. + +## Audio Kontrol 1 +How to get the Audio Kontrol 1 by NI to work.