Using RTC Clock versus Alsa HR timer

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
User avatar
Impostor
Established Member
Posts: 1382
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 145 times
Been thanked: 360 times

Using RTC Clock versus Alsa HR timer

Post by Impostor »

When running MusE sequencer from the terminal, I'm getting this output:

Code: Select all

-> 09:56:33.416 Init MIDI...
Trying RTC timer...
fatal error: open /dev/rtc failed: Permission denied
Trying ALSA timer...
AlsaTimer::initTimer(): best available ALSA timer: HR timer
got timer = 34
[......]
INFO: Requested timer frequency:1024 actual:1000

I tried to find some info online about any merits of this RTC timer w.r.t. the Alsa timer, but most info I could find on this issue is from more than 10 years ago.
I tried some instructions to make RTC available to MusE (mostly involving .conf files in various places), but no such luck. Also, its default clock speed seems to set to 64Hz, and refused to be set to any other frequency.

So, does anyone have some current information about using/setting RTC? Is it even worth the trouble?

asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Using RTC Clock versus Alsa HR timer

Post by asbak »

  • I'm not suggesting you make this change.
    I don't really know whether it's a good idea to implement it.
    Some will argue that nowadays it's not really necessary.
    In the past (years ago) there were perhaps some issues with certain applications and kernels.

Nevertheless, you asked how and here's how I set it on my system (Mint 21.1):
Note: The system default value for rtc0 may be set to 64, mine is set to 2048.

Code: Select all

cat /sys/class/rtc/rtc0/max_user_freq
echo 'KERNEL=="rtc0", GROUP="audio"' >> /etc/udev/rules.d/40-timer-permissions.rules
echo "class/rtc/rtc0/max_user_freq = 2048" >> /etc/sysfs.conf
chmod 660  /dev/rtc0
chgrp audio /dev/rtc0

reboot

Code: Select all

cat /sys/class/rtc/rtc0/max_user_freq

Should now hopefully display 2048

Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
User avatar
Impostor
Established Member
Posts: 1382
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 145 times
Been thanked: 360 times

Re: Using RTC Clock versus Alsa HR timer

Post by Impostor »

Nope..doesn't work either. After giving the commands you supplied I rebooted, checked the contents of the relevant files, and the properties of /dev/rtc0, which have indeed changed, but the RTC timer still is 64Hz, and MusE now complains that it cannot set the RTC timer, though it doesn't give the "fatal error" warning anymore.

asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Using RTC Clock versus Alsa HR timer

Post by asbak »

Have you got an "audio" group?
Is your local user a member of the audio group etc etc?

And perhaps your OS (what is it?) works somewhat differently?

Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
User avatar
Impostor
Established Member
Posts: 1382
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 145 times
Been thanked: 360 times

Re: Using RTC Clock versus Alsa HR timer

Post by Impostor »

asbak wrote: Sun Apr 02, 2023 5:24 pm

Have you got an "audio" group?
Is your local user a member of the audio group etc etc?

And perhaps your OS (what is it?) works somewhat differently?

Yes, I'm an audio group member. Linux Mint 20.2.

asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Using RTC Clock versus Alsa HR timer

Post by asbak »

Have you got sysfsutils installed?

If it wasn't installed it'll need to be installed, then the config file may need to be edited again because the installation will probably overwrite the previous one.

Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
User avatar
Impostor
Established Member
Posts: 1382
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 145 times
Been thanked: 360 times

Re: Using RTC Clock versus Alsa HR timer

Post by Impostor »

asbak wrote: Sun Apr 02, 2023 6:15 pm

Have you got sysfsutils installed?
If it wasn't installed it'll need to be installed, then the config file may need to be edited again because the installation will probably overwrite the previous one.

Thanks, that did the trick! Now on to the next question: What did I gain, or lose?
MusE now defaults to RTC instead of Alsa HR, but why?

asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Using RTC Clock versus Alsa HR timer

Post by asbak »

Hit up your friendly MusE programmer/s for the answers, then you can post them here for posterity. :)

Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
User avatar
Impostor
Established Member
Posts: 1382
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 145 times
Been thanked: 360 times

Re: Using RTC Clock versus Alsa HR timer

Post by Impostor »

@Posterity:

"Roughly it can be said that the higher resolution the better. [..] RTC Timer: This is the highest resolution timer that MusE can utilize. This is the one MusE first looks for, if it doesn’t work it falls back to the Alsa timer."

From the MusE wiki. Not too enlightening, but I guess it will have to do. Alsa timer uses the same hardware clock as RTC I presume.

Post Reply