HOWTO: 5.1 Surround sound with OSS4

OSS specific Linux discussion (x86/amd64)

Moderators: hannu, dev, cesium

Known Member
Posts: 1208
Joined: Sun Jun 28, 2009 9:31 pm

HOWTO: 5.1 Surround sound with OSS4

Postby igorzwx » Sat Aug 27, 2011 12:41 am

5.1 Surround sound does work with OSS4, but you may need to disable VMix to make it work.

NOTE: On this particular ancient soundcard, I have only one "sound device", that is, "/dev/oss/oss_ich0/pcm0", for all purposes:

Code: Select all

$ ossinfo
  /dev/dsp -> /dev/oss/oss_ich0/pcm0
  /dev/dsp_in -> /dev/oss/oss_ich0/pcm0
  /dev/dsp_out -> /dev/oss/oss_ich0/pcm0
  /dev/dsp_ac3 -> /dev/oss/oss_ich0/pcm0
  /dev/dsp_mmap -> /dev/oss/oss_ich0/pcm0
  /dev/dsp_multich -> /dev/oss/oss_ich0/pcm0

If you have more devices, you may need to adjust your settings.

To fix your OSS Mixer settings, you may need a test audio file, the right one.

Step 1: Download the proper test file for 5.1 Surround

It is here (thanks to Cesium):
cesium wrote:How did you test the 5.1? You can try using ossplay and this file (after gunzip).
Download 6_Channel_ID.wav.gz ... _ID.wav.gz

Step 2: Play the test wave:

Code: Select all

$ ossplay -Rlv 6_Channel_ID.wav
Playing WAVE file 6_Channel_ID.wav, 16 bits/6 channels/44100 Hz
Warning: Playback using 48000 Hz (file 44100 Hz)
Time: 00:05.20 of 00:05.84 VU ------ 

Notice that "-R" disables VMix.
When the test wave is playing and telling the names of channels, you may try different settings in the OSS Mixer (GUI), if you do not know the right ones.

However, if you play this wave to the "multich" device with VMix, it will mix all channels and play this "mix" with terrible distortions.
VMix is a kind of PulseAudio (in this sense). Although VMix seems to work well with Stereo.

Code: Select all

$ ossmix vmix0-channels Multich
Value of mixer control vmix0-channels set to Multich
$ ossmix | grep Multich
vmix0-channels <Stereo|Multich> (currently Multich)

Code: Select all

$ ossplay -vl -d/dev/dsp_multich 6_Channel_ID.wav
Playing WAVE file 6_Channel_ID.wav, 16 bits/6 channels/44100 Hz
Time: 00:05.84 of 00:05.84 VU 0 

Of course, it is not very convenient to play music with "ossplay -R".
Moreover, that buggy "ossplay" may also produce a terrible noise when playing "High Resolution" (HiRes) audio files viewtopic.php?f=3&t=4405

Alternative solution:

1. Disable the Virtual Mixer (vmix)

Code: Select all

$ ossmix vmix0-enable OFF
Value of mixer control vmix0-enable set to OFF
$ ossmix | grep vmix0-enable
vmix0-enable ON|OFF (currently OFF)

WARNING: This does not always work. Sometimes, to make it work, you have to kill all "invisible terrorists" (such as "knotify4") with the magic script:

Code: Select all

$ sudo /usr/lib/oss/scripts/

See: ... ample_Rate

Notice that the buggy "ossplay" is a notorious trouble maker and terrorist.
If VMix is disabled (in OSS mixer), "ossplay" will continue to mix channels and produce noise.
The only way to play 5.1 surround with "ossplay" is this one:

Code: Select all

$ ossplay -vRl 6_Channel_ID.wav

Do not worry! There is the Russian Ultimate Music Player (DeadBeef), is does the work well with the native OSS plugin.
It also works well with the special OSS plugin for audiophiles (made by Sergey Petrov).

2. Install DeadBeef

If you are using DeadBeef with the special OSS plugin, you can select "exclusive mode" in its settings.
If you are using DeadBeef with its native OSS plugin, you have to disable "vmix" in OSS Mixer.

Code: Select all

$ ossmix vmix0-enable OFF

Do not forget to restart DeadBeef and ensure that "vmix" is really disabled. This is important!
Otherwise, if you simply make a mouse click on OSS Mixer (Gui) to disable "vmix" (or make it from terminal), this does not work with DeadBeef (with its native OSS plugin). You have to restart DeadBeef, at least, to get rid of "vmix".

If you manage to play 5.1 Surround with DeadBeef and the test file, you may try the HiRes 5.1 Surround audio files. The free HiRes samples are here: DeadBeef plays them well, when OSS4 resamplers are diabled.

I just tested this with an ancient soundcard of the last century:

Code: Select all

$ lspci | grep -i Audio
00:02.7 Multimedia audio controller: Silicon Integrated Systems [SiS] AC'97 Sound Controller (rev a0)

Although, it has only one "native sample rate", 48kHz, and format 16bit, according to "ossinfo -v9", it plays "24bit 6ch 96000Hz" format without problems with DeadBeef, when OSS4 resamplers are disabled ("vmix" is disabled).
The Secret Rabbit Code plugin in DeadBeef is also disabled.

Code: Select all

$ ossinfo -v9
    Output formats (0x00000410):
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_AC3      - AC3 (Dolby Digital) encoded audio
    Supported number of channels (min - max): 2 - 6
    Native sample rates (min - max): 48000 - 48000

Code: Select all

$ deadbeef
starting deadbeef devel
streamer_set_output_format 24bit int 6ch 96000Hz channelmask=3F

streamer_set_output_format 24bit int 6ch 192000Hz channelmask=3F

streamer_set_output_format 24bit int 6ch 352800Hz channelmask=3F

"24bit 6ch 192000Hz" format is also played by this ancient soundcard without "software resamplers".
It also plays "16bit 6ch 44100Hz" without problems, of course.
"24bit 6ch 352800Hz" format is also played, but you may notice sound interruptions. You could not expect much of the old box (of 2001).

This ancient soundcard does play High Definition formats, such as DXD Waves, simply because OSS4 has a kind of "secret PulseAudio" inside. It is called "Cooked Mode" ... DMODE.html
This evil thing resamples everything with the "Fast resampler" (it is, of course, a kind of "open sourse crap").

Since the Russian Ultimate Music Player (DeadBeef) is working so well, the Arch Linux developers have already infected it with PulseAudio.
Package Details: deadbeef 0.5.1-1
pulseaudio (optional) - for PulseAudio output plugin ... /deadbeef/

This means that DeadBeef was compiled with PulseAudio support:
$ cat /var/abs/community/deadbeef/PKGBUILD
# $Id: PKGBUILD 48027 2011-05-27 16:02:04Z lfleischer $
# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor: Alexey Yakovenko <>

pkgdesc='An audio player for GNU/Linux based on GTK2.'
arch=('i686' 'x86_64')
depends=('gtk2' 'libsamplerate' 'alsa-lib' 'hicolor-icon-theme' 'desktop-file-utils')
makedepends=('libvorbis' 'libmad' 'flac' 'curl' 'wavpack' 'libsndfile' 'libcdio' 'libcddb' 'ffmpeg'
'libx11' 'faad2' 'zlib' 'intltool' 'pkgconfig' 'libpulse' 'libzip')

In short, a certain Lukas Fleischer from compiled DeadBeef for Arch Linux in a very special way. It might not necessarily be a kind of "open-source backdoor", but nobody knows, see:

If you install DeadBeef from Arch Linux repositories, you may get problems with PulseAudio.
However, it is not difficult to recompile DeadBeef:

Code: Select all

./configure --prefix=/usr --disable-pulse --disable-alsa

You may also want to remove libpulse dependency (and ALSA dependencies) in DeadBeef's PKGBUILD (Arch Linux).
If you do not know how to recompile Arch Linux packages, you may read this: viewtopic.php?f=3&t=3543&start=30#p15711

To make 5.1 Surround work with DeadBeef player and its native OSS plugin, the following settings are required for this particular ancient sound card:

Code: Select all

$ ossmix
Selected mixer 0/ICH AC97 Mixer (ALC655)
Known controls are:
vol [<leftvol>:<rightvol>] (currently 29:29)
vol.rec ON|OFF (currently OFF)
pcm [<leftvol>:<rightvol>] (currently 23:23)
rear [<leftvol>:<rightvol>] (currently 24:24)
center [<leftvol>:<rightvol>] (currently 82:82)
mixext.centervol [<leftvol>:<rightvol>] (currently 100:100)
mixext.rearvol [<leftvol>:<rightvol>] (currently 100:100)
mixext.sidevol [<leftvol>:<rightvol>] (currently 100:100)
mixext.rear2linejack ON|OFF (currently ON)
mixext.center2micjack ON|OFF (currently ON)
mixext.spkmode <FRONT|SPREAD> (currently FRONT)
mixext.mix-lfe2front ON|OFF (currently OFF)
mixext.mix-rear2front ON|OFF (currently OFF)
vmix0-enable ON|OFF (currently OFF)

Since "vmix" is disabled, other "vmix" settings do not matter.
I do not use SPDIF, and I do not believe that it makes a "better sound quality".
Although DeadBeef's native OSS plugin seems to work well, I tend to use the special OSS plugin for audiophiles (in "exclusive mode").

Thanks Cesium for his constant willingness to help OSS4 users.
OSS Mixer settings for 5.1 Surround
(28.81 KiB) Downloaded 1772 times

Return to “Linux”

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 3 guests