Openframeworks with linux/jack

oh yes thanks. i never before used installed libs from my linux. nice way to do that.
now everything compiles good. but the ofsoundstream example quits with a segmentation fault

is this a known issue? any ideas?

jack outputs the folloeing after i start the of programm.

  
13:58:03.361 XRUN callback (3).  
subgraph starting at qjackctl timed out (subgraph_wait_fd=16, status = 0, state = Running, pollret = 0 revents = 0x0)  
bad status (1) for client RtApiJack handling event (type = 8)  
**** alsa_pcm: xrun of at least 1.142 msecs  

i tried to switch between different options in jack but nothing changed.
maybe this is a ubuntu 10.04 problem.

don’t know for sure, haven’t used jack that much, but it seems your getting buffer underruns, try using higher buffer sizes or setting real time priority.

Yes try as arturo suggested using higher buffer sizes. To run at real-time priority, follow the suggestions here:
https://help.ubuntu.com/community/Ubunt-…-035084534a
Look under ‘Configuring the real-time access for “audio” group users and applications’

hey together,

thanks for the infos. i needed some time to realize all the real time changes to my system.
but now it is done. i am in the audio group installed severel packes but still get this error

  
  
Segmentation fault  
Process returned 139 (0x8B) execution time:............a.s.o.  
  

i can run rtaudio or the stk examples without any problems.
i also tried to increase the buffer sice via ofSoundStreamSetup(…) but this also has no effects.
i dont know how to solve.

is that with the plain audioOutputExample? can you debug your application to see in what line is it crashing

it is the normal audioOutputExample, if jack isnt running i get no error but no sound. if jack runs i get the error. i am in holliday for a time now. when i am back i will try it with a fresh mind. thanks for your help.

i tried all stuff with a new unpacked of version on an other machine. but i got the same errors. i am not good in debugging. but if i uncomment ofSoundStramSetup i get no error but also no sound. du you guys work with codeblocks? where do you add the compiler command -D__UNIX_JACK__ ? i added it under settings - compiler and debugger settings - other settings - advanced options. i added it to the end of the variables.
i realized that it dont changes anything if i dont add the command. maybe i try the wrong command at the wrong place?

Can you upload your project and the library that you compiled with jack support so i can take a look

hey arturo sure i can,

here are the files:
http://www.m4307.de/audioOutputExample.tar.gz
http://www.m4307.de/rtAudio.tar.gz

i hope i only have a problem with the rtAudioLib file, maybe you can test mine to see if you get same errors. thanks a lot.

i’m trying this and i’m having the same error, i’ve recompiled the library since i’m in 64bits.

it seems the crash is inside jack, perhaps something related with rtaudio+jack, since i’m using other applications with jack and they work without problem.

don’t know what can be the problem, will post if i find something else

thanks a lot for testing. i will make a new try when im back in september.
thanks!

Hello all,

I’m new to coding in openFrameworks, though not new to programming in other compiled languages like Java, but this has got me completely stumped!

I’m having a very confusing time following this thread and trying to get this to work so I wonder if anyone could write a plain, step-by-step guide?

I’m trying to run the audioOutputExample through JACK.

Here’s what I’ve done so far…

  1. Install jack development files
    sudo apt-get install libjack-dev

  2. Download RtAudio and unpack to home directory (~/)

  3. cd into the unpacked dir and
    ./configure --with-jack
    make

  4. Copy compiled file to openFrameworks libs rtAudio and replace the current version

  5. In C::B add -D__UNIX_JACK__ to Project > Build Options > Compiler Settings > Other Options

  6. Add /usr/lib/libjack.a to the compiler linker

Currently getting “Segmentation fault” messages and xruns on JACK.

What am I missing?

Thanks
Andy

P.S. The example apps in the tests/ directory of rtAudio are working fine…

Ok, I just tested this and got it to work on OF 0.061. In my original post earlier in this thread I can’t honestly remember if I used rtAudio or PortAudio as the sound output, but I definitely had Jack running.

Just now I successfully tried with RtAudio + Jack.

Here are my steps:

  1. Download RtAudio 4.0.7 from http://www.music.mcgill.ca/~gary/rtaudio/index.html

  2. Configure the source distribution (you will need the relevant development packages and you may not want to include OSS but I did):

  
sudo apt-get install libjack-dev  

and then

  
./configure --with-jack --with-alsa --with-oss  

  1. Compile the library by typing “make”

  2. Copy the librtaudio.a file to /libs/rtAudio/lib/linux and rename it to libRtAudio.a
    Note that you may want to copy the original OF RtAudio libs and includes in case something goes wrong.

  3. Copy RtAudio.h and RtError.h to /libs/rtAudio/include and replace the files there.

  4. Open up the Codeblocks audioOutputExample and add the following to the “#define” tab in the Compiler Settings for the project:

  
__UNIX_JACK__  

  1. In the “Other linker options” section of the “Linker Settings” add the following:
  
-ljack -lpthread -lrt  

  1. I used the following parameters for the sound stream setup:
  
ofSoundStreamSetup(2,0,this,44100,256,4);  

  1. Compile the app, but do not run it YET! You need to start the Jack Server first

  2. Install Qjackctl if you don’t have it already, i.e.

  
sudo apt-get install qjackctl  

  1. Run qjackctl, click on the setup button, and make sure you have the Frames/Period setting to match the ofSoundStreamSetup(), i.e. 256 in this case. It may not hurt to check that the Sample Rate and Periods/Buffer match as well. However I found that a Frames/Period setting that was different than the ofSoundStreamSetup() would cause the app to crash/segfault on start up. Also make sure that the audio is set to Duplex or Playback if you want to output sound. Do no select the Realtime parameter unless your system is setup for realtime audio. See http://jackaudio.org/faq for more details about how to set this up.

  2. Once you have the settings correct, hit the start button on the main qjackctl panel to start the Jack audio server.

  3. Now run your OF Jack app (audioOutputExample in my case). You should hear sound output. Click on the Connections button of qjackctl and you should then see RtApiJack in the readable clients and System in the Writable clients, and they should be connected by graphical lines or “cables”.

  4. Voila! Any questions please ask, but note that I am running Ubuntu 10.04 on a 32-bit system, so any 64-bit problems I won’t be able to solve. I haven’t tested this on OSX either, but in theory it should also work.

@ rak_multi,

I tried your compiled lib and it works fine. Your project however was missing the right #define and linker settings.

I’ve uploaded the fixed codeblocks project file. If you still have problems, it may have to do with your Jack settings…see my post above for details.

audioOutputExample.cbp.zip

hey grimus,

sorry that my answer is over a half year to late :).
i missed your reply.

but now i tested it and it worked very well.
thank you verry much for the detailed explanation and uploading the project files.

you saved my day. now i can route my puredata output direcly to the audioin of openframeworks to do a fft on it. yeah…
really great.

This worked for me.

I downloaded rtAudio, configured with --with-jack, I copied librtaudio.a over the one in the openframeworks libs folder. and recompiled the openframeworks libraries with UNIX_JACK in compiler options.

Then I added UNIX_JACK to my projects compiler options. This gave errors, I added -ljack and they went away (this surprised me).

Anyway, now it works, I can receive jack audio in my application from ardour.

Tim

Hello!
Jack / Ubuntu 14.04 / openFrameworks 0.8.3 / codeblocks 13.12 …!
The subject has been discussed but I do not.
I compiled RTAudio … ok
but after having copied
what it is: recompiled with the openFrameworks libraries UNIX_JACK in compiler options and where do I add UNIX_JACK__ and -ljack -lpthread -lrt (is what it is in codeblock and where?)
I have little knowledge in the complilation . … and Jack would really be welcome!
I go through pulseaudio-plugin-jack and so far it’s not fantastic.
I’ve spent a lot of time to achieve but without results.

Actuelement is this error message: ofRtAudioSoundStream.cpp || undefined reference to "RTAudio :: openStream (RTAudio StreamParameters :: * :: RTAudio StreamParameters *, unsigned long … |

thank you
Bernard

Well it’s ok!
I went from a non-compiled version of OF
I compiled RTAudio-4.0.7 rather than the latest version (RtError.h deleted).
(Copy the files in the respective RTAudio files)
I compiled OF and works here by adding PLATFORM_PKG_CONFIG_LIBRARIES + = jack config.linux.common.mk like http://forum.openframeworks.cc/t/where-to-add-flags-for-compiling-make-files-linux / 15374/3
But now for video and audio files, cà does not work!
I open a topic about this!
Bernard