File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_use_5.1_surround_sound_with_netbsd.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Sun Feb 5 07:14:36 2012 UTC (2 years, 2 months ago) by schmonz
Branches: MAIN
CVS tags: HEAD
dos2unix

**Contents**

[[!toc levels=3]]

#  System Requirements 

  * You will need a 5.1 Capable soundcard. 
  * [NetBSD/i386](Hardware/i386) or [NetBSD/amd64](Hardware/amd64) 2.0 or higher 
  * mplayer or xine software from pkgsrc. 

#  Configuration 

The soundcard should have been automatically configured by the kernel. The audiolayer is configured by 

  * [audioctl(1)](http://netbsd.gw.com/cgi-bin/man-cgi?audioctl+1+NetBSD-current)
  * [mixerctl(1)](http://netbsd.gw.com/cgi-bin/man-cgi?mixerctl+1+NetBSD-current)
  
##  Syntax 

The syntax of audioctl and mixerctl are the same. 
    
    % mixerctl
    mixerctl [-d file] [-v] [-n] name ...
    mixerctl [-d file] [-v] [-n] -w name=value ...
    mixerctl [-d file] [-v] [-n] -a
    %
    

##  Avaible command-line arguments 

##  audioctl 
    
    % audioctl -a
    name=VIA VT8233/8235
    version=0x50
    config=auvia encodings=ulinear:8,mulaw:8*,alaw:8*,slinear:8*,slinear_le:16,ulinear_le:16*,slinear_be:16*,ulinear_be:16* 
    properties=full_duplex,mmap,independent
    full_duplex=0
    fullduplex=0
    blocksize=16384
    hiwat=4
    lowat=3
    monitor_gain=0
    mode=play
    play.rate=48000
    play.channels=4
    play.precision=16
    play.encoding=slinear_le
    play.gain=191
    play.balance=32
    play.port=0x0
    play.avail_ports=0x0
    play.seek=49152
    play.samples=254935040
    play.eof=3509
    play.pause=0
    play.error=1
    play.waiting=0
    play.open=1
    play.active=1
    play.buffer_size=65536
    record.rate=48000
    record.channels=2
    record.precision=16
    record.encoding=slinear_le
    record.gain=0
    record.balance=32
    record.port=0x1
    record.avail_ports=0x7
    record.seek=0
    record.samples=0
    record.eof=0
    record.pause=0
    record.error=0
    record.waiting=0
    record.open=0
    record.active=0
    record.buffer_size=65536
    record.errors=0
    %
    

##  mixerctl
    
    % mixerctl -a
    outputs.master=191,191
    outputs.master.mute=off
    outputs.mono=255
    outputs.mono.mute=on
    outputs.mono.source=mixerout
    outputs.surround=255,255
    outputs.surround.mute=off
    outputs.surround.lineinjack=on
    outputs.surround.mixtofront=on
    outputs.center=127
    outputs.center.mute=off
    outputs.center.micjack=on
    outputs.center.mixtofront=on
    outputs.lfe=127
    outputs.lfe.mute=off
    outputs.lfe.micjack=on
    outputs.lfe.mixtofront=on
    inputs.speaker=255
    inputs.speaker.mute=off
    inputs.phone=191
    inputs.phone.mute=on
    inputs.mic=191
    inputs.mic.mute=on
    inputs.mic.preamp=off
    inputs.mic.source=mic0
    inputs.line=191,191
    inputs.line.mute=off
    inputs.cd=191,191
    inputs.cd.mute=off
    inputs.video=191,191
    inputs.video.mute=off
    inputs.aux=191,191
    inputs.aux.mute=off
    inputs.dac=151,151
    inputs.dac.mute=off
    record.source=mic
    record.volume=0,0
    record.volume.mute=off
    outputs.spatial=off
    outputs.spatial.center=0
    outputs.spatial.depth=0
    %
    

##  Required adjustments

##  Dolby Digital 4.1
    
    % audioctl -w play.channels=4
    % mixerctl -w outputs.master=200,200
    % mixerctl -w outputs.surround.lineinjack=on
    % mixerctl -w outputs.surround.mixtofront=on
    % mixerctl -w outputs.surround=200,200
    

You should put this into your /etc/rc.conf 

##  Dolby Digital 5.1
    
    % audioctl -w play.channels=6
    % mixerctl -w outputs.master=200,200 
    % mixerctl -w outputs.surround.lineinjack=on
    % mixerctl -w outputs.surround.mixtofront=on
    % mixerctl -w outputs.surround=200,200
    % mixerctl -w outputs.center=200
    % mixerctl -w outputs.center.micjack=on
    % mixerctl -w outputs.center.mixtofront=on
    % mixerctl -w outputs.lfe=200
    % mixerctl -w outputs.lfe.micjack=on
    % mixerctl -w outputs.lfe.mixtofront=on
    

You should put this also into your /etc/rc.conf 

#  Supported Players

##  Mplayer

Currently mplayer has the best surround sound support. For 4.1 run 
    
    mplayer -channels 4
    

and for 5.1 
    
    mplayer -channels 6
    

##  Xine

Unfortunately **mplayer** isn't able to handle DTS recorded DVD's. The required libdts (renamed due license restrictions to libdca) is not within the Packages Collection and if you believe several mailinglists it runs currently only on linux. But **xine** with the sun soundriver works fine. At first you have to make some adjustments, because the sound on DTS-DVD's is sampled at 24000 Hz and not 48000 Hz as a normal stereo DVD's. 
    
    $ mixerctl -w outputs.surround.lineinjack=on
    $ mixerctl -w outputs.surround.mixtofront=on
    $ mixerctl -w outputs.master=200,200
    $ mixerctl -w outputs.surround=200,200
    $ audioctl -w play.channels=4
    $ audioctl -w play.rate=24000
    

--[[Mc]] 14:38, 21 February 2006 (CET) 

#  Additional Information 

  * [audioctl(1)](http://netbsd.gw.com/cgi-bin/man-cgi?audioctl+1+NetBSD-current) Manpage 
  * [mixerctl(1)](http://netbsd.gw.com/cgi-bin/man-cgi?mixerctl+1+NetBSD-current) Manpage 


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb