<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Modartt user forum - Pianoteq headless as service]]></title>
		<link>https://forum.modartt.com/viewtopic.php?id=12232</link>
		<description><![CDATA[The most recent posts in Pianoteq headless as service.]]></description>
		<lastBuildDate>Wed, 26 Mar 2025 03:28:39 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Pianoteq headless as service]]></title>
			<link>https://forum.modartt.com/viewtopic.php?pid=1001647#p1001647</link>
			<description><![CDATA[<div class="quotebox"><cite>levinite wrote:</cite><blockquote><p>A setting of infinity sounds dangerous...there must be a better way!??</p></blockquote></div><p>I did not paid attention to the README file from the developers, my bad. In that file the suggestion is:<br /></p><div class="codebox"><pre><code>@audio - rtprio 90
@audio - nice -10
@audio - memlock 500000</code></pre></div><p>therefore I modified the service file as follows:<br /></p><div class="codebox"><pre><code>[Unit]
Description=Pianoteq headless

[Service]
Type=simple
User=pi
LimitRTPRIO=90
LimitNICE=-10
LimitMEMLOCK=500000
EnvironmentFile = /home/pi/Pianoteq\ 8\ STAGE/arm-64bit/preset
ExecStartPre=/usr/bin/sudo /usr/bin/cpufreq-set -g performance
ExecStart=/home/pi/&#039;Pianoteq 8 STAGE&#039;/arm-64bit/&#039;Pianoteq 8 STAGE&#039; --headless --multicore max  --preset $PS
ExecStopPost=/usr/bin/sudo /usr/bin/cpufreq-set -g ondemand

[Install]
WantedBy=multi-user.target</code></pre></div><p>Also <em>KillMode=process</em> is wrong here, removed. Looks better now <i class="far fa-smile smiley"></i></p>]]></description>
			<author><![CDATA[null@example.com (jimmi)]]></author>
			<pubDate>Wed, 26 Mar 2025 03:28:39 +0000</pubDate>
			<guid>https://forum.modartt.com/viewtopic.php?pid=1001647#p1001647</guid>
		</item>
		<item>
			<title><![CDATA[Re: Pianoteq headless as service]]></title>
			<link>https://forum.modartt.com/viewtopic.php?pid=1001646#p1001646</link>
			<description><![CDATA[<p>A setting of infinity sounds dangerous...there must be a better way!??</p><p>I notice the real-time scheduling error 1 when the audio privileges are not set and multiple core or at least when multi-core max is set in Pianoteq. I think what it means is Pianoteq requires rt privileged settings because internally it calls the OS to set its threads rt privilege levels.</p>]]></description>
			<author><![CDATA[null@example.com (levinite)]]></author>
			<pubDate>Tue, 25 Mar 2025 23:58:06 +0000</pubDate>
			<guid>https://forum.modartt.com/viewtopic.php?pid=1001646#p1001646</guid>
		</item>
		<item>
			<title><![CDATA[Pianoteq headless as service]]></title>
			<link>https://forum.modartt.com/viewtopic.php?pid=1001639#p1001639</link>
			<description><![CDATA[<p>I&#039;ve seen this approach proposed years ago in this forum. Recently I reviewed it with a slight different setup on my Raspberry Pi 5 headless, to be managed by buttons of an external Android app. I want to share it here to listen eventual comments or suggestions. The service file is the following:<br /><em>pianoteq.service</em><br /></p><div class="codebox"><pre><code>[Unit]
Description=Pianoteq headless

[Service]
Type=simple
User=pi
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
LimitRTTIME=infinity
EnvironmentFile = /home/pi/Pianoteq\ 8\ STAGE/arm-64bit/preset
ExecStartPre=/usr/bin/sudo /usr/bin/cpufreq-set -g performance
ExecStart=/home/pi/&#039;Pianoteq 8 STAGE&#039;/arm-64bit/&#039;Pianoteq 8 STAGE&#039; --headless --multicore max  --preset $PS
ExecStopPost=/usr/bin/sudo /usr/bin/cpufreq-set -g ondemand
KillMode=process

[Install]
WantedBy=multi-user.target</code></pre></div><p>I found that calling <em>cpufreq-set</em> only once without the option <em>-c</em> sets the governor to all the cores automatically.</p><p>When I first used this service I found several messages in the logs similar to these:<br /></p><div class="codebox"><pre><code>...
Midi thread could not acquire real-time scheduling, error 1 -- Operation not permitted
Alsa thread could not acquire real-time scheduling, error 1 -- Operation not permitted
Multi-core: could not acquire real-time scheduling, error 1 -- Operation not permitted
...</code></pre></div><p>Apparently it was not causing any problem, but digging in the web I found that the system does not complain anymore if I set the <em>LimitXXXXXX=infinity</em> as in my file. I learned that this is related to realtime scheduling, but I cannot understand the possible implications of it. Anyone knows if there coud be unwanted side effects?</p><p>In order to change the preset I then create a series of scripts similar to this:<br /></p><div class="codebox"><pre><code>#!/bin/bash

echo &quot;Starting Pianoteq headless:&quot; ; echo &quot;HB Steinway D Classical&quot;

# Overwrite the variable declaration in the preset file
echo &quot;PS=\&quot;HB\\ Steinway\\ D\\ Classical\&quot;&quot; &gt; /home/pi/Pianoteq\ 8\ STAGE/arm-64bit/preset

# Start Pianoteq headless service
sudo systemctl restart pianoteq</code></pre></div><p>and associate each script with a button so that I may change the instrument easily without accessing the graphic interface. What is your thought about this?</p>]]></description>
			<author><![CDATA[null@example.com (jimmi)]]></author>
			<pubDate>Tue, 25 Mar 2025 06:17:19 +0000</pubDate>
			<guid>https://forum.modartt.com/viewtopic.php?pid=1001639#p1001639</guid>
		</item>
	</channel>
</rss>
