home · contact · privacy
For Raspbian setup, add ALSA config.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 24 Feb 2021 01:02:23 +0000 (02:02 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 24 Feb 2021 01:02:23 +0000 (02:02 +0100)
.asoundrc [new file with mode: 0644]

diff --git a/.asoundrc b/.asoundrc
new file mode 100644 (file)
index 0000000..46eb301
--- /dev/null
+++ b/.asoundrc
@@ -0,0 +1,73 @@
+# using hdmi0 for TV stereo, hdmi1 for a 5.1 speaker set-up
+# unfortunately, a non-square speaker number creates some noise
+# therefore for hdmi1 we declare 8 speakers, but re-map them to 6 speakers 
+pcm.hdmi0 {
+  type hw
+  card 0
+}
+pcm.hdmi1 {
+  type route
+  slave {
+    pcm "hw:1,0"
+    channels 8
+  }
+  ttable {
+    0.0 = 1
+    1.1 = 1
+    2.2 = 1
+    3.3 = 1
+    4.4 = 1
+    5.5 = 1
+    6.0 = 0.5
+    6.2 = 0.5
+    7.1 = 0.5
+    7.3 = 0.5
+  }
+}
+
+# upmix stereo to 5.1 – so we can watch stereo YouTube on all speakers
+# with this: $ chromium-browser --alsa-output-device=stereo51
+# (numbers taken from <https://www.volkerschatz.com/noise/alsa.html>)   
+pcm.stereo51  {
+  type route
+  slave {
+    pcm "hw:1,0"
+    channels 8
+  }
+  ttable {
+    0.0 = 1
+    0.2 = -0.6
+    0.3 = -0.39
+    0.4 = 0.5
+    0.5 = 0.5
+    1.1 = 1
+    1.2 = -0.6
+    1.3 = -0.39
+    1.4 = 0.5
+    1.5 = 0.5
+  }
+}
+
+# default to hdmi0, overwrite with AUDIO_HDMI=1 env prefix
+pcm.!default {
+  type plug 
+  slave.pcm {
+    @func concat
+    strings [
+      "hdmi"
+      {
+        @func getenv
+        vars [ AUDIO_HDMI ]
+        default "0"
+      }
+    ]
+  } 
+}
+ctl.!default {
+  type hw 
+  card {
+    @func getenv
+    vars [ AUDIO_HDMI ]
+    default 0 
+  }
+}