OSS Driver Patch for Jackd2 on Ubuntu?

OSS specific Linux discussion (x86/amd64)

Moderators: hannu, dev, cesium

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Fri Jan 01, 2016 4:16 pm

THe patch seems to not work on 1.9.6 and 1.9.8 debian sources for jackd2. I get error:

patch: **** malformed patch at line 7: def configure(conf)

And by a strange coincidence version 1.9.7 is not available anywhere...

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Sat Jan 09, 2016 3:05 pm

Our neorobinhood audiohacking team (debianuser of freenode and ossuserr of this site) proudly present the procedure to hack jackd2 for activating oss support. The procedure involves the following:
1. Get source code of jackd2 1.9.10 for linux from jackaudio.org/downloads/
2. Unpack the source code and cd into the unpacked folder.
3. Make a file inside the folder called patch.patch and paste the following code inside that file:
diff -ur jack-1.9.10/linux/wscript jack-1.9.10.oss/linux/wscript
--- jack-1.9.10/linux/wscript 2014-07-18 12:28:13.000000000 +0000
+++ jack-1.9.10.oss/linux/wscript 2016-01-08 23:26:41.000000000 +0000
@@ -20,6 +20,8 @@
conf.check_cfg(package='eigen3', atleast_version='3.1.2', args='--cflags --libs', mandatory=False)
conf.env['BUILD_DRIVER_IIO'] += conf.is_defined('HAVE_EIGEN3')

+ conf.env['BUILD_DRIVER_OSS'] = True
+
def create_jack_driver_obj(bld, target, sources, uselib = None):
driver = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
@@ -74,6 +76,8 @@
'alsarawmidi/JackALSARawMidiUtil.cpp'
]

+ oss_driver_src = ['oss/JackOSSDriver.cpp', '../common/memops.c']
+
ffado_driver_src = ['firewire/JackFFADODriver.cpp',
'firewire/JackFFADOMidiInputPort.cpp',
'firewire/JackFFADOMidiOutputPort.cpp',
@@ -88,6 +92,9 @@
create_jack_driver_obj(bld, 'alsarawmidi', alsarawmidi_driver_src,
["ALSA"])

+ if bld.env['BUILD_DRIVER_OSS'] == True:
+ create_jack_driver_obj(bld, 'oss', oss_driver_src, "OSS")
+
if bld.env['BUILD_DRIVER_FREEBOB'] == True:
create_jack_driver_obj(bld, 'freebob', 'freebob/JackFreebobDriver.cpp', ["LIBFREEBOB"])

diff -ur jack-1.9.10/solaris/oss/JackBoomerDriver.cpp jack-1.9.10.oss/solaris/oss/JackBoomerDriver.cpp
--- jack-1.9.10/solaris/oss/JackBoomerDriver.cpp 2014-07-18 12:28:13.000000000 +0000
+++ jack-1.9.10.oss/solaris/oss/JackBoomerDriver.cpp 2016-01-08 23:27:31.000000000 +0000
@@ -30,7 +30,7 @@
#include "memops.h"

#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include "/usr/lib/oss/include/sys/soundcard.h"
#include <fcntl.h>
#include <iostream>
#include <assert.h>
diff -ur jack-1.9.10/solaris/oss/JackOSSAdapter.cpp jack-1.9.10.oss/solaris/oss/JackOSSAdapter.cpp
--- jack-1.9.10/solaris/oss/JackOSSAdapter.cpp 2014-07-18 12:28:13.000000000 +0000
+++ jack-1.9.10.oss/solaris/oss/JackOSSAdapter.cpp 2016-01-08 23:27:52.000000000 +0000
@@ -23,7 +23,7 @@
#include "memops.h"

#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include "/usr/lib/oss/include/sys/soundcard.h"
#include <fcntl.h>
#include <iostream>
#include <assert.h>
diff -ur jack-1.9.10/solaris/oss/JackOSSDriver.cpp jack-1.9.10.oss/solaris/oss/JackOSSDriver.cpp
--- jack-1.9.10/solaris/oss/JackOSSDriver.cpp 2014-07-18 12:28:13.000000000 +0000
+++ jack-1.9.10.oss/solaris/oss/JackOSSDriver.cpp 2016-01-08 23:28:11.000000000 +0000
@@ -30,7 +30,7 @@
#include "memops.h"

#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include "/usr/lib/oss/include/sys/soundcard.h"
#include <fcntl.h>
#include <iostream>
#include <assert.h>

Save the file.
4. Apply the patch by command:
patch -p1 < patch.patch
5. cd into linux folder within the source code folder and give the command:
ln -s ../solaris/oss
6. Return to the previous directory. And compile jackd2 USING GCC4 by the following commands:
./waf configure --portaudio --dbus --classic --alsa
./waf build
su -c './waf install'
7. Now the command:
ls /usr/lib64/jack/
should print the file jack_oss.so
If the name of that file is not printed, manually copy this precious file into the needed folder:
su -c 'cp build/linux/jack_oss.so /usr/lib64/jack/'

8. Now you can try to run jackd2 with oss support. Close all audio programs running. Activate vmix in ossxmix. Deactivate src and ratelock. Issue:
/usr/local/bin/jackd -S -v -doss -r48000 -C/dev/dsp -P/dev/dsp -p1024 -n2 -w16
(Don't try to run jackd2 with -w32 when vmix is enabled - you will get terrible hissing sound from the left speaker which can burn your tweeter!!!)

Set master volume in ossxmix to the low level. Start carla and load some soundfont. Press the wrench button in carla to see virtual keyboard. Press the keys on virtual keyboard. You will get sounds which confirms that jackd2 now works with oss.

You may try to run jackd2 with vmix disabled. Enable ratelock in this case in ossxmix. Set sampling rate to that of jackd2 in ossxmix (for juli@ soundcard). Close carla if it's running. Issue:

/usr/local/bin/jackd -S -v -doss -r48000 -P/dev/dsp -p512 -n3 -w32

Check if you have sound via carla the same way.

If you have any strange artifacts like slowering or speeding of playback with vmix disabled you may try to activate hw resampling on juli@ by checking src box.

Enjoy!

Our motto is EXPAND THE POTENTIAL EXPONENTIALLY!
Last edited by ossuserr on Sat Jan 09, 2016 10:33 pm, edited 1 time in total.

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

Re: OSS Driver Patch for Jackd2 on Ubuntu?

Postby igorzwx » Sat Jan 09, 2016 3:37 pm

Thanks for the patch!

ossuserr wrote:1. Get source code of jackd2 1.9.10 for linux from jackaudio.org/downloads/

Code: Select all

diff -ur jack-1.9.10/solaris/oss/JackOSSDriver.cpp jack-1.9.10.oss/solaris/oss/JackOSSDriver.cpp
--- jack-1.9.10/solaris/oss/JackOSSDriver.cpp   2014-07-18 12:28:13.000000000 +0000
+++ jack-1.9.10.oss/solaris/oss/JackOSSDriver.cpp   2016-01-08 23:28:11.000000000 +0000



Code: Select all

$ cat ./jack-1.9.10/solaris/oss/JackOSSDriver.cpp | grep -i cooked
        if (ioctl(fInFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
            jack_error("JackOSSDriver::OpenInput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
        if (ioctl(fOutFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
            jack_error("JackOSSDriver::OpenOutput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);


If jackd does not fail to set COOKEDMODE, your "music" might be converted into "digital crap" by the Fast resampler of OSS4
_http://manuals.opensound.com/developer/SNDCTL_DSP_COOKEDMODE.html

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Sat Jan 09, 2016 10:32 pm

The benefit of jackd1 over jackd2 is that you do not have to run a2jmidid -e to get midi input visible in patchage. And benefit II is that jackd1 with oss is bugless while with jackd2 you can get a terrible hissing noise with at least one setting.
Now i am running jackd2 with oss with the command:
/usr/local/bin/jackd -S -v -doss -r48000 -P/dev/dsp -e -p512 -n3 -w32
Pay attention to -e option. I guess it activates exclusive mode like that of ossplay -R.

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Sat Jan 09, 2016 11:39 pm

I have got to know that by design jackd2 can't have -X before -d. But -doss does not have -X option at all and jackd2 will refuse to start. So you can't activate alsa-sequencer for jackd2 by the command starting jackd2. You can only have midi input support via a2jmidid -e. To make it clear once and forever.

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

Re: OSS Driver Patch for Jackd2 on Ubuntu?

Postby igorzwx » Sun Jan 10, 2016 12:54 am

ossuserr wrote:you can get a terrible hissing noise


Such noise can be produced by OSS4 resamplers at downsampling
(e.g. 192kHz → 48kHz, or 96kHz → 48kHz). It depends on audio files.
See also: _https://wiki.archlinux.org/index.php/Open_Sound_System#Changing_the_Sample_Rate

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Sun Jan 10, 2016 11:52 am

This looks like more a bug of jackd2. Moreover 44100 or 48000 samples of kontakt in carla were tested. Also the bug demonstrates itself only with -w32 and only left speaker is producing the sound as if the signal became mono.

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

Re: OSS Driver Patch for Jackd2 on Ubuntu?

Postby igorzwx » Sun Jan 10, 2016 12:25 pm

ossuserr wrote:the bug demonstrates itself only with -w32 and only left speaker is producing the sound as if the signal became mono.


16bit + 16bit = 32bit + Noise

Oss Backend Parameters
-w, --wordlength int
Specify the sample size in bits. The default is 16.
_http://linux.die.net/man/1/jackd

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Sun Jan 10, 2016 1:09 pm

Better turn off vmix and use -w32. Jackd's internal format is 32float for cards that support 32-bit. I could not get 32bit mode with emu10k1 which is 16bit. But linuxmusicians recommended to use 32bit mode to have less clipping at peaks

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Mon Jan 11, 2016 8:15 pm

After upgrading operating system to some new packages and reverting back i can no longer use jackd2 for unknown reason. Perhaps something got broken.
For those who experience the same problem, i give the way to return to jackd1.
You should install version =jack-audio-connection-kit-0.121.3-r2 on gen2 because only this version has dbus and dbus can be needed for many things.
1. Switch gcc to 4.x.y version.
2. Go to folder jack-1.9.10/ from which u installed jackd2 and issue:
su -c './waf uninstall'
3. emerge -av =jack-audio-connection-kit-0.121.3-r2
4. If u have juli@ card, close ossxmix, switch off vmix in osscore, restart oss, launch ossxmix and switch off vmiz in ossxmix. Set sampling rate to 44100 and check ON ratelock and SRC in ossxmix.
5. Start jackd by: jackd -Xalsa_midi -P80 -t1000 -m -v -doss -r44100 -C/dev/null -P/dev/dsp -i0 -o2 -p512 -n2 -w32
If you don't have alsa modules installed and u have not edited ulimit for realtime support use the command and if you card does not support 32bit mode:
jackd -t1000 -m -v -doss -r44100 -C/dev/null -P/dev/dsp -i0 -o2 -p1024 -n2 -w16

You should have lines running like load = 0.1134 max usecs: 9.000, spare = 11600.000

6. If jackd does not start and segmentation fault is reported, try to unmerge, then change GCC version to something like 4.9.3 or lower and recompile jackd1 again.
If you get errors like

alsa.so: undefined symbol: fast_rand
Unknown driver "oss"

It means that you have not uninstalled jackd2 successfully. Try to uninstall it again and then recompile jackd1. Delete jack module manually also before recompiling jackd1:
rm -f /usr/lib64/jack/jack_oss.so

As you can see jackd2 support is still on expetimental phase and no one knows what makes it work or not work. Perhaps if you don't have testing libs and packets installed you have more chances to successfully build and use jackd2. I personally don't see any benefits in jackd2 because jackd1 is not dead and being developed. And jackd1 also supports dbus.

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Wed Jan 13, 2016 4:03 pm

If you get Segmentation fault error at starting jackd1 it sometimes means that -C or -P options are set incorrectly within jackd starting command. For example, i get such an error with -C/dev/null . Perhaps you may have the same error with jackd2. Try to change the launching command before uninstalling jackd2. jackd2 may start to work.
This assumption was wrong. I manaed to build jackd2 again. You should not use -C option with jackd2 at all!
I can't compile jackd with --mixed and --profile options. What does it mean? mixed provides both 32 and 64 bit libs. Without 32-libs some applications may crash like airware manager and this means you won't be able to use kontakt soundfonts.
Perhaps my last build is less successful to some uknown reasons because previously airwave manager worked like charm. So keep trying building jackd2.

ossuserr
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 Driver Patch for Jackd2 on Ubuntu?

Postby ossuserr » Wed Jan 13, 2016 9:24 pm

The new way to install jackd2 on gent0u is as follows:

layman -a proaudio
emerge --sync

In a text editor make changes.

leafpad /var/lib/layman/proaudio/media-sound/jack-audio-connection-kit/jack-audio-connection-kit-1.9.10.ebuild

Change

src_prepare() {
default
multilib_copy_sources
}


by

src_prepare() {
default
epatch "${FILESDIR}"/patch.patch
cd "${S}"/linux
ln -s ../solaris/oss
cd "${S}"
multilib_copy_sources
}

Put the jackd2 patch.patch file from the post _http://opensound.com/forum/viewtopic.php?f=3&t=5291&p=21457&sid=a5bbc190df882ae687c94b93afcc0c76#p21433 (also attached here) into the needed directory:

cp patch.patch /var/lib/layman/proaudio/media-sound/jack-audio-connection-kit/files/

Add the following lines to /etc/portage/package.use/package.use file:

=media-sound/jack-audio-connection-kit-1.9.10::proaudio abi_x86_32 -libsamplerate -dbus
>=media-libs/libsndfile-1.0.26 abi_x86_32 sqlite static-libs
>=media-libs/flac-1.3.1-r1 abi_x86_32 static-libs
>=media-libs/libvorbis-1.3.4 abi_x86_32 static-libs
>=media-libs/libogg-1.3.1 abi_x86_32 static-libs

Add the following line to /etc/portage/package.accept_keywords file:

=media-sound/jack-audio-connection-kit-1.9.10 ~amd64

Now:

cd /var/lib/layman/proaudio/media-sound/jack-audio-connection-kit
repoman manifest

And finally install jackd2 MULTILIB package! You can't install multilib manually from source from jackaudio.org.

emerge -av =jack-audio-connection-kit-1.9.10::proaudio

Now you can start jackd2 by the command:

/usr/bin/jackd -S -R -P80 -v -doss -r44100 -P/dev/dsp -p1024 -n2 -w32
or if the above command does not work, by
/usr/bin/jackd -S -v -doss -r44100 -P/dev/dsp -p1024 -n3 -w16
or if VMIX is ENABLED:
/usr/local/bin/jackd -S -v -doss -r44100 -C/dev/dsp -P/dev/dsp -p1024 -n2 -w16

Remember that if you update portage or layman (by the commands emerge --sync, layman -S, eix-sync) your custom-modified ebuild can be replaced by the ebuild from portage and you will have to repeat the entire above procedure to reinstall jackd2 1.9.10.
Attachments
patch.zip
(959 Bytes) Downloaded 257 times

tarik2cyprian
Member
Posts: 28
Joined: Thu Jan 24, 2013 7:04 pm

Re: OSS Driver Patch for Jackd2 on Ubuntu?

Postby tarik2cyprian » Fri May 06, 2016 12:09 am

Thank you ossuser so much for this newer version of the patch. I was trying to find a way to patch
the ossdriver for the newer versions of jackd2 but could never could get it to work; as a result I had
to stick the the ossdriver patch for the jackd2 version 1.9.7.

I am using currently using ubuntustudios 14.04 with realtime kernel and the sound quality is extraordinary.

My only question about this newer ossdriver patch I have is why is the DSP Load always on 100% when
starting jackd2?

When running jackd 1.9.7 I get lower DSP Loads (12%) when starting jackd2.


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 2 guests