Advertisement
Guest User

brebs

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