Guest User

brebs

a guest
May 5th, 2010
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.84 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.  
  167. # Playing
  168. #pcm.!default {
  169. # type asym
  170. # playback.pcm "upmix_20to51_resample"
  171. #}
  172.  
  173.  
  174. #pcm.!default {
  175. # type plug
  176. # slave.pcm "dmixed:2"
  177. #}
  178.  
  179.  
  180. # If get error "Slave PCM not usable", then need to use plug:
  181. # If get error "Cannot find rate converter", then install libsamplerate and alsa-plugins
  182.  
  183. # Lunar Linux: lin ladspa-bs2b
  184. # listplugins
  185. # analyseplugin bs2b
  186. pcm.bs2b {
  187. type ladspa
  188. path "/usr/lib/ladspa"
  189. plugins {
  190. 0 {
  191. id 4221 # Bauer stereophonic-to-binaural (4221/bs2b)
  192. input {
  193. controls [ 700 6 ]
  194. }
  195. }
  196. }
  197. # http://bbs.archlinux.org/viewtopic.php?id=95582
  198. slave.pcm plug:dmixed
  199. #slave.pcm "default"
  200. }
  201.  
  202.  
  203. # speaker-test -D headphones -c 2 -t wav
  204. # audacious uses less CPU when running bs2b as a listed plugin, probably because of samplerate_best
  205. # Posted at http://bbs.archlinux.org/viewtopic.php?pid=626573#p626573
  206. pcm.headphones {
  207. type rate
  208. slave {
  209. pcm "plug:bs2b"
  210. rate 48000
  211. }
  212. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  213. converter "samplerate_best"
  214.  
  215. hint {
  216. show on
  217. description "Headphones"
  218. }
  219. }
  220.  
  221.  
  222.  
  223. pcm.ch51dup {
  224. slave.pcm surround51
  225. slave.pcm dmixed:6
  226. slave.channels 6
  227. type route
  228.  
  229. # Front and rear
  230. ttable.0.0 0.5
  231. ttable.1.1 0.5
  232. ttable.2.2 0.5
  233. ttable.3.3 0.5
  234.  
  235. # Center and LFE
  236. ttable.4.4 1
  237. ttable.5.5 1
  238.  
  239. # Front left/right to center
  240. ttable.0.4 0.5
  241. ttable.1.4 0.5
  242.  
  243. # Front left/right to rear
  244. ttable.0.2 0.5
  245. ttable.1.3 0.5
  246. }
  247.  
  248.  
  249.  
  250. # http://alsa.opensrc.org/SurroundSound
  251. # http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  252. # Lunar: lin ladspa tap-plugins swh-plugins cmt-plugins libsamplerate
  253. # Fedora: yum install ladspa ladspa-blop-plugins ladspa-caps-plugins ladspa-cmt-plugins ladspa-swh-plugins ladspa-tap-plugins libsamplerate
  254. # Arch Linux: pacman -S ladspa blop swh-plugins libsamplerate tap-plugins cmt
  255. # speaker-test -D upmix_20to51 -c 2 -t wav
  256. # Debugging: speaker-test -D plug:lowpass_21to21 -c 3 -t wav
  257. # listplugins
  258. # analyseplugin cmt
  259. # http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html
  260. # http://forums.gentoo.org/viewtopic-p-4528619.html#4528619
  261. pcm.lowpass_21to21 {
  262. type ladspa
  263. slave.pcm upmix_21to51
  264. # Set the path to ladspa, to fix this error:
  265. # Playback open error: -2,No such file or directory
  266. path "/usr/lib/ladspa"
  267. channels 3
  268. plugins {
  269. 0 {
  270. id 1098 # Identity (Audio) (1098/identity_audio)
  271. policy duplicate
  272. input.bindings.0 "Input";
  273. output.bindings.0 "Output";
  274. }
  275.  
  276. 1 {
  277. id 1052 # High-pass filter
  278. policy none
  279. input.bindings.0 "Input";
  280. output.bindings.0 "Output";
  281. input {
  282. controls [ 300 ]
  283. }
  284. }
  285.  
  286. 2 {
  287. id 1052 # High-pass filter
  288. policy none
  289. input.bindings.1 "Input";
  290. output.bindings.1 "Output";
  291. input {
  292. controls [ 300 ]
  293. }
  294. }
  295.  
  296. 3 {
  297. id 1051 # Low-pass filter.
  298. policy none
  299. input.bindings.2 "Input";
  300. output.bindings.2 "Output";
  301. input {
  302. controls [ 300 ]
  303. }
  304. }
  305.  
  306. # From http://alsa.opensrc.org/index.php/Low-pass_filter_for_subwoofer_channel_(HOWTO)
  307. # Can be used instead of 1-3 above.
  308. # 1 {
  309. # id 1672 # 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa)
  310. # policy none
  311. # input.bindings.2 "Input";
  312. # output.bindings.2 "Output";
  313. # input {
  314. # controls [ 300 2 ]
  315. # }
  316. # }
  317. }
  318. }
  319.  
  320.  
  321. # speaker-test -D upmix_20to51 -c 2 -t wav
  322. # In audacious: upmix_20to51
  323. pcm.upmix_20to51 {
  324. type plug
  325. slave.pcm "lowpass_21to21"
  326. slave.channels 3
  327. ttable {
  328. 0.0 1 # left channel
  329. 1.1 1 # right channel
  330. 0.2 0.5 # mix left and right ...
  331. 1.2 0.5 # ... channel for subwoofer
  332. }
  333.  
  334. # slave.rate 48000 makes CPU utilization 20% instead of 3%
  335. # Can't hear the difference with Audigy4 anyway.
  336. # slave.rate 44100 is 3%, so that proves audacious outputs 44100
  337. #slave.rate 48000
  338. #converter "samplerate"
  339. #slave.rate_converter "samplerate_best"
  340. }
  341.  
  342.  
  343. # In audacious: upmix_20to51_resample
  344. # aplay -D upmix_20to51_resample ~/alsa/samplerate-test/udial.wav
  345. pcm.upmix_20to51_resample {
  346. type rate
  347. slave {
  348. pcm upmix_20to51
  349. #format S32_LE
  350. # Audigy4 upmixes to 48000 itself, and seems to use low-quality linear interpolation
  351. rate 48000
  352. }
  353. # Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
  354. # 8% CPU with samplerate_medium - good choice
  355. converter "samplerate_medium"
  356. #converter "samplerate_linear"
  357. }
  358.  
  359. # Debugging: speaker-test -D upmix_21to51 -c 3 -t wav
  360. pcm.upmix_21to51 {
  361. type plug
  362. # For ice1724:
  363. #slave.pcm surround51-ice
  364. # For Audigy:
  365. #slave.pcm surround51
  366. # http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946
  367. #slave.pcm "dmixed:6"
  368. slave.pcm dmixed:6
  369. # For P5K ADI:
  370. #slave.pcm surround51-adi
  371. # Trying to pipe through Pulse Audio, to stop the clicks between songs.
  372. # Can't get Pulse Audio to work like this.
  373. #slave.pcm pulse
  374. # Don't need to specify the number of channels.
  375. slave.channels 6
  376. ttable {
  377. 0.0 1 # front left
  378. 1.1 1 # front right
  379. 0.2 1 # rear left
  380. 1.3 1 # rear right
  381.  
  382. # Front left/right to center.
  383. # Imbalanced because is to the left of the monitor!
  384. # Would normally be 0.5 each.
  385. 0.4 0.5
  386. 1.4 0.5
  387.  
  388. # Subwoofer, more powerful to compensate for bass-removal from other speakers.
  389. 2.5 2
  390. }
  391. }
  392.  
  393.  
  394. # Channels are wrong way around in doom! This fixes them.
  395. # http://www.linuxforen.de/forums/archive/index.php/t-206470.html
  396. # http://forums.seriouszone.com/showthread.php?t=49869&page=10
  397. # http://forums.gentoo.org/viewtopic-p-4173170.html#4173170
  398. # For Audigy 4
  399. # Weird, doom3 has crappy sound if I add an alsa rate converter.
  400. # Posted at http://ubuntuforums.org/showthread.php?t=1304228
  401. pcm.doom-surround51 {
  402. #slave.pcm surround51
  403. slave.pcm dmixed:6
  404. slave.channels 6
  405. type route
  406. ttable.0.0 1
  407. ttable.1.1 1
  408. ttable.2.4 1
  409. ttable.3.5 1
  410. ttable.4.2 1
  411. ttable.5.3 1
  412. }
  413.  
  414.  
  415. pcm.doom3-8930g {
  416. type plug
  417. slave.pcm {
  418. type dmix
  419. ipc_key 1093 # Must be unique
  420. ipc_key_add_uid false
  421. ipc_perm 0660
  422. slave {
  423. pcm "hw:0,0"
  424. rate 44100
  425. channels 2
  426. period_time 0
  427. period_size 1024
  428. buffer_time 0
  429. # Doom 3 wants buffer_size 8192
  430. # In ~/.doom3/base/autoexec.cfg
  431. # And ~/.quake4/q4base/autoexec.cfg
  432. # seta s_alsa_pcm "doom3-8930g"
  433. buffer_size 8192
  434. }
  435. }
  436. }
Advertisement
Add Comment
Please, Sign In to add comment