Linux, Renoise And Choppy Sound

Distro used Ubuntu (gnome)
Soundcard: my laptop has one of those onboard High Definition Audio soundcards. Even worse mine is made by SIS.

Problem: Sound getting interrupted (xruns)
Big villain: Window Manager
How I came to that conclusion: Installed KDE, XFCE, LXDE and tested renoise with “DemoSong - soon soon” and openned lots of programs, shaked windows, to see if interrupts ocurred.
Which one peformed best?: lxde because it uses openbox as window manager.
Which one peformed worst? Gnome because it uses compiz, or metacity if you disable desktop effects.
Metacity sucks too?: Yes it sucks big time.
What does the window mnager has to do with sound chopping?: it steals system resources, even worst for us with crappy soundcards.

Give it a try, simple steps:

Install lxde

apt-get install lxde

Logout from gnome, at the graphical login screen, select the user you want to login, type your password, but before you hit enter to login, check the botton of this screen, theres a menu to select the desktop environment. Select lxde and login. Run renoise, go to soundcard options in renoise and increase periods to 3. Play a heavy music and see if the sound goes ok.

Also try with jack.

You can also choose Gnome/openbox at the login screen. Gnome will be simplier, but faster.

I didn’t even had to set realtime options in pam.

FULL AND BORING HISTORY ABOVE

Dual boot system, linux sucks, Windows works perfectly.

So what I think? Maybe its the driver right? The Windows one is good, the linux one is crappy. Curious enough, I can even agressivly open lots of programs, shake the windows all at the same time and no sound interruption on Windows. If I even think of doing this on gnome I get a xrun.

Then, one day I try and install KDE which is known for beeing more resource hungry than gnome, I run renoise and it peforms waaaaaaaaaaaay better! I do that trick to increase the period to 3 and that’s it, perfect. No choppy sound with alsa. Try jack, same thing, perfect. Openning other programs and shaking windows gives me little xruns. But waaay less.

So, how is that possible, I asked to myself. it’s the same driver loaded, a heavier Desktop environment, and its all good.

Maybe QT is lighter than GTK.

To test if that’s true, I installed XFCE, which uses GTK and it’s lighter than both gnome and KDE. Result? CHOPPY SOUND! Messing with windows? HORRIBLE CHOPPY SOUNDS!

OMG, gtk is the villain? One last test.

Installed lxde, even lighter than xfce, uses gtk as well. results: PERFECT!

So, the module driver is the same, alsa, jack, renoise, all the same. GTK, QT doens’t matter. What else changed between these Desktop environment answer: THE WINDOW MANAGER.

Gnome uses metacity or compiz if you have desktop effects enabled. Both are horrible for peformance.
XFCE uses xfwm4 which is horrible as well.
KDE uses kwin which proved to peform better.
lxde uses openbox which is really fast.

For me, running openbox and setting 3 periods did the trick. I can now happly use renoise in linux.

very helpfull … cool !

There’s a new patch that really improves linux kernel peformance on desktop. Look what Linus Torvalds told about the patch:

Can’t wait for this to become default in every linux distro.

http://www.phoronix.com/scan.php?page=article&item=linux_2637_video&num=1

btw. I tried installing LXDE to a fresh Ubuntu 10.04 installation and it really is A LOT faster. Without LXDE it was almost impossible to playback a track in Renoise through JACK, but when I’m using the LXDE session i can run Renoise, PD, JACK and Patchage at the same time while browsing in web and getting no xruns :)

Thanks for these great tips!

My Ubuntu with gnome works perfect, but I tweaked it. RT kernel, pulse audio routed to Jack.
I can use Renoise+Reaper in wine+Massive vst in wine+Guitar Rig in wine+linux effects+Firefox, etc without any problems.

eeter, I’m glad this helped you!

Also, since you are using ubuntu, it’s most likely your user belongs to the ‘admin’ group. You can set pam limits options to increase the peformance even more. So you can lower the buffer and by this, decrease latency.

To know if you are part of the group ‘admin’ type this at the terminal (not as root):

groups  

You will see a list of groups you belong. If admin is there, you can set the pam options by doing this.

sudo gedit /etc/security/limits.conf  

and paste at the end of the file the following text

@admin - rtprio 99  
@admin - nice −10  
@admin - memlock unlimited  

Save, logout from desktop, log back in (or reboot to make sure) and try lowering the buffer in renoise (if using alsa) or jack. I got only 8 latency here using alsa in my crappy soundcard.

yeah. I already know these tricks, but they’ve never helped as much as changing the windowmanager.

Switched to the openbox too… Same results. Much much much much much much more stable renoise :o

Maybe the GNOME windowmanager somehow preempts for better responsiveness?

Have you used the admin group for this or have you used the audio group? For some reason, jack sets these to the audio group and, entering this group neve worked for me. I had to put the same config to the admin group.

Hehe, I just see this post and I agree - I`ve learned from AV Linux 3.1 to use LXDE and now on my Fedora 13 Planet CCRMA it is my choice, because LXDE is small, clear and useful. Just enough desktop environment.

I use PekWM that is really great and suits well after testing alot of the others. ^_^

try “yoshimi -a” then your really fucking laughing.

just wanted to add that, after reading a lot of stuff about JACK etc, i found out the ‘nice’ option is not needed here.
from the JACK FAQ (Step 1):

since i’ve been using (parts of) this thread as documentation for setting up Renoise audio, i thought it might be good to add some info about this common misconception. i’m no expert, just reading.

in the tutorials page, there is a Linux FAQ page which indeed states that setting periods to 3 highly increases performances with the infamous HDA soundcards. it was me discovering this solution before Renoise 2.0 was released and that’s why Renoise 2.0 allows Linux users to change the periods number when using ALSA.

In short: running Renoise with ALSA periods set to 3 allows for using Renoise with GNOME too

depends if you soundcard has a hardware mixer or not.

got a sblive audigy platinum ex here, full *bling bling * eye candy ubuntu , no problems here.

check my video if you like.

It has been discussed on many other distrolists.

  1. the user must not be of group “admin”, simply add a group “audio”

add to the limits.conf:

  
@audio - rtprio 95  
@audio - memlock unlimited  
  

The nice value is useless if the user is not root and brings no better performance.
Also have a look at /etc/rc.d/rc.local

  
echo 2048 >/sys/class/rtc/rtc0/max_user_freq  
echo 2048 >/proc/sys/dev/hpet/max-user-freq  
echo 0 > /proc/sys/vm/swappiness   
  

and because we want to use Jack or ALSA (I prefer ALSA only)
goto /etc/sysconfig/pulseaudio if pulseaudio is installed

  
PULSE_SERVER_TYPE=none   
  

This gives me on a Laptop a latency of ~6 ms and on my computer with an M-Audio Audiophile 2496 I have a latency of 1.3 ms with the songs from keith303 and all other demos.

You can use openbox as a window manager in GNOME, you know…

Which means better performance while staying in DE you know and perhaps like. LXDE is not as great as many of you wrote here. There is much to be done in LXDE to make it as comfortable in use as GNOME.

edit: AFAIK you can use openbox in xfce too.

is it all true? or is it another useless try with another downlod of an diffrent duistribution, just to see it is not working

Whatever you can use or configure to limit CPU use by other Linux features will improve Renoise performance.
Some even strip out the whole window manager features to only open Renoise when Linux boots up.

most linux distributions have “ondemand” cpu frequency scaling governor enabled by default, which could cause latency issues or choppy sound. you can test if this is the case by switching to “performance” governor which basically disables all frequency scaling and keeps your cpu at max hz.

you can check your current governor with: ```
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

  
if that returns "ondemand", or anything other than "performance", you could try swithing it by running: ```  
sudo echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  

this wont change it permanently, but it’ll revert back to ondemand on next reboot. (the “correct” way to set this permanently varies from distribution)

if that helped, but you still want to have cpufreq scaling, theres a few tunables you could try to improve performance with.