Advertisement
Guest User

brebs

a guest
Jun 27th, 2010
801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.39 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. @args [ CHANNELS ]
  30. @args.CHANNELS {
  31. type integer
  32. default 2
  33. }
  34. @args.CARD {
  35. type string
  36. default 0
  37. }
  38. @args.$DEV {
  39. type string
  40. default 0
  41. }
  42. @args.$SUBDEV {
  43. type string
  44. default 0
  45. }
  46. type asym
  47. playback.pcm {
  48. type dmix
  49. ipc_key 5678293
  50. ipc_perm 0660
  51. ipc_gid audio
  52. slave {
  53. channels $CHANNELS
  54. pcm {
  55. type hw
  56. card $CARD
  57. device $DEV
  58. subdevice $SUBDEV
  59. }
  60. period_time {
  61. @func refer
  62. name {
  63. @func concat
  64. strings [
  65. "cards."
  66. {
  67. @func card_driver
  68. card $CARD
  69. }
  70. ".pcm.dmix.period_time"
  71. ]
  72. }
  73. default -1
  74. }
  75. period_size {
  76. @func refer
  77. name {
  78. @func concat
  79. strings [
  80. "cards."
  81. {
  82. @func card_driver
  83. card $CARD
  84. }
  85. ".pcm.dmix.period_size"
  86. ]
  87. }
  88. default 1024
  89. }
  90. periods {
  91. @func refer
  92. name {
  93. @func concat
  94. strings [
  95. "cards."
  96. {
  97. @func card_driver
  98. card $CARD
  99. }
  100. ".pcm.dmix.periods"
  101. ]
  102. }
  103. default 16
  104. }
  105. }
  106. }
  107. capture.pcm {
  108. type dsnoop
  109. ipc_key 5778293
  110. ipc_perm 0660
  111. slave {
  112. pcm {
  113. type hw
  114. card $CARD
  115. device $DEV
  116. subdevice $SUBDEV
  117. }
  118. period_size {
  119. @func refer
  120. name {
  121. @func concat
  122. strings [
  123. "cards."
  124. {
  125. @func card_driver
  126. card $CARD
  127. }
  128. ".pcm.dsnoop.period_size"
  129. ]
  130. }
  131. default 1024
  132. }
  133. period_time {
  134. @func refer
  135. name {
  136. @func concat
  137. strings [
  138. "cards."
  139. {
  140. @func card_driver
  141. card $CARD
  142. }
  143. ".pcm.dsnoop.period_time"
  144. ]
  145. }
  146. default -1
  147. }
  148. periods {
  149. @func refer
  150. name {
  151. @func concat
  152. strings [
  153. "cards."
  154. {
  155. @func card_driver
  156. card $CARD
  157. }
  158. ".pcm.dsnoop.periods"
  159. ]
  160. }
  161. default 16
  162. }
  163. }
  164. }
  165. }
  166.  
  167.  
  168.  
  169. # Playing
  170. #pcm.!default {
  171. # type asym
  172. # playback.pcm "upmix_20to51_resample"
  173. #}
  174.  
  175.  
  176. # Check that e.g. Thief2 still works, if default is redefined.
  177. #pcm.!default {
  178. # type plug
  179. # # 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.
  180. # slave.pcm "dmixed:6"
  181. #}
  182.  
  183. pcm.!surround20 {
  184. type plug
  185. slave.pcm "dmixed:6"
  186. }
  187.  
  188. pcm.!surround40 {
  189. type plug
  190. slave.pcm "dmixed:6"
  191. }
  192.  
  193. pcm.!surround51 {
  194. type plug
  195. slave.pcm "dmixed:6"
  196. }
  197.  
  198.  
  199. # If get error "Slave PCM not usable", then need to use plug:
  200. # If get error "Cannot find rate converter", then install libsamplerate and alsa-plugins
  201.  
  202. # Lunar Linux: lin ladspa-bs2b
  203. # listplugins
  204. # analyseplugin bs2b
  205. pcm.bs2b {
  206. type ladspa
  207. path "/usr/lib/ladspa"
  208. plugins {
  209. 0 {
  210. id 4221 # Bauer stereophonic-to-binaural (4221/bs2b)
  211. input {
  212. controls [ 700 6 ]
  213. }
  214. }
  215. }
  216. # http://bbs.archlinux.org/viewtopic.php?id=95582
  217. slave.pcm "plug:dmixed:6"
  218. }
  219.  
  220.  
  221. # speaker-test -D headphones -c 2 -t wav
  222. # audacious uses less CPU when running bs2b as a listed plugin, probably because of samplerate_best
  223. # Posted at http://bbs.archlinux.org/viewtopic.php?pid=626573#p626573
  224. pcm.headphones {
  225. type rate
  226. slave {
  227. pcm "plug:bs2b"
  228. rate 48000
  229. }
  230. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  231. converter "samplerate_best"
  232.  
  233. hint {
  234. show on
  235. description "Headphones"
  236. }
  237. }
  238.  
  239.  
  240.  
  241. pcm.ch51dup {
  242. slave.pcm "dmixed:6"
  243. slave.channels 6
  244. type route
  245.  
  246. # Front and rear
  247. ttable.0.0 0.5
  248. ttable.1.1 0.5
  249. ttable.2.2 0.5
  250. ttable.3.3 0.5
  251.  
  252. # Center and LFE
  253. ttable.4.4 1
  254. ttable.5.5 1
  255.  
  256. # Front left/right to center
  257. ttable.0.4 0.5
  258. ttable.1.4 0.5
  259.  
  260. # Front left/right to rear
  261. ttable.0.2 0.5
  262. ttable.1.3 0.5
  263. }
  264.  
  265.  
  266.  
  267. # http://alsa.opensrc.org/SurroundSound
  268. # http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  269. # Lunar: lin ladspa tap-plugins swh-plugins cmt-plugins libsamplerate
  270. # Fedora: yum install ladspa ladspa-blop-plugins ladspa-caps-plugins ladspa-cmt-plugins ladspa-swh-plugins ladspa-tap-plugins libsamplerate
  271. # Arch Linux: pacman -S ladspa blop swh-plugins libsamplerate tap-plugins cmt
  272. # For id 1672 - 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa), install blop-plugins
  273. # speaker-test -D upmix_20to51 -c 2 -t wav
  274. # Debugging: speaker-test -D plug:lowpass_21to21 -c 3 -t wav
  275. # listplugins
  276. # analyseplugin cmt
  277. # http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html
  278. # http://forums.gentoo.org/viewtopic-p-4528619.html#4528619
  279. pcm.lowpass_21to21 {
  280. type ladspa
  281. slave.pcm upmix_21to51
  282. # Set the path to ladspa, to fix this error:
  283. # Playback open error: -2,No such file or directory
  284. path "/usr/lib/ladspa"
  285. channels 3
  286. plugins {
  287. 0 {
  288. id 1098 # Identity (Audio) (1098/identity_audio)
  289. policy duplicate
  290. input.bindings.0 "Input";
  291. output.bindings.0 "Output";
  292. }
  293.  
  294. #1 {
  295. # id 1052 # High-pass filter
  296. # policy none
  297. # input.bindings.0 "Input";
  298. # output.bindings.0 "Output";
  299. # input {
  300. # controls [ 300 ]
  301. # }
  302. #}
  303.  
  304. #2 {
  305. # id 1052 # High-pass filter
  306. # policy none
  307. # input.bindings.1 "Input";
  308. # output.bindings.1 "Output";
  309. # input {
  310. # controls [ 300 ]
  311. # }
  312. #}
  313.  
  314. #3 {
  315. # id 1051 # Low-pass filter.
  316. # policy none
  317. # input.bindings.2 "Input";
  318. # output.bindings.2 "Output";
  319. # input {
  320. # controls [ 300 ]
  321. # }
  322. #}
  323.  
  324. # From http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  325. # Can be used instead of 1-3 above.
  326. 1 {
  327. id 1672 # 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa)
  328. policy none
  329. input.bindings.2 "Input";
  330. output.bindings.2 "Output";
  331. input {
  332. controls [ 300 2 ]
  333. }
  334. }
  335. }
  336. }
  337.  
  338.  
  339. # speaker-test -D upmix_20to51 -c 2 -t wav
  340. # In audacious: upmix_20to51
  341. pcm.upmix_20to51 {
  342. type plug
  343. slave.pcm "lowpass_21to21"
  344. slave.channels 3
  345. ttable {
  346. 0.0 1 # left channel
  347. 1.1 1 # right channel
  348. 0.2 0.5 # mix left and right ...
  349. 1.2 0.5 # ... channel for subwoofer
  350. }
  351.  
  352. # slave.rate 48000 makes CPU utilization 20% instead of 3%
  353. # Can't hear the difference with Audigy4 anyway.
  354. # slave.rate 44100 is 3%, so that proves audacious outputs 44100
  355. #slave.rate 48000
  356. #converter "samplerate"
  357. #slave.rate_converter "samplerate_best"
  358. }
  359.  
  360.  
  361. # In audacious: upmix_20to51_resample
  362. # aplay -D upmix_20to51_resample ~/alsa/samplerate-test/udial.wav
  363. pcm.upmix_20to51_resample {
  364. type rate
  365. slave {
  366. pcm upmix_20to51
  367. #format S32_LE
  368. # Audigy4 upmixes to 48000 itself, and seems to use low-quality linear interpolation
  369. rate 48000
  370. }
  371. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  372. # 8% CPU with samplerate_medium - good choice
  373. converter "samplerate_medium"
  374. #converter "samplerate_linear"
  375. hint {
  376. show on
  377. description "20to51"
  378. }
  379. }
  380.  
  381. # Debugging: speaker-test -D upmix_21to51 -c 3 -t wav
  382. pcm.upmix_21to51 {
  383. type plug
  384. # For ice1724:
  385. #slave.pcm surround51-ice
  386. # For Audigy:
  387. slave.pcm "dmixed:6"
  388. # http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946
  389. #slave.pcm dmixed:6
  390. # For P5K ADI:
  391. #slave.pcm surround51-adi
  392. # Trying to pipe through Pulse Audio, to stop the clicks between songs.
  393. # Can't get Pulse Audio to work like this.
  394. #slave.pcm pulse
  395. # Don't need to specify the number of channels.
  396. slave.channels 6
  397. ttable {
  398. 0.0 1 # front left
  399. 1.1 1 # front right
  400. 0.2 1 # rear left
  401. 1.3 1 # rear right
  402.  
  403. # Front left/right to center.
  404. # Imbalanced because is to the left of the monitor!
  405. # Would normally be 0.5 each.
  406. 0.4 0.5
  407. 1.4 0.5
  408.  
  409. # Subwoofer, more powerful to compensate for bass-removal from other speakers.
  410. 2.5 2
  411. }
  412. }
  413.  
  414.  
  415. # Channels are wrong way around in doom! This fixes them.
  416. # http://www.linuxforen.de/forums/archive/index.php/t-206470.html
  417. # http://forums.seriouszone.com/showthread.php?t=49869&page=10
  418. # http://forums.gentoo.org/viewtopic-p-4173170.html#4173170
  419. # For Audigy 4
  420. # Weird, doom3 has crappy sound if I add an alsa rate converter.
  421. # Posted at http://ubuntuforums.org/showthread.php?t=1304228
  422. pcm.doom-surround51 {
  423. slave.pcm "dmixed:6"
  424. slave.channels 6
  425. type route
  426. ttable.0.0 1
  427. ttable.1.1 1
  428. ttable.2.4 1
  429. ttable.3.5 1
  430. ttable.4.2 1
  431. ttable.5.3 1
  432. }
  433.  
  434.  
  435. pcm.doom3-8930g {
  436. type plug
  437. slave.pcm {
  438. type dmix
  439. ipc_key 1093 # Must be unique
  440. ipc_key_add_uid false
  441. ipc_perm 0660
  442. slave {
  443. pcm "hw:0,0"
  444. rate 44100
  445. channels 2
  446. period_time 0
  447. period_size 1024
  448. buffer_time 0
  449. # Doom 3 wants buffer_size 8192
  450. # In ~/.doom3/base/autoexec.cfg
  451. # And ~/.quake4/q4base/autoexec.cfg
  452. # seta s_alsa_pcm "doom3-8930g"
  453. buffer_size 8192
  454. }
  455. }
  456. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement