Advertisement
Guest User

~/.asoundrc

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