home · contact · privacy
For Raspbian setup, add ALSA config.
[config] / .asoundrc
1 # using hdmi0 for TV stereo, hdmi1 for a 5.1 speaker set-up
2 # unfortunately, a non-square speaker number creates some noise
3 # therefore for hdmi1 we declare 8 speakers, but re-map them to 6 speakers 
4 pcm.hdmi0 {
5   type hw
6   card 0
7 }
8 pcm.hdmi1 {
9   type route
10   slave {
11     pcm "hw:1,0"
12     channels 8
13   }
14   ttable {
15     0.0 = 1
16     1.1 = 1
17     2.2 = 1
18     3.3 = 1
19     4.4 = 1
20     5.5 = 1
21     6.0 = 0.5
22     6.2 = 0.5
23     7.1 = 0.5
24     7.3 = 0.5
25   }
26 }
27
28 # upmix stereo to 5.1 – so we can watch stereo YouTube on all speakers
29 # with this: $ chromium-browser --alsa-output-device=stereo51
30 # (numbers taken from <https://www.volkerschatz.com/noise/alsa.html>)   
31 pcm.stereo51  {
32   type route
33   slave {
34     pcm "hw:1,0"
35     channels 8
36   }
37   ttable {
38     0.0 = 1
39     0.2 = -0.6
40     0.3 = -0.39
41     0.4 = 0.5
42     0.5 = 0.5
43     1.1 = 1
44     1.2 = -0.6
45     1.3 = -0.39
46     1.4 = 0.5
47     1.5 = 0.5
48   }
49 }
50
51 # default to hdmi0, overwrite with AUDIO_HDMI=1 env prefix
52 pcm.!default {
53   type plug 
54   slave.pcm {
55     @func concat
56     strings [
57       "hdmi"
58       {
59         @func getenv
60         vars [ AUDIO_HDMI ]
61         default "0"
62       }
63     ]
64   } 
65 }
66 ctl.!default {
67   type hw 
68   card {
69     @func getenv
70     vars [ AUDIO_HDMI ]
71     default 0 
72   }
73 }