Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2010
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.49 KB | None | 0 0
  1. # dmix - plug:dmix supports 1-8 channels, and does use dmix!
  2. # Whereas surround51 doesn't use dmix
  3. # http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946
  4.  
  5.  
  6. # cat /proc/asound/card0/pcm0p/sub0/hw_params
  7. # Output to hw:0,0 to keep at 44.1k rather than dmix's 48k
  8. # 44.1k stops dmix from working, though.
  9.  
  10.  
  11. # From https://bugs.launchpad.net/debian/+source/sdl-mixer1.2/+bug/66483
  12. # Not needed.
  13. #defaults.pcm.dmix_max_periods -1
  14.  
  15.  
  16. #defaults.pcm.rate_converter "samplerate_best"
  17.  
  18. # See /usr/share/alsa/pcm/dmix.conf
  19. #defaults.dmix.period_time 0
  20. #defaults.dmix.periods 4
  21. #defaults.pcm.surround51.device "0"
  22.  
  23.  
  24.  
  25. # From https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1853
  26. # Posted at http://bbs.archlinux.org/viewtopic.php?id=95582
  27. # Is a dmix that actually works!
  28. pcm.dmixed {
  29. type asym
  30. playback.pcm {
  31. # See plugin:dmix at http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
  32. type dmix
  33. ipc_key 5678293
  34. ipc_perm 0660
  35. ipc_gid audio
  36. #rate 48000 # Don't put the rate here! Otherwise it resets the rate & channels set below, as shown by: cat /proc/asound/card0/pcm0p/sub0/hw_params
  37. slave {
  38. channels 6
  39. pcm {
  40. format S16_LE
  41. rate 48000
  42. type hw
  43. card 0
  44. device 0
  45. subdevice 0
  46. }
  47.  
  48. # Play with this value, if you get errors "unable to set buffer size" or "underrun occured"
  49. # 4320 is effective minimum with hda-intel, but flash in firefox needs at least 5000.
  50. buffer_size 10000
  51.  
  52. period_time 0
  53. #period_size 512
  54. #periods 2
  55. }
  56. }
  57.  
  58. capture.pcm {
  59. # Dummy, but present to stop wine from moaning: ALSA lib pcm_asym.c:106:(_snd_pcm_asym_open) capture slave is not defined
  60. type null
  61. }
  62. }
  63.  
  64.  
  65.  
  66. # Playing
  67. #pcm.!default {
  68. # type asym
  69. # playback.pcm "upmix_20to51_resample"
  70. #}
  71.  
  72.  
  73. # Check that e.g. Thief2 still works, if default is redefined.
  74. pcm.!default {
  75. type plug
  76. # Always output to all 6 channels, so the dmixer actually works if e.g. 6-channel is attempted to be started, while 2-channel is playing.
  77. slave.pcm "dmixed"
  78. }
  79.  
  80. pcm.!surround20 {
  81. type plug
  82. slave.pcm "dmixed"
  83. }
  84.  
  85. pcm.!surround40 {
  86. type plug
  87. slave.pcm "dmixed"
  88. }
  89.  
  90. pcm.!surround51 {
  91. type plug
  92. slave.pcm "dmixed"
  93. }
  94.  
  95.  
  96. # If get error "Slave PCM not usable", then need to use plug:
  97. # If get error "Cannot find rate converter", then install libsamplerate and alsa-plugins
  98.  
  99. # Lunar Linux: lin ladspa-bs2b
  100. # listplugins
  101. # analyseplugin bs2b
  102. pcm.bs2b {
  103. type ladspa
  104. path "/usr/lib/ladspa"
  105. plugins {
  106. 0 {
  107. id 4221 # Bauer stereophonic-to-binaural (4221/bs2b)
  108. input {
  109. controls [ 700 6 ]
  110. }
  111. }
  112. }
  113. # http://bbs.archlinux.org/viewtopic.php?id=95582
  114. slave.pcm "plug:dmixed"
  115. }
  116.  
  117.  
  118. # speaker-test -D headphones -c 2 -t wav
  119. # audacious uses less CPU when running bs2b as a listed plugin, probably because of samplerate_best
  120. # Posted at http://bbs.archlinux.org/viewtopic.php?pid=626573#p626573
  121. pcm.headphones {
  122. type rate
  123. slave {
  124. pcm "plug:bs2b"
  125. rate 48000
  126. }
  127. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  128. converter "samplerate_best"
  129.  
  130. hint {
  131. show on
  132. description "Headphones"
  133. }
  134. }
  135.  
  136.  
  137.  
  138. pcm.ch51dup {
  139. slave.pcm "dmixed"
  140. slave.channels 6
  141. type route
  142.  
  143. # Front and rear
  144. ttable.0.0 0.5
  145. ttable.1.1 0.5
  146. ttable.2.2 0.5
  147. ttable.3.3 0.5
  148.  
  149. # Center and LFE
  150. ttable.4.4 1
  151. ttable.5.5 1
  152.  
  153. # Front left/right to center
  154. ttable.0.4 0.5
  155. ttable.1.4 0.5
  156.  
  157. # Front left/right to rear
  158. ttable.0.2 0.5
  159. ttable.1.3 0.5
  160. }
  161.  
  162.  
  163.  
  164. # http://alsa.opensrc.org/SurroundSound
  165. # http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  166. # Lunar: lin ladspa tap-plugins swh-plugins cmt-plugins libsamplerate
  167. # Fedora: yum install ladspa ladspa-blop-plugins ladspa-caps-plugins ladspa-cmt-plugins ladspa-swh-plugins ladspa-tap-plugins libsamplerate
  168. # Arch Linux: pacman -S ladspa blop swh-plugins libsamplerate tap-plugins cmt
  169. # For id 1672 - 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa), install blop-plugins
  170. # speaker-test -D upmix_20to51 -c 2 -t wav
  171. # Debugging: speaker-test -D plug:lowpass_21to21 -c 3 -t wav
  172. # listplugins
  173. # analyseplugin cmt
  174. # http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html
  175. # http://forums.gentoo.org/viewtopic-p-4528619.html#4528619
  176. pcm.lowpass_21to21 {
  177. type ladspa
  178. slave.pcm upmix_21to51
  179. # Set the path to ladspa, to fix this error:
  180. # Playback open error: -2,No such file or directory
  181. path "/usr/lib/ladspa"
  182. channels 3
  183. plugins {
  184. 0 {
  185. id 1098 # Identity (Audio) (1098/identity_audio)
  186. policy duplicate
  187. input.bindings.0 "Input";
  188. output.bindings.0 "Output";
  189. }
  190.  
  191. #1 {
  192. # id 1052 # High-pass filter
  193. # policy none
  194. # input.bindings.0 "Input";
  195. # output.bindings.0 "Output";
  196. # input {
  197. # controls [ 300 ]
  198. # }
  199. #}
  200.  
  201. #2 {
  202. # id 1052 # High-pass filter
  203. # policy none
  204. # input.bindings.1 "Input";
  205. # output.bindings.1 "Output";
  206. # input {
  207. # controls [ 300 ]
  208. # }
  209. #}
  210.  
  211. #3 {
  212. # id 1051 # Low-pass filter.
  213. # policy none
  214. # input.bindings.2 "Input";
  215. # output.bindings.2 "Output";
  216. # input {
  217. # controls [ 300 ]
  218. # }
  219. #}
  220.  
  221. # From http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  222. # Can be used instead of 1-3 above.
  223. 1 {
  224. id 1672 # 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa)
  225. policy none
  226. input.bindings.2 "Input";
  227. output.bindings.2 "Output";
  228. input {
  229. controls [ 300 2 ]
  230. }
  231. }
  232. }
  233. }
  234.  
  235.  
  236. # speaker-test -D upmix_20to51 -c 2 -t wav
  237. # In audacious: upmix_20to51
  238. pcm.upmix_20to51 {
  239. type plug
  240. slave.pcm "lowpass_21to21"
  241. slave.channels 3
  242. ttable {
  243. 0.0 1 # left channel
  244. 1.1 1 # right channel
  245. 0.2 0.5 # mix left and right ...
  246. 1.2 0.5 # ... channel for subwoofer
  247. }
  248.  
  249. # slave.rate 48000 makes CPU utilization 20% instead of 3%
  250. # Can't hear the difference with Audigy4 anyway.
  251. # slave.rate 44100 is 3%, so that proves audacious outputs 44100
  252. #slave.rate 48000
  253. #converter "samplerate"
  254. #slave.rate_converter "samplerate_best"
  255. }
  256.  
  257.  
  258. # In audacious: upmix_20to51_resample
  259. # aplay -D upmix_20to51_resample ~/alsa/samplerate-test/udial.wav
  260. pcm.upmix_20to51_resample {
  261. type rate
  262. slave {
  263. pcm upmix_20to51
  264. #format S32_LE
  265. # Audigy4 upmixes to 48000 itself, and seems to use low-quality linear interpolation
  266. rate 48000
  267. }
  268. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  269. # 8% CPU with samplerate_medium - good choice
  270. converter "samplerate_medium"
  271. #converter "samplerate_linear"
  272. hint {
  273. show on
  274. description "20to51"
  275. }
  276. }
  277.  
  278. # Debugging: speaker-test -D upmix_21to51 -c 3 -t wav
  279. pcm.upmix_21to51 {
  280. type plug
  281. # For ice1724:
  282. #slave.pcm surround51-ice
  283. # For Audigy:
  284. slave.pcm "dmixed"
  285. # http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946
  286. #slave.pcm dmixed:6
  287. # For P5K ADI:
  288. #slave.pcm surround51-adi
  289. # Trying to pipe through Pulse Audio, to stop the clicks between songs.
  290. # Can't get Pulse Audio to work like this.
  291. #slave.pcm pulse
  292. # Don't need to specify the number of channels.
  293. slave.channels 6
  294. ttable {
  295. 0.0 1 # front left
  296. 1.1 1 # front right
  297. 0.2 1 # rear left
  298. 1.3 1 # rear right
  299.  
  300. # Front left/right to center.
  301. # Imbalanced because is to the left of the monitor!
  302. # Would normally be 0.5 each.
  303. 0.4 0.5
  304. 1.4 0.5
  305.  
  306. # Subwoofer, more powerful to compensate for bass-removal from other speakers.
  307. 2.5 2
  308. }
  309. }
  310.  
  311.  
  312. # Channels are wrong way around in doom! This fixes them.
  313. # http://www.linuxforen.de/forums/archive/index.php/t-206470.html
  314. # http://forums.seriouszone.com/showthread.php?t=49869&page=10
  315. # http://forums.gentoo.org/viewtopic-p-4173170.html#4173170
  316. # For Audigy 4
  317. # Weird, doom3 has crappy sound if I add an alsa rate converter.
  318. # Posted at http://ubuntuforums.org/showthread.php?t=1304228
  319. pcm.doom-surround51 {
  320. slave.pcm "dmixed"
  321. slave.channels 6
  322. type route
  323. ttable.0.0 1
  324. ttable.1.1 1
  325. ttable.2.4 1
  326. ttable.3.5 1
  327. ttable.4.2 1
  328. ttable.5.3 1
  329. }
  330.  
  331.  
  332. pcm.doom3-8930g {
  333. type plug
  334. slave.pcm {
  335. type dmix
  336. ipc_key 1093 # Must be unique
  337. ipc_key_add_uid false
  338. ipc_perm 0660
  339. slave {
  340. pcm "hw:0,0"
  341. rate 44100
  342. channels 2
  343. period_time 0
  344. period_size 1024
  345. buffer_time 0
  346. # Doom 3 wants buffer_size 8192
  347. # In ~/.doom3/base/autoexec.cfg
  348. # And ~/.quake4/q4base/autoexec.cfg
  349. # seta s_alsa_pcm "doom3-8930g"
  350. buffer_size 8192
  351. }
  352. }
  353. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement