Dual-card ALSA Configuration

Sound in Linux can be a pain to get right. Thusly, I’ve attached my (functional) configuration for multiple soundcards in ALSA for reference below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

# Set default sound card
# Useful so that all settings can be changed to a different card here.
pcm.av710spdif {
type hw
card 2
device 1
}
pcm.realtek {
type hw
card 0
# device 0
}

pcm.!default {
type plug
slave.pcm "av710duplex"
}

pcm.monitor {
type plug
ttable.0.10 1 # digital mix left
ttable.1.11 1 # digital mix right
slave.pcm "av710spdif"
}

# Allow mixing of multiple output streams to this device
pcm.av710output {
type dmix
ipc_key 1024
ipc_perm 0660 # Sound for everybody in your group!
slave.pcm "av710spdif"
slave {
# This stuff provides some fixes for latency issues.
# buffer_size should be set for your audio chipset.
format S32_LE
period_time 0
period_size 1024
buffer_size 8192
rate 44100
}

bindings {
0 0
1 1
}
}

# Allow reading from the default device.
# Also known as record or capture.
pcm.av710input {
type dsnoop
ipc_key 2048
slave.pcm "av710spdif"
slave {
# This stuff provides some fixes for latency issues.
# buffer_size should be set for your audio chipset.
format S32_LE
period_time 0
period_size 1024
buffer_size 8192
rate 44100
}

bindings {
0 0
1 1
}
}

# This is what we want as our default device
# a fully duplex (read/write) audio device.
pcm.av710duplex {
type asym
playback.pcm "av710output"
capture.pcm "av710input"
}

# Allow mixing of multiple output streams to this device
pcm.realtekoutput {
type dmix
ipc_key 3096
ipc_perm 0660 # Sound for everybody in your group!
slave.pcm "realtek"
slave {
# This stuff provides some fixes for latency issues.
# buffer_size should be set for your audio chipset.
# format S32_LE
period_time 0
period_size 1024
buffer_size 8192
rate 44100
}

bindings {
0 0
1 1
}
}

# Allow reading from the default device.
# Also known as record or capture.
pcm.realtekinput {
type dsnoop
ipc_key 4096
slave.pcm "realtek"
slave {
# This stuff provides some fixes for latency issues.
# buffer_size should be set for your audio chipset.
# format S32_LE
period_time 0
period_size 1024
buffer_size 8192
rate 44100
}

bindings {
0 0
1 1
}
}

# This is what we want as our default device
# a fully duplex (read/write) audio device.
pcm.realtekduplex {
type asym
playback.pcm "realtekoutput"
capture.pcm "realtekinput"
}