oss and alsa simultaneouly

OSS specific Linux discussion (x86/amd64)

Moderators: hannu, dev, cesium

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

Re: oss and alsa simultaneouly

Postby igorzwx » Tue Jul 21, 2015 8:18 pm

nuc wrote:But here, try to actually provide productive info. Don't think in problems, but in solutions.

If the problems are not carefully defined, any solutions to such ill-defined problems may not make much sense.
Although, of course, the productions of practical solutions to ill-defined problems might be a very serious exercise in "stupid business" (e.g. Cargo cult).

For example, it turned out that it is possible to load ALSA drivers together with OSS4 drivers.
However, it is still unclear whether it is a practical solution to certain problems or not.

Perhaps, you may try to read this thread and contribute some "practical knowledge" here.

Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: oss and alsa simultaneouly

Postby ossuserr » Sat Jul 25, 2015 8:03 pm

alsa+jackd = free of charge , pyramix = 2500 dollars.
alsa+jackd number of mixed channels is limited by ram and cpu power, pyramix number of channels is limited by pyramix design + uses special proprietry software which is questionable on compatibility with jackd interface. Also the quality of free soundfonts is hardly so high to make a big difference on pyramix vs jackd+good_soundcard. Then purcahse of pyramix presupposes purchase of everything expensive for the sake of that utter quality which most people won't even notice...
I consider that music things must be free and affordable to everyone so that everyone could express himself/herself. Those times have passed when narrow circles had access to those hardware studios and could dictate which music is supposed to be popular.

Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: oss and alsa simultaneouly

Postby ossuserr » Sat Aug 22, 2015 1:48 pm

More here _http://www.opensound.com/forum/viewtopic.php?f=3&t=5807&p=21278

Known Member
Posts: 272
Joined: Thu Jan 08, 2015 12:01 am
Sound Card: audigy 2 zs platinum, esi juli
OS: gentu riced to bo0st
Location: Earth

Re: oss and alsa simultaneouly

Postby ossuserr » Sat Jan 02, 2016 8:26 pm

-------------------------------------------THE MANUAL __ OSS+ALSA--------------------------
If you want to use jackd2 instead of jackd1 (WE HIGHLY RECOMMEND JACKD1 !), read the topic _http://opensound.com/forum/viewtopic.php?f=3&t=5291&sid=1cc2bbd5c1bd84d0956f1153ef0749ef&start=15

Alsa support is to be activated in linux kernel as modules. See _https://wiki.gentoo.org/wiki/ALSA#Kernel

We recommend to use realtime kernel:

Code: Select all

emerge -av rt-sources

Code: Select all

cd /usr/src/your-rt-kernel-folder && ls

If there are patches in the folder apply them by:

Code: Select all

patch -p1 < patchfile1.patch
patch -p1 < patchfile2.patch

Activate fully-preemptible kernel and the drivers for your hardware. Enable midi options. Don't enable virmidi! Timer or cycles should be set to 1000: CONFIG_HZ_1000=y
Perhaps, rt patch already has set it to 1000.

Save the modifications made as .config file.

Code: Select all

make  && make modules_install
make install
eselect kernel list
eselect kernel set X  (where X is your rt kernel's number)
genkernel --install initramfs
emerge @module-rebuild

Now you need to edit grub.cfg to be able to boot the new kernel. Probably you should issue something like:

Code: Select all

su -c 'update-grub'

But i hate grub and use lilo. You can read about lilo at _https://wiki.gentoo.org/wiki/LILO
If you want to go the LILO way, uninstall grub and install lilo by

Code: Select all

# emerge --unmerge grub
# emerge lilo

And follow the lilo manual.

Perhaps, if you install sabayon precompiled gentu, alsa is already enabled in the kernel. But it may be not in the form of modules. That's why we cannot recommend sabayon. Try installing gentu as per gentu manual with manual configuring the kernel. Beware that deprecated lines in the kernel for OSS should be disabled in .config file used for configuring the kernel via menuconfig command. _https://wiki.gentoo.org/wiki/OSS#Kernel

Info concerning installation and use of oss on gent00 are the following:

1. It's not possible to compile OSS using gcc 5.3.0 with any compiler flags! I managed to compile it using 4.9.3 with the flag -O0 Other flags won't build OSS! So install another lower gcc version if u have 5.x.x version.

Code: Select all

# emerge eix
# eix-sync

Now use eix to see the available versions of gcc:

Code: Select all

eix sys-devel/gcc

Install for example gcc-4.9.3 by command:

Code: Select all

# emerge  =sys-devel/gcc-4.9.3

Before compiling on gentu check that the OS is linked to the current kernel in use by:

Code: Select all

eselect kernel list

If OS environment is linked to another kernel, make the proper link by:

Code: Select all

eselect kernel set NUMBER

Otherwise OSS won't compile.

2. funtoo-overlay no longer keeps OSS. You need to use git clone.

Code: Select all

cd /var/db
git clone http://git.funtoo.org/funtoo-media

to grab OSS code.

Code: Select all

# vi /etc/portage/repos.conf/gentoo.conf

Put there as follows:

Code: Select all

location = /var/db/funtoo-media
sync_type = git


Code: Select all

# cp -R /lib64/modules/YOUR-KERNEL_VERSION-PATH/kernel/sound    /root/

After adding funtoo-media overlay issue the command:
emerge -pv oss
to see the use flags that are proposed to you.
2. Edit /etc/portage/package.use/package.use to set the flags you want. I have such flags:
media-sound/oss gtk -salsa vmix-float -alsa -pax_kernel ogg -midi oss_cards_envy24ht oss_cards_sblive

Beware that you may have different cards in your chassis. Leave all other flags like mine.

3. Switch to gcc 4 if currently it's gcc5 by

Code: Select all

gcc-config -l
gcc-config NUMBER
source /etc/profile

3.1. Install OSS

Code: Select all

# emerge oss

3.2 Uninstall OSS

Code: Select all

# emerge --unmerge oss

3.3. Remove the files blocking hack of oss to provide production resampling quality:

Code: Select all

# rm -f /var/tmp/portage/media-sound/oss-4.2.2011/.compiled /var/tmp/portage/media-sound/oss-4.2.2011/.configured /var/tmp/portage/media-sound/oss-4.2.2011/.unpacked /var/tmp/portage/media-sound/oss-4.2.2011/.setuped /var/tmp/portage/media-sound/oss-4.2.2011/.pretended

4. Go to the ebuild directory. Mine is /var/db/funtoo-media/media-sound/oss
(to have the same location you should cd to /var/db before doing git clone ...url-of-funtoo-media)
Issue two commands:

Code: Select all

ebuild oss*.ebuild unpack
ebuild oss*.ebuild prepare

Only after prepare you should modify the configure file to avoid resetting to 3!

5. Modify configure file.

Code: Select all

# leafpad /var/tmp/portage/media-sound/oss-4.2.2011/work/oss-v4.2-build2011-src-gpl/configure

Change 3 by 6 for GRC.

6. Issue

Code: Select all

ebuild oss*.ebuild compile

7. Now its time to check if our modifications were observed. Go to the build dir which located inside the work dir.

Code: Select all

# cd /var/tmp/portage/media-sound/oss-4.2.2011/work/build

and do:

Code: Select all

less ./noregparm/kernel/framework/include/local_config.h
less ./prototype/usr/lib/oss/include/internals/local_config.h
less ./kernel/framework/include/local_config.h

YOU ARE TO HAVE ONLY 6 for quality!

8. Return back to the dir where ebuild is located:

Code: Select all

cd -

and issue:

Code: Select all

ebuild oss*.ebuild install
ebuild oss*.ebuild qmerge

This will install the driver.

9. You may switch back to gcc5 now. See point 3 above.

10. ossdetect -v

11. soundon

12. ossdevlinks -v -r

13. Now as a user (not as a root) you may issue

Code: Select all

$ ossxmix -b -n 1 &

to start ossxmix.

After compiling OSS you can copy alsa modules back.

Code: Select all

# cp -R /root/sound /lib64/modules/3.14.46-rt-rt46/kernel/

Actually u need only modules for midi support but it's easier to restore all modules and blacklist those referring to audio|pcm. On gent00 you are to edit the file /etc/modprobe.d/blacklist.conf

For me /etc/modprobe.d/blacklist.conf looks like this:

Code: Select all

blacklist snd_hda_nvidia
blacklist snd_emu10k1
blacklist snd_hda_intel
blacklist snd_hda_codec
blacklist snd_pcm
blacklist snd_hda_controller
blacklist snd_cmipci
blacklist snd_timer
blacklist snd_opl3_lib
blacklist snd_hda_codec_generic
blacklist snd_seq_device
blacklist snd_util_mem
blacklist snd_ac97_codec
blacklist ac97_bus
blacklist snd_hwdep
blacklist snd_pcm
blacklist snd_ice1724
blacklist snd_ak4113
blacklist snd_ak4114
blacklist snd_pt2258
blacklist snd_i2c
blacklist snd_ice17xx_ak4xxx
blacklist snd_ak4xxx_adda

This list blocks modules for audigy 2zs and esi juli@ and for nvidia hdmi and for hd mainboard codec.

Plus i would like to add that you may detect which alsa modules you need for midi input via usb-to-midi adapter like roland UM-ONE the following way: as a root user unload all alsa module from RAM by the command rmmod, for example:
rmmod snd_pcm
Alsa modules start from snd_
Issue the command:

Code: Select all


to see which modules are loaded.
You need to find the sequence to remove all those modules because they depend on each other. it's like a logical game. Just find the right sequence by making attempts. After unloading all snd_modules you need to load only one alsa module to enable midi support via usb (roland um-one or similar), issue:

Code: Select all

# modprobe snd_usb_audio

This command will automatically load all other modules needed to provide operation of snd_usb_audio module. For me those modules are:

Code: Select all



Now edit /usr/sbin/soundon

Code: Select all

# leafpad /usr/sbin/soundon

Replace the following:

Code: Select all

if test -d /proc/asound || grep -q '^ *14 ' < /proc/devices
   if ! sh $OSSLIBDIR/scripts/remove_drv.sh>> $LOG
      echo Failed to disable conflicting sound drivers >> $LOG
      echo Failed to disable conflicting sound drivers
      echo Reboot and try running soundon again
      echo Also check that you have not compiled sound support statically
      echo into the kernel.
      exit 50


Code: Select all

if test -d /proc/asound || grep -q '^ *14 ' < /proc/devices
#   if ! sh $OSSLIBDIR/scripts/remove_drv.sh>> $LOG
#   then
#      echo Failed to disable conflicting sound drivers >> $LOG
#      echo Failed to disable conflicting sound drivers
#      echo Reboot and try running soundon again
#      echo
#      echo Also check that you have not compiled sound support statically
#      echo into the kernel.
#      exit 50
#   fi
   lsmod | grep snd

Also put before exit 0 the following line:

Code: Select all

snd_usb_audio && modprobe snd_seq_device && modprobe snd_seq_midi

The good news is that i can use now carla and linuxsampler with jackd1+oss and they do not crash or zombify! One guy opened me the secret to avoid zombification: you SHOULD SET TIMEOUT in QJACKCTL TO 1000 or MORE!
But DON'T LOAD zynsubfx or yoshimi into carla! It will zombify carla! I am using the latest release of carla, self-compiled, of course with VST support! And now I CAN USE VST and KONTAKT with oss+jackd1. Perhaps wine improved or smth. Wine MUST BE RUN in windows XP MODE. Only kontakt 5.0.3 works well.
Beware that you SHOULD COMPILE|INSTALL Carla and other software prior to OSS installation and prior to jackd1 installation, because that software may require jackd2 libs and jackdbus to build normally. You replace jackd2 by jackd1 after OSS installation.
YOU MUST UNINSTALL CADENCE (if you have it) and replace it by qjackctl after oss installation because instance of jackdbus for jackd2 won't work with jackd1 and cadence can't configure jackd1. Also you MUST edit the file


the proper way, otherwise jackd1 won't start from qjackctl.
My settings are as follows:

Code: Select all


In ossxmix you should activate vmix and production quality for the cards that don't have hw resampler. Esi juli@ has such a resampler and you should disable VMIX for it. Without vmix with bad soundcards your jackd may behave the way you don't like like awful distortions due to resampling mismatch, etc. It can still fail to work... Also remember you MUST NOT RUN ANY audioplayers or other audio programs configured to use the same card which u are using with jackd now. Because jackd locks card for its own use. You may install a second card to run other audio programs simultaneously.

Why do i recpmmend using gentu vs debian|ubuntu? It's because compiling on debian|ubuntu is pain because you will have to search for the right libs all the time. But on gen2 those libs are installed automatically INSTEAD OF BINARIES. Actually you get libs + source code. Now gen2 uses c++ compiler which is quite fast on a multi-core hardware.
OSS is not dead! What disappoints is the mutual undesire of the so called programers to continue its support. People should have a choice. I find OSS to have clearer highs and mids. And sound is kind of harder, more musculine while on alsa it's more blurred. To make your music sound strong and warrior-like you won't want to use alsa. Though we must admit that alsa has drivers for newer expensive cards. Those drivers are missing on oss, for example rme and other stuff. Then alsa is the only way to go ... I don't know if you can overcome blurring by using spdif on alsa. I would stick to old good cards like juli@ or m-audio or lynx2 + OSS.
One more insteresing phenomenon about jackd1. I have dual-cpu sockets mainboard with two cpus consequently and jackd1 uses all the cores on my setup! Though it's claimed that jackd1 supports only one core. Perhaps it can't use more than 25% power of PC. This should be still checked. So far i have not load more than that but i get even less xruns now than with jackd2 and alsa!



AFTER OSS INSTALLATION YOU ARE TO RECOMPILE WINE to be able to chose OSS driver in winecfg.

Add overlay:

Code: Select all

layman -a proaudio

Edit /etc/portage/package.use/package.use to include the line:

Code: Select all

=media-sound/jack-audio-connection-kit-0.121.3-r2::proaudio  alsa celt dbus examples oss pam  -cpudetection -debug -doc -ieee1394 abi_x86_32 -libsamplerate

DON'T FORGET TO SET GCC TO version 4 before compiling jackd1!
If you have configured make.conf to use flags other than -O2, modify make.conf to have -O2 before jackd1 installation and disable different boosters like graphite and lto if you also have enabled them.

Code: Select all

eix jack-audio-connection-kit

Which jackd1 version should you choose? The only one providing dbus support is jack-audio-connection-kit-0.121.3-r2 But we have found that it causes failure to some applicatoins to start due to "undefined symbol: JACK_METADATA_PRETTY_NAME" error.
The cause of this error is that your jackd applications have been compiled using the newer jackd1 libs than those provided by jack-audio-connection-kit-0.121.3-r2. But if i install jack-audio-connection-kit-0.124.1 i get segmentation error at launching it whichever version of GCC I use. The only wayout I know is to send that dbus feature to hell and install last version of jackd1. Set GCC to v.4 if not set. Add to /etc/portage/package.use/package.use the line (if your operating system is multilib):
>=media-sound/jack-audio-connection-kit-1.9999 abi_x86_32


Code: Select all

CXXFLAGS="-O2 -pipe" CFLAGS="${CXXFLAGS}" emerge -av =jack-audio-connection-kit-1.9999

You should not install jack-audio-connection-kit-0.121.3-r2 because that version though it provides dbus support causes problems. For arch os get at least 0.124.1.

You start jackd (when VMIX is ON) by command /usr/bin/jackd -Xalsa_midi -v -P80 -t1000 -m -doss -r48000 -p1024 -n2 -w16 -C/dev/dsp -P/dev/dsp This, namely Xalsa_midi key will provide that midi IOs will be visible in all programs.

If you disabled VMIX in ossxmix and osscore.conf file then you may start jackd1 for esi juli@ by

Code: Select all

jackd -Xalsa_midi -P80 -t1000 -m -v -doss -r44100 -C/dev/null -P/dev/dsp -i0 -o2 -p512 -n2 -w32
for lower or worse cards:

Code: Select all

jackd -t1000 -m -v -doss -r44100 -C/dev/null -P/dev/dsp -i0 -o2 -p1024 -n2 -w16

If you get a segmentation fault error while starting jackd it does not necessarily mean that jackd1 was badly compiled. It can mean that -C or -P options have the wrong values. For example, with jackd1 v.1.9999 (on gentu) i get that erorr if i start jackd with -C/dev/null. But if i start with -C/dev/dsp_in jackd runs flawlessly.

Beware that option -Xalsa_midi may fail to work if you have installed the crappy version of jackd1. It will manifest itself the following way: in carla's patchage you connect midi out of your midi input device to midi in of some client loaded into carla but the connecting line does not appear or disappear at once (gets zombified). In this case install the last jackd1 version.

For jackd starting command the option -i0 means --inputs 0 , .i.e. number of inputs. You man want to use your audio inputs but their name will differ from /dev/dsp because /dev/dsp is for ouputs. To see names of your IOs issue the command:

Code: Select all

ossinfo -v9 | grep "/dev/oss"

It will show something like this:

Code: Select all

/dev/dsp -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_in -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_out -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_ac3 -> /dev/oss/oss_envy24ht0/spdout
  /dev/dsp_mmap -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_spdifout -> /dev/oss/oss_envy24ht0/spdout
  /dev/dsp_spdifin -> /dev/oss/oss_envy24ht0/spdin

It's not difficult to guess that /dev/dsp_in is the input device of your soundcards. The obtained name is to be used with -C option. Thus the jackd starting command can be modified to enable hw inputs like this:

Code: Select all

jackd -Xalsa_midi -P80 -t1000 -m -v -doss -r44100 -C/dev/dsp_in -P/dev/dsp -i2 -o2 -p512 -n2 -w32

For soundcards THAT SUPPORT 32-BIT MODE you SHOULD USE -w32 option instead of -w16 for starting jackd BECAUSE THIS HELPS TO AVOID CLIPPING AT PEAKS.

BEWARE THAT -P80 means that you have hacked your os to enable realtime priority. Issue

Code: Select all

ulimit -a

to see it. Read jackd manuals for info how to activate Realtime feature.

I recommend setting jackd1 and juli's hw resampler to 44100 and locking rate in ossxmix.
For listening to music use deadbeef with petrov's plugin in exclusive mode with 32bits.

To great surprise Carla plugin host remembers all jackd connections and can be used as a session manager!
Don't forget to save as preset in carla after you have configured carla's plugins and made all connetions between jackd clients.
And you can start as many programs as jack clients as u wish in an easy way by one long command:
(/usr/bin/jackd -Xalsa_midi -v -P80 -t1000 -m -doss -r48000 -p1024 -n2 -w16 -C/dev/dsp -P/dev/dsp &) ; (sleep 4) ; (linuxsampler --lscp-port 8888 &) ; (qtractor &) ; (sleep 5) ; (/usr/local/bin/carla /path/to/carxp.file &)
and so on...So all your clients start at once and carla restores connections between them.

Don't delete the backup folder with alsa modules. You may need them.

To restore alsa modules just copy the sound folder back and run the command: depmod
It will let the OS see the restored modules after which u can load the needed midi modules
modprobe snd_usb_audio

Just for more reliability paste into /etc/conf.d/modules

Code: Select all


And my thoughts concerning the high quality of OSS. I suspect that the reason may be that OSS provides louder output vs ALSA. It means that it treats the electrical circuit side of sound cards the other way. More power gives more clearer output. Do you know about Sound-to-noise ratio? The more power you give, the louder speakers are working, the less noise you have. In my opinion OSS gives kind of additional electrical power reserve to the audio chain while alsa just lacks electricity to provide strong and clear signal. I have read an article stating that you must have an amplifier with much more watts than speakers require to get better sound. That phenomenon exists but is still not explained. I think this thing is the cause of higher OSS quality. And how this phenomenon impacts the playback with OSS? You have higher amplitude range. If you press the midi keyboard's keys very strongly you may even get distortions due to overwhelming aplification.You can't expect this from alsa, at least to the same degree. It means that with OSS driver soundcard becomes kind of more sentisive and responsive providing that kind of drive when after low volume music you get a thrust of the loud part. And this very drive based on dynamic latutude is the second weak place of alsa. I am not against alsa or any other driver. I wish alsa team to fix those issues. But so far i will use OSS.
Qtractor works nicely on my setup. I recommend that program. Though it looks simple it has powerful features hidden in right click menus.
You can load linuxsampler or even carla inside tracks (carla has built-in linuxsampler) and have as many midi channels as you want. Then it's enough to load kontakt vst into carla with kontakt soundfont to get beautiful real-like instruments. Those free non-kontakt instruments are crap. Don't even try to use them. The only multilayer piano available as free piano is maestro concert grand but its sound is too soft. All the rest is not worse wasting your time. Stick to kontakt. This way you can get a high-quality production system. I recommend to backup your entire OS after you configure everything with OSS and disable all upgrades. Because it may come that new upgrades will render OSS unusable and you will be softly promoted to buy a damn expensive card like RME and etc.

OSS gives kind of a studio sound, as honest as possible. It beats kxdriver for windows, beats any other driver for windows. This OSS system was designed at the times when linux was just rising as a force against microsoft, apple and corporative power and corporations did not want simple users like we to have high-quality production systems for free. My opinion about present-day alsa is that its programers do not want to give us good sound at a cheap price. They hiddenly promote buying of expensive cards like RME because cheap cards sound like crap with alsa, half-pro cards like juli@ sound half-satisfactory due to blurring effect and lack of drive amplitude dynamism which i described above. Even the master volume slide on alsa behaves like a straght line / while OSS's mixer behaves like a algebraic progressive curve with the upper part more steep which is more close to nature because in nature we don't have straight line phenomenon with amplifiers. The straight line with alsamixer can mean that it does some leveling, some gain control to provide that even volume increase effect. But that may imply unwanted and unasked processing of sound. While OSS behaves exactly like real hardware amplifiers. By that reason you must be MORE CAUTIOUS with OSS not to burn your tweeters of your speakers! I already had smell of burning resin when striking midi keyboard's keys too strongly. You should configure your midi keyboard to some middle dynamic range to avoid any damage + you must be very cautious if you use software amlifiers in jackd chain. Switching between channels on midi keyboard tend to reset volume of channels of carla and linuxsampler to full! Then if you start playback you may get very load volume. You will get clipping sound which may burn speakers. That electrical energy abundance of OSS gives the feeling that music is powerful and alive. Also it influences quantity of details and highest resolution and richness to sound. You hear more harmonics.

I doubt that on debian|ubuntu you will be able to use oss + jackd1 + wine +carla so successfully as on gentu|funtu OS where you can easily change compiling options for GCC and for the package in question. Unless if you manually compile all those packages which is pain due to searching dependencies. Gentu|funto are hard to install for windows users. As a quick solution i propose installing on a separate hdd to avoid damaging windows or other OS you use and install sabayon which is a precompiled gentu. You may want to disable libsamplerate by USE="-libsamplerate -speex" globally in make.conf to get rid of those resamplers.

Currently there is no other way than OSS driver + linux for a musicians unless you are going to spend thousands of dollars on hardware. I bet u don't want it. With OSS i feel like there is nothing between me and sound while with alsa i feel like a third person, some cunning spoiler acting hiddenly is between us. By the way i have not tested FFADO driver. I know that many musicians prefer FFADO to ALSA. In the past only ffado supported firewire cards and it was a separate project. Nowadays ffado is part of alsa but musicians still prefer using old separate ffado... Perhaps there are reasons for it. But the thing is that there are no compiling options like USE="ffado". It means all those ffado users still have to install alsa to get connection to jackd. Perhaps they may use some ffado to jackd bridge if it exists. In any case it will be better to get a pci card like juli|maudio and use OSS. By the way intel hd codec on maiboards works fantastically with OSS.
Last edited by nuc on Sat Apr 09, 2016 11:48 am, edited 36 times in total.
Reason: added appropriate code tags

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest