Topic: CPU overload by pianoteq linux

I am using the demo version of linux pianoteq 3.6.6. My OS is Ubuntu Studio 11.04. Kernel is generic but during instalation, realtime option was activated. My laptop is Lenovo G465; CPU is 2.4 Ghz AMD dual core; RAM is 4 GB. Keyboar Yamaha p80 connected to laptop through USB-midi interface Yamaha UX16.

Symptom. Exactly every minute, there is an xrun message reported by JACK; at that moment, a sharp piercing sound passes from the headphones to my brain, and is not only painful but disturbing. The message is like this one:
****alsa_pcm: xrun of at least 52.487 msec
JackPosixMutex::Unlock res = 1
11:31:36. 522 XRUN callback (75)

also continuously see messages like this one:

JackEngine::XRun: Client = Painoteq36 was not run: state = 1 [sometimes is 2]
Jackaudiodriver::ProcessGraph Async:Process error

Jack sends that information even in absence of activity from Pianoteq (idle), however, still I receive xruns messages happening every minute!! This is not right.

In addition, checking the resources use: Pianoteq and Jackd and jackctl are the ones that use most of the memory and CPU. Pianoteq uses a minimum of 10% CPU when idle, but can take more than 100% in some cases (pedal on and fast playing).

Please help me to troubleshooting. These are the setings of jackctl:
128 Frames/period; 48000 Sample rate; 2 periods/Buffer; 256 Port maximum; audio is playback only; latency is 5.33 msec.

By the way, I increased the priority of process pianoteq, jackctl and jackd to -11 (very high priority); pulseaudio was -11, so I decreased it to -4 (less priority); all other processes have 0 priority (normal). In pianoteq, both CPU cores are activated, and the laptop CPU use is put to "Performance" in both cores cpu0 and cpu1.

Please let me know what are your setings that decrease latency and eliminate xruns; is cpu overload that normal???? I remember past years when xorg was the hog in linux, now is pianoteq....

Re: CPU overload by pianoteq linux

Have you checked if there is a related message in /var/log/messages ?

I assume you are using the internal soundcard of your laptop. Do these xruns also happen when you select the ALSA output instead of JACK in pianoteq ?

Did you try to use Jack1 instead of Jack2 , does it make a difference ?

How is the curve in the pianoteq options / perf panel when these glitches occur ? is it smooth and low or is there a spike ? Is the reported CPU freq constant and equal to 2.4GHz ?

Re: CPU overload by pianoteq linux

I am also testing Ubuntu 11.04 right now. And I can tell you that it is currently worse for audio than Ubuntu 10.04 (both 64 bit):

There seems to be a bug in alsa or in the (generic) kernel that makes the sound chip "HDA Intel" (internal) unusable for low latency audio (maybe also your sound card) . I get xruns continuously (no matter if I use alsa or jack in Pianoteq). 10.04 (also generic kernel) does not have this problem.

The jack version provided by Ubuntu 11.04 has another problem: I am also using Kontakt 4 Player with Wine / Wineasio. But I get an error message from jack when I try to connect. I had to build jack from the source code available at jackaudio.org (also version 1.9.7, but the source code is different to Ubuntu) to overcome this problem. If you do not want to do this, you need to switch to Jack 1. You can do this simply with Synaptic.

I also found some other issues not concerning audio that let me stay with Ubuntu 10.04 at the moment. It is much more stable.

Why are you using low latency kernel? I think it is not needed anymore unless you have very special use case. And I often run audio applications with CPU setting "on demand" with the lowest possible CPU frequency without problems (Core 2 Duo).

Re: CPU overload by pianoteq linux

Thanks Julien, and moby.
No related log messages could find. Didnt try pianoteq with alsa only but moby did it as he mentions. He is blaming both the kernel with ubuntu studio version 11.04 and jack. I wonder why this jack version should have a problem? is that problem the same for pianoteq or only for Kontak4player? I have not tested the previous version of ubuntu studio (10.04) yet, but again, why it should be better than 11.04? I think the 10.04 version has no realtime kernel, like the 11.04. Am I correct? Anyways, given the number of replies i got, seems that very few people is using pianoteq with linux. That must say something. I am going to delay buying pianoteq indefinitely, since there are no garanties that it will work flawless. I dont want to upset anybody but, at least can I ask if pianoteq is working together with developers of a linux distro? I guess that is a bit delicate of an issue, it may not be easy.

Re: CPU overload by pianoteq linux

Hi,

the problems with Ubuntu 11.04 have nothing to do with Pianoteq. I think it is the sound card driver for HDA Intel. When I play back a MIDI file, I have to set the buffer size to 1024 samples in Pianoteq when I do not want to hear cracklings. It does not matter if use alsa, jack1 or jack2, I always get the same result, also with Kontakt 4 Player. With Ubuntu 10.04 it is possible with 128 or 256 samples depending on alsa, jack1 or jack2. When I try USB sound card Native Instruments Audio Kontrol 1, I achieve 64 samples with alsa or jack2.

I think jack2 in Ubuntu 11.04 is a modified Ubuntu version. It simply does not allow me using a Windows audio application like Kontakt 4 Player with Wine and Wineasio.

Also note that there is a realtime kernel in Ubuntu 10.04. Just install package linux-image-rt. I already tried it, but do not see any advantage.

Re: CPU overload by pianoteq linux

I'm running on Ubuntu 11.04 (ALSA) without any problems at all (I've been using Pianoteq for about two years.)  I use a Fast Track Pro as my audio/midi interface (USB), though my laptop's onboard Intel audio chip works fine.

That said, I have used it on three different Dell laptop models.  The oldest (D620) and newest (E6510) worked flawlessly.  However, for a short time in between the two, I did have problems running it on an E6400.  No matter what I did, I could not stop it from popping and crackling.  Jack/ALSA, increasing buffers, adjusting process priority, installing a realtime kernel -- nothing helped.

Other than that brief period, which I could only attribute to hardware issues, I've been very happy with how it runs under Linux.

I'm curious though, since you mentioned the pop happens exactly every minute.  Is it precisely when the clock rolls over from one minute to the next?

Re: CPU overload by pianoteq linux

Thanks moby and voltara. Ok, i have not yet given up to 11.04 studio, but I installed a preempted kernel from alessio's rep:
$uname -a
linux 2.6.38-8-lowlatency #42 (etc) PREEMPT...

still, it is not a realtime kernel.

However, I have now much better results: there are less xruns and less crackling significantly. BUT... like I said before (with the generic kernel and now the same with this new preempt kernel), every exactly one minute, I get the following message:

jackAudioDriver::ProcessGraphAsync: Process error
04:42:48.205 XRUN callback (7 skipped).
04:43:46.632 XRUN callback (16)
***alsa_pcm:xrun of at least 50.043 msecs
jackPosixMutex::Unlock res = 1
jackEngine::XRun: client = Pianoteq36 was not run: state = 1
jackAudioDriver::ProcessGraphAsync: Process error
04:43:48.271 XRUN callback (1 skipped)

at that exact moment, for an instant, pianoteq doesnot emit any sound, but I hear only a horrible crackling noise. This same event happens on the next minute:

04:44:46.588 XRUN callback (18)
04:44:48.311 XRUN callback (7 skipped)
***alsa_pcm:xrun of at least 47.859 msecs

Strangely, these messages repeat again and again every minute, and they happen whether I am playing or not with pianoteq.

What could be the problem? it seems that every minute, some other process (or it could be related to alsa, given the message "alsa_pcm??) gets complete preference and uses (I am guessing cause I have no proofs) the cpu and or memmory resources. Actually, I cannot see anything that gets into the way with top or with the system monitor.
I checked if anacron or cron had scheduled processes to start every minute, but none are. I hope you could help me to find what is the problem. Maybe you could share with me your settings for priority processes and so. Thanks for answering.

EDIT: Just to make clear: the messages come every minute even after I have closed pianoteq. hmmm.

Last edited by Maxei (17-05-2011 10:28)

Re: CPU overload by pianoteq linux

I have solved the xruns problem.

The solution was to switch the power off to the wireless network card. Now all xruns are gone.

Concerning cpu use by pianoteq, I can get up to 70% cpu max use, which is quite lower than before, so I'm happy with that too.

I hope this can be of help to anybody having xruns. Any generic kernel should be avoided, contrary to what many people suggest, that the generic kernels provide enough latency. Clearly, with the pianoteq/jack duo in "live" play mode, you need a realtime kernel or at least the lowlatency preempt kernel.

Thanks for your help.

Re: CPU overload by pianoteq linux

Maxei wrote:

Any generic kernel should be avoided, contrary to what many people suggest, that the generic kernels provide enough latency. Clearly, with the pianoteq/jack duo in "live" play mode, you need a realtime kernel or at least the low latency preempt kernel.

Glad to hear you solved your problem. I beg to differ with your statement that the generic kernel should be avoided. I am running a rather modest Dual core AMD 2.2G processor with 32bit generic Ubuntu 10.4 LTS using Alsa (no Jack). I have no latency issues whatsoever. Jack also works fine, but merely adds unnecessary complexity.

I tried 64bit rt kernel, but it did not play nicely with my nVidia driver, and there were several other very minor issues. I also tried the generic 64bit. The difference in performance was very slight. The 64bit issues have since been resolved (mostly Firefox), there is no reason for me not to use it, but no compelling reason to do a complete re-install either.

Re: CPU overload by pianoteq linux

Finally I found a solution for my problems with "HDA Intel" described above. Actually, "HDA Intel" is not a specific sound card, it is a standard defined by Intel. There are many different HDA Intel sound card models from different vendors, And sometimes ALSA is not able to detect the correct model.

Ubuntu 10.04 is obviously able to detect the right sound model integrated in my notebook. With Ubuntu 11.04 the detection does not work correctly anymore (only with my specific hardware, with other hardware it may still work well). In my case this leads to latency problems. I had to add the line

options snd-hda-intel model=auto position_fix=2

at the end of configuration file /etc/modprobe.d/alsa-base.conf to achieve low latencies. Note that this sound card option only works for me. Another HDA Intel sound card  probably needs another option. Here is some more information about HDA Intel sound card configuration under Ubuntu:

https://help.ubuntu.com/community/HdaIntelSoundHowto

Re: CPU overload by pianoteq linux

I am the current main developer of wineasio.  I was contacted by someone about running pianoteq in wine, and have been making some experiments.

Running pianoteq standalone with wine 1.3.20, wineasio 0.9.0 and jack1 0.120.2 at 128 samples buffer on my Intel Q6600 cpu, I get more or less identical results as running the native version, the caveat being that the multicore setting needs to be disabled. Playing the K1 Ambience patch I see similar cpu usage, though the load meter and the jack dsp load is slightly higher.  I get a performance index of 42 in wine, and 46 in linux.  I can easily play for hours with no xruns, hitting maybe 20-30 voices.  I can overload it by pressing the sustain pedal and banging wildly on the keyboard, happens somewhere over a 100 voices, but then again I can do the same in the native linux version.

So my conclusion is that Pianoteq runs very well in wine, as long as multicore is disabled.  I speculate that the problem arises from using windows primitives to synchronize the threads as they have to pass through a socket and the single threaded wineserver.

To any ubuntu/debian user having problems, I can only warmly recommend adding the kxstudio repos: http://kxstudio.sourceforge.net/mediawi.../Main_Page as they solve most problems that might otherwise plague you, and have one of the best working linux audio distros around.

There is also a bug in the wineasio 0.9.0 tarball that manifests with jack2, if you get the source code from the git repo: git://wineasio.git.sourceforge.net/gitroot/wineasio/wineasio that has now been taken care of.

And in closing a big thank you to Modartt for this marvelous sounding virtual instrument!

Re: CPU overload by pianoteq linux

An additional observation is that the same holds true for running pianoteq as a vsti in reaper/wine.  Best to disable the multicore support as otherwise it will very easily exceed the available latency and cause xruns.

Re: CPU overload by pianoteq linux

I thought I'd mention that I had been having some trouble with my sound output stopping for several notes at a time, though PianoTeq was seeing the keypresses OK.

That was fixed by turning off the option to detect CPU overload. PianoTeq now seems to work very smoothly. I now also switch off the WiFi.

Ubuntu Studio 11.04
Kernel 2.6.38 generic
Oldish AMD Turion 64 (single core) laptop with 1GB memory.