-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall-sound
159 lines (113 loc) · 5.79 KB
/
install-sound
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
### ####################################
### ALSA
### ####################################
Install alsa utils.
$ pacman -S alsa-utils
$ pacman -S alsa-tools
$ pacman -S alsa-plugins
$ pacman -S libsamplerate
Run alsamixer and unmute the sound.
$ alsamixer
### #####################################
### Fix popping sound when resuming from suspension.
### #####################################
Edit:
/etc/pm/sleep.d/90alsa
Remove the line that says:
aplay -d 1 /dev/zero
### ===========================================
### Downmix sound problems
### ===========================================
#Source: http://www.halfgaar.net/surround-sound-in-linux
Setting up a custom Alsa device
Most applications output in 5.1.
If you only have a 4.0 soundcard, like me, you have to make a custom sound device
for the applications that dont provide downmixing themselves, or if you dont
trust applications to downmix properly (like me...).
I prefer to let every application which plays Dolby Digital 5.1, also output in 5.1,
and control myself how thats routed to 4.0.
This way, Im sure its done properly.
As they say: "if you want something done right, you have to do it yourself."
Alsa has predefined output devices, like surround40 or surround51.
When you instruct a DVD player to output to surround51 on a 4.0 soundcard
the center and LFE channel will not be played.
You want to control how downmixing to 4.0 is done...
1. Define a custom sound device in
$ vim /etc/asound.conf
2. Add the following
pcm.51to40
{
type route
slave.pcm surround51
slave.channels 6
# Front and rear, at 50% of original signal strength
ttable.0.0 0.5
ttable.1.1 0.5
ttable.2.2 0.5
ttable.3.3 0.5
# Center channel routing (routed to front-left and front-right),
# 6dB gaindrop (gain half of main channels) per channel
ttable.4.0 0.25
ttable.4.1 0.25
# LFE channel routing (routed to front-left and front-right),
# 6dB gaindrop (gain half of main channels) per channel
# TODO: actually this is wrong. This article awaits an update.
ttable.5.0 0.25
ttable.5.1 0.25
}
You then have to configure each application to use 51to40 as 5.1 device.
Much to my suprise, with one DVD program, this was not possible.
I believe it was Ogle or Video Lan Client, but I don't know for sure.
For Xine (xine-lib 1.1.4), I have to specify "plug:51to40" as output device.
You may be wondering why I don't trust applications to downmix themselves.
There are multiple reasons: one is that people often think the gaindrop should be -3 dB (or 0.707 gain)
to play one channel over two speakers, but that should be -6 dB.
You can test this very easily with speaker-test (comes with alsa-utils), testing with
non-directional sound (low frequencies). Run "speaker-test -c 6 -D 51to40 -t sine -f 40"
to play a 40 Hz sine on every channel. Center, left and right will sound equally loud, whereas center
would sound louder when you apply only -3 dB gaindrop.
Another reason is that the application may decide to apply dynamic range compression to the downmixed result,
to avoid reaching outside the maximum sampling value of a 16 bit value, which can occur when summing signals
in the digital domain. I absolutely don't want dynamic range compression and this way I can be sure it's not applied.
To avoid clipping distortion, I decrease all the channels in gain somewhat.
The gain of the main channels should be 0.5, and the center and LFE 0.25.
The reason for that is, with all channels at maximum signal strength, the summed total value is exactly 1.0,
so you don't get clipping.
By decreasing the gain on all the channels like I do, you do need a sound sytem that has some room to spare
on the volume control and not have too much noise, otherwise you may not be able to get enough usable volume out of it.
A better solution than decreasing the gain, is getting a soundcard which can output in 5.1, and then use those
seperate signals to feed an amplifier. And of course, when feeding a digital amplifier with s/pdif from a DVD
or other AC3 source, this issue is avoided altogether (as is the the need for this entire article).
When you instruct software to downmix dolby 5.1 to 2.0 matrix encoded (there usually is a special option for that),
dynamic range compression is always used. The Dolby Digital standard demands it, and because two channels have a lot
less combined dynamic range than six, this is also desirable. However, if you really want all the dynamic range of
the surround encoding in two channels, you can use this output configuration:
pcm.51to20
{
type route
slave.pcm surround51
slave.channels 6
# Front and rear, at 33% of original signal strength
ttable.0.0 0.33
ttable.1.1 0.33
ttable.2.0 0.33
ttable.3.1 0.33
# Center channel routing (routed to front-left and front-right),
# 6dB gaindrop (gain half of main channels) per channel
ttable.4.0 0.16
ttable.4.1 0.16
# LFE channel routing (routed to front-left and front-right),
# 6dB gaindrop (gain half of main channels) per channel
ttable.5.0 0.16
ttable.5.1 0.16
}
### #################################################
### Pulse Audio
### #################################################
Instead of removing pulseaudio you can also stop if from auto-restarting and simply killing it of
with an auto-starter each time you login.
$ echo autospawn = no|tee -a ~/.pulse/client.conf
$ killall pulseaudio
After that, simply put killall plulseaudio into your autostart.
You still need the alsa-mixer stuff and totem/audio-preview are also broken.
but it’s quite useful for when you want to temporarily switch to alsa or any other sound system.