Guest User

brebs

a guest
Sep 23rd, 2010
868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.67 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 44100
  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 roughly 5000, otherwise flash may be silent.
  50. buffer_size 5000
  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 44100
  126. }
  127. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  128. converter "samplerate_medium"
  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. # From http://marcansoft.com/blog/2009/06/acer-aspire-8930g-linux-audio-support/
  165. # To bring all the 8930g speakers into play.
  166. # Works in mplayer but not audacious - weird!
  167. # Have doubled the volume, because mplayer is so quiet.
  168. pcm.stereo8930 {
  169. type route
  170. slave.pcm "dmixed"
  171. slave.channels 6
  172.  
  173. hint {
  174. show on
  175. description "Stereo speakers 8930g"
  176. }
  177. ttable.0.0 2.0
  178. ttable.1.1 2.0
  179. ttable.0.2 2.0
  180. ttable.1.3 2.0
  181. ttable.0.4 0.4
  182. ttable.1.4 0.4
  183. ttable.0.5 1.2
  184. ttable.1.5 1.2
  185. }
  186.  
  187.  
  188. # http://alsa.opensrc.org/SurroundSound
  189. # http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  190. # Lunar: lin ladspa tap-plugins swh-plugins cmt-plugins libsamplerate
  191. # Fedora: yum install ladspa ladspa-blop-plugins ladspa-caps-plugins ladspa-cmt-plugins ladspa-swh-plugins ladspa-tap-plugins libsamplerate
  192. # Arch Linux: pacman -S ladspa blop swh-plugins libsamplerate tap-plugins cmt
  193. # For id 1672 - 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa), install blop-plugins
  194. # speaker-test -D upmix_20to51 -c 2 -t wav
  195. # Debugging: speaker-test -D plug:lowpass_21to21 -c 3 -t wav
  196. # listplugins
  197. # analyseplugin cmt
  198. # http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html
  199. # http://forums.gentoo.org/viewtopic-p-4528619.html#4528619
  200. pcm.lowpass_21to21 {
  201. type ladspa
  202. slave.pcm upmix_21to51
  203. # Set the path to ladspa, to fix this error:
  204. # Playback open error: -2,No such file or directory
  205. path "/usr/lib/ladspa"
  206. channels 3
  207. plugins {
  208. 0 {
  209. id 1098 # Identity (Audio) (1098/identity_audio)
  210. policy duplicate
  211. input.bindings.0 "Input";
  212. output.bindings.0 "Output";
  213. }
  214.  
  215. #1 {
  216. # id 1052 # High-pass filter
  217. # policy none
  218. # input.bindings.0 "Input";
  219. # output.bindings.0 "Output";
  220. # input {
  221. # controls [ 300 ]
  222. # }
  223. #}
  224.  
  225. #2 {
  226. # id 1052 # High-pass filter
  227. # policy none
  228. # input.bindings.1 "Input";
  229. # output.bindings.1 "Output";
  230. # input {
  231. # controls [ 300 ]
  232. # }
  233. #}
  234.  
  235. #3 {
  236. # id 1051 # Low-pass filter.
  237. # policy none
  238. # input.bindings.2 "Input";
  239. # output.bindings.2 "Output";
  240. # input {
  241. # controls [ 300 ]
  242. # }
  243. #}
  244.  
  245. # From http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  246. # Can be used instead of 1-3 above.
  247. 1 {
  248. id 1672 # 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa)
  249. policy none
  250. input.bindings.2 "Input";
  251. output.bindings.2 "Output";
  252. input {
  253. controls [ 300 2 ]
  254. }
  255. }
  256. }
  257. }
  258.  
  259.  
  260. # speaker-test -D upmix_20to51 -c 2 -t wav
  261. # In audacious: upmix_20to51
  262. pcm.upmix_20to51 {
  263. type plug
  264. slave.pcm "lowpass_21to21"
  265. slave.channels 3
  266. ttable {
  267. 0.0 1 # left channel
  268. 1.1 1 # right channel
  269. 0.2 0.5 # mix left and right ...
  270. 1.2 0.5 # ... channel for subwoofer
  271. }
  272.  
  273. # slave.rate 48000 makes CPU utilization 20% instead of 3%
  274. # Can't hear the difference with Audigy4 anyway.
  275. # slave.rate 44100 is 3%, so that proves audacious outputs 44100
  276. #slave.rate 48000
  277. #converter "samplerate"
  278. #slave.rate_converter "samplerate_best"
  279. }
  280.  
  281.  
  282. # In audacious: upmix_20to51_resample
  283. # aplay -D upmix_20to51_resample ~/alsa/samplerate-test/udial.wav
  284. pcm.upmix_20to51_resample {
  285. type rate
  286. slave {
  287. pcm upmix_20to51
  288. #format S32_LE
  289. # Audigy4 upmixes to 48000 itself, and seems to use low-quality linear interpolation
  290. rate 44100
  291. }
  292. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  293. # 8% CPU with samplerate_medium - good choice
  294. converter "samplerate_medium"
  295. #converter "samplerate_linear"
  296. hint {
  297. show on
  298. description "20to51"
  299. }
  300. }
  301.  
  302. # Debugging: speaker-test -D upmix_21to51 -c 3 -t wav
  303. pcm.upmix_21to51 {
  304. type plug
  305. # For ice1724:
  306. #slave.pcm surround51-ice
  307. # For Audigy:
  308. slave.pcm "dmixed"
  309. # http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946
  310. #slave.pcm dmixed:6
  311. # For P5K ADI:
  312. #slave.pcm surround51-adi
  313. # Trying to pipe through Pulse Audio, to stop the clicks between songs.
  314. # Can't get Pulse Audio to work like this.
  315. #slave.pcm pulse
  316. # Don't need to specify the number of channels.
  317. slave.channels 6
  318. ttable {
  319. 0.0 1 # front left
  320. 1.1 1 # front right
  321. 0.2 1 # rear left
  322. 1.3 1 # rear right
  323.  
  324. # Front left/right to center.
  325. # Imbalanced because is to the left of the monitor!
  326. # Would normally be 0.5 each.
  327. 0.4 0.5
  328. 1.4 0.5
  329.  
  330. # Subwoofer, more powerful to compensate for bass-removal from other speakers.
  331. 2.5 2
  332. }
  333. }
  334.  
  335.  
  336. # Channels are wrong way around in doom! This fixes them.
  337. # http://www.linuxforen.de/forums/archive/index.php/t-206470.html
  338. # http://forums.seriouszone.com/showthread.php?t=49869&page=10
  339. # http://forums.gentoo.org/viewtopic-p-4173170.html#4173170
  340. # For Audigy 4
  341. # Weird, doom3 has crappy sound if I add an alsa rate converter.
  342. # Posted at http://ubuntuforums.org/showthread.php?t=1304228
  343. pcm.doom-surround51 {
  344. slave.pcm "dmixed"
  345. slave.channels 6
  346. type route
  347. ttable.0.0 1
  348. ttable.1.1 1
  349. ttable.2.4 1
  350. ttable.3.5 1
  351. ttable.4.2 1
  352. ttable.5.3 1
  353. }
  354.  
  355.  
  356. pcm.doom3-8930g {
  357. type plug
  358. slave.pcm {
  359. type dmix
  360. ipc_key 1093 # Must be unique
  361. ipc_key_add_uid false
  362. ipc_perm 0660
  363. slave {
  364. pcm "hw:0,0"
  365. rate 44100
  366. channels 2
  367. period_time 0
  368. period_size 1024
  369. buffer_time 0
  370. # Doom 3 wants buffer_size 8192
  371. # In ~/.doom3/base/autoexec.cfg
  372. # And ~/.quake4/q4base/autoexec.cfg
  373. # seta s_alsa_pcm "doom3-8930g"
  374. buffer_size 8192
  375. }
  376. }
  377. }
Advertisement
Add Comment
Please, Sign In to add comment