<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Modartt user forum - Pianoteq headless as service]]></title>
	<link rel="self" href="https://forum.modartt.com/extern.php?action=feed&amp;tid=12232&amp;type=atom"/>
	<updated>2025-03-26T03:28:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.modartt.com/viewtopic.php?id=12232</id>
		<entry>
			<title type="html"><![CDATA[Re: Pianoteq headless as service]]></title>
			<link rel="alternate" href="https://forum.modartt.com/viewtopic.php?pid=1001647#p1001647"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[jimmi]]></name>
				<uri>https://forum.modartt.com/profile.php?id=6809</uri>
			</author>
			<updated>2025-03-26T03:28:39Z</updated>
			<id>https://forum.modartt.com/viewtopic.php?pid=1001647#p1001647</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Pianoteq headless as service]]></title>
			<link rel="alternate" href="https://forum.modartt.com/viewtopic.php?pid=1001646#p1001646"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[levinite]]></name>
				<uri>https://forum.modartt.com/profile.php?id=7208</uri>
			</author>
			<updated>2025-03-25T23:58:06Z</updated>
			<id>https://forum.modartt.com/viewtopic.php?pid=1001646#p1001646</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Pianoteq headless as service]]></title>
			<link rel="alternate" href="https://forum.modartt.com/viewtopic.php?pid=1001639#p1001639"/>
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[jimmi]]></name>
				<uri>https://forum.modartt.com/profile.php?id=6809</uri>
			</author>
			<updated>2025-03-25T06:17:19Z</updated>
			<id>https://forum.modartt.com/viewtopic.php?pid=1001639#p1001639</id>
		</entry>
</feed>
