Topic: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

I’m not sure if folks realize this yet, but in my opinion, Pianoteq on Raspberry Pi has evolved from mere curiosity to game changer.

I now have Pianoteq running on a compact and silent keyboard form factor. It is a top-notch experience. Computers and wires are out of sight — it’s just me and my piano.

With a touch on my iPad, I instantaneously have a full-screen touch-responsive Pianoteq!

My experience on PianoWorld, including a screenshot:

Pianoteq 7 - Hands On

In short, Pianoteq 7 is running on the new Raspberry Pi 400 + PreSonus Studio 24c USB Audio interface:

Sample rate: 44100 Hz (I could try higher, but I don’t feel a need to go above CD-quality!)
Audio Buffer size: 64 samples (1.5 ms)
Maximum polyphony: 256

The system plays like a dream and I never have to think of it, except to marvel at how well it works.

While I could leave the Pi on permanently, even if I turn it off (the Pi 400 now has an on/off switch), the average time for Pianoteq to boot up cold and be 100% functional is an amazing 23 seconds -- and then it stays on.

I loosely followed Edgar's instructions at Pianoteq_RaspberryPi3_v3.pdf:

1. Used the higher clock speeds of the Pi 400, safely overclocked to 2100MHz.
2. Configured the Pi to default to headless (CLI only).
3. Configured the Pi to run Pianoteq full-screen without any Window Manager on a virtual desktop at boot + disabled VNC notifications.
3. On my iPad, configured my VNC client to connect to the Pianoteq virtual desktop at a touch.

It is the future. For the longest time I thought I wanted Pianoteq on iPad, but now I realize I don't -- this is much better because there's no need to connect/disconnect junk to the iPad or have it be tethered. Instead, I have a permanent Pianoteq-in-a-box installation which I can control beautifully with my iPad -- no wires involved.

Quirks? Very small nit -- I have to explicitly quit from Pianoteq for it to remember my current instrument selection. If I shut off with the Pi's on/off switch, Pianoteq forgets my current selection.

Thanks to Modartt for the investment in getting Pianoteq to run on the Raspberry Pi! It speaks a lot to the talent of the engineers behind this. Bravo!

Instructions:

Here's a great write-up from Yacob who had no prior experience with the Raspberry Pi and re-created the Pianoteq-in-a-box experience with the Yamaha AvantGrand N3X and MOTU M2:

Installing Pianoteq on Raspberry Pi 400: my experience

Yacob is also able to select Pianoteq presets straight from the piano keyboard via MIDI!

Last edited by navindra (13-12-2020 20:30)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

navindra, say it's so cool to you again here.
Maybe you can write a guide or walkthrough for other interested friends to follow.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Awesome, thanks for sharing. Could you please share the performance info, like performance index and a screenshot of Audio load? How is it close to potentially creating crackle sounds?

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

wook wrote:

Awesome, thanks for sharing. Could you please share the performance info, like performance index and a screenshot of Audio load? How is it close to potentially creating crackle sounds?

Performance index is 20 -- what does that mean?

Unlike my MBP, I'm unable to cause crackles on the Raspberry Pi 400 + PreSonus combo.

I tested this previously: Since the new NY Steinway D Classical Recording seems to be relatively CPU intensive, I keep the sustain pedal depressed, then glissando up the white keys. If I recall correctly, CPU goes up to 67% or so and the graph looks spiky, but no performance issues perceived on this artificial test.

I will retest and post screenshots when I get a chance.

Update: I tried the above test again but faster and I *do* get crackles and they correspond loosely with the spikes. I could also briefly drive CPU into the 90s by doing this. Still, this is a pretty artificial test and pushes things to the limit... I don't perceive any issues during actual playing. Also, no problem doing this with the Steingraeber E-272. NY SDCR is as intensive as it gets, I think. I may consider bumping down polyphony and/or overclock if issues show up in the practice.

robinlb: Thanks! Edgar's guide does need to be brought up to date, but that is a project in itself. Happy to answer any questions related to my installation here.

Last edited by navindra (17-11-2020 08:54)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

This might seem like a really stupid question, I'm a windows user and not great with Linux, but I can't find an executable for pianoteq 7. I remember having this issue when I set up the raspberry pi about 6 months ago and resorted to using an older version of 6 which did have an executable because I couldn't find one for the newest version 6.

It just asks me which program I want to use to open it, it doesn't seem to recognise or treat it as an executable. Tearing my hair out here and I don't have much left as it is, any help would be greatly appreciated.

Thanks!

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Jimbo2031 wrote:

This might seem like a really stupid question, I'm a windows user and not great with Linux, but I can't find an executable for pianoteq 7. I remember having this issue when I set up the raspberry pi about 6 months ago and resorted to using an older version of 6 which did have an executable because I couldn't find one for the newest version 6.

It just asks me which program I want to use to open it, it doesn't seem to recognise or treat it as an executable. Tearing my hair out here and I don't have much left as it is, any help would be greatly appreciated.

Thanks!

Change to the pianoteq directory ( arm-32bit folder), open a terminal (F4) and type ./P* or ./"Pianoteq 7".

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Ah ha! That's got it. Thanks very much. Now, I think I can get it to auto run by simply changing everything I programmed before to point to 7 instead of 6.

A quick note to anyone attempting to do this, the arm folder is now called arm-32bit which i have discovered requires quotation marks to successfully point to the right directory. This might be obvious but messed me right up for a while.

Change to the pianoteq directory ( arm-32bit folder), open a terminal (F4) and type ./P* or ./"Pianoteq 7".

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Jimbo2031 wrote:

Ah ha! That's got it. Thanks very much. Now, I think I can get it to auto run by simply changing everything I programmed before to point to 7 instead of 6.

A quick note to anyone attempting to do this, the arm folder is now called arm-32bit which i have discovered requires quotation marks to successfully point to the right directory. This might be obvious but messed me right up for a while.

Change to the pianoteq directory ( arm-32bit folder), open a terminal (F4) and type ./P* or ./"Pianoteq 7".

I also dislike having a space in the folder name and in the binary. It's unnecessarily aggravating.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

I worked last night on replicating this setup. Here's where I'm at so far:

  • I tried to launch Pianoteq in vncserver with the PI running without a window manager, but I haven't been able to get it to work yet. Part of the problem is making sure all the dependencies are installed. (fonts, gtk, etc.)

  • I installed all the window manager stuff on the raspberry pi and was able to get Pianoteq running. It isn't saving audio settings between launches for some reason. I also haven't been able to get vncserver to launch it directly yet.

  • Buffer size with the built in headphone jack output had to be quite large to avoid crackling. I tried with a cheap USB sound card and got much better results. (The cheap card has a lot of noise though, so I'll have to get something better.)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

AnotherBrian wrote:

I worked last night on replicating this setup. Here's where I'm at so far:

  • I tried to launch Pianoteq in vncserver with the PI running without a window manager, but I haven't been able to get it to work yet. Part of the problem is making sure all the dependencies are installed. (fonts, gtk, etc.)

  • I installed all the window manager stuff on the raspberry pi and was able to get Pianoteq running. It isn't saving audio settings between launches for some reason. I also haven't been able to get vncserver to launch it directly yet.

  • Buffer size with the built in headphone jack output had to be quite large to avoid crackling. I tried with a cheap USB sound card and got much better results. (The cheap card has a lot of noise though, so I'll have to get something better.)

Which Pi do you have?

FYI, I installed the complete and latest Raspberry Pi OS with desktop (which was recommended), not Lite or anything like that. Only afterwards, I configured it to boot to CLI by default, but all desktop components remain available.

This is my crontab which launches Pianoteq automatically at boot -- use "crontab -e" to edit yours:

pi@pianoteq:~ $ crontab -l
@reboot /usr/bin/vncserver :10

The thing to note here is that I'm launching a virtual desktop on display :10, so you need to connect to it on the correct port -- in my case I connect to pianoteq:10 or pianoteq:5910 depending on the client.

These are my VNC startup settings:

pi@pianoteq:~ $ cat .vnc/xstartup
#!/bin/sh

# switch on display number for special sessions
[ "$DISPLAY" = ":10" ] && exec ~/scripts/Pianoteq7.sh

exec /etc/vnc/xstartup

The important thing here is that I only launch Pianoteq for display :10 but otherwise I launch the full desktop.

I also changed the VNC authentication method at some point. I also disabled VNC notifications so that they don't pop in front.

Finally, this is my Pianoteq 7 launch script:

pi@pianoteq:~ $ cat ~/scripts/Pianoteq7.sh
#!/bin/bash

sudo cpufreq-set -c 0 -g performance
sudo cpufreq-set -c 1 -g performance
sudo cpufreq-set -c 2 -g performance
sudo cpufreq-set -c 3 -g performance

/home/pi/Pianoteq7/arm-32bit/'Pianoteq 7' --multicore max --fullscreen

sudo cpufreq-set -c 0 -g ondemand
sudo cpufreq-set -c 1 -g ondemand
sudo cpufreq-set -c 2 -g ondemand
sudo cpufreq-set -c 3 -g ondemand

Note here that I'm launching Pianoteq with --fullscreen.

Adapt the scripts to match your settings -- you may have a space in your Pianoteq 7 installation directory.

To get proper performance, you need to follow all of Modartt's recommendations in README_LINUX.txt (or Edgar's guide).

Please let me know if there's any information missing to replicate my setup -- it should be perfectly reproducible. Good luck!

Last edited by navindra (21-11-2020 00:34)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

AnotherBrian wrote:

I worked last night on replicating this setup. Here's where I'm at so far:

[*]Buffer size with the built in headphone jack output had to be quite large to avoid crackling. I tried with a cheap USB sound card and got much better results. (The cheap card has a lot of noise though, so I'll have to get something better.)[/*]

Sound from the built-in analog output jack is poor, anyway. To get good sound you need to use a usb audio interface or one of the many different audio Pi Hats.  FWIW, I use the $30 Hifiberry DAC+ Standard Pi Hat which gives good sound and low latency:  https://www.pishop.us/product/hifiberry...a-version/

Last edited by hesitz (21-11-2020 07:19)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

navindra wrote:

I also changed the VNC authentication method at some point.

Hello navindra,

very interesting things you are doing there with the VNCserver on the new Raspberry Pi 400!!

I did something similar with x11vnc on a Celeron a few years ago in this forum, but I had to share the full desktop. I like your new approach of forwarding just the single Pianoteq application with a vncserver from CLI. Very lean!

Today I've got my Pi 400 and now I am at the point, where I can start the vncserver from CLI, as you described:

/usr/bin/vncserver :10

I can connect to the server with my xtightvncviewer, but get a famous problem:

vncviewer 192.168.200.2:10
Connected to RFB server, using protocol version 3.3
No configured security type is supported by 3.3 VNC Viewer

The raspberry pi is using the non-free RealVNC server and I remember the authentication has to be changed from unix to classical vnc password login to make it work with a free vncviewer.

On the fully started raspi desktop this authentication method could easily be changed in the RealVNC-server widget options.

But how to change this option without having this full desktop widget of RealVNC at hand? (being just on CLI)

Cheers

PS: Using the RealVNC viewer from an Android smartphone Pianoteq appears, so your script works in general. But how to reactivate the standard vnc password login for non-proprietary vnc viewers?

Last edited by groovy (22-11-2020 00:35)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

groovy wrote:

On the fully started raspi desktop this authentication method could easily be changed in the RealVNC widget options.

But how to change this option without having this full desktop widget of RealVNC at hand? (being just on CLI)

Awesome! Great to hear the success you've had so far as well as your experience in the past. You're almost there. Simply SSH to the pi, then from the pi command prompt type:

vncserver

Now a new virtual desktop will be started and it will launch the full graphical desktop. It will tell you which desktop it launched on -- typically it will be :1 -- so now you can connect to :1 or :5901 depending on your client and you will be able to configure RealVNC exactly as you desire (or see the instructions in the earlier link I provided).

That should work. You can quit the desktop or run this command to kill it:

vncserver -kill :1

I had no micro-HDMI to HDMI adapter when I first got my Pi, so I did the installation completely headless. Now I have a converter and if I wanted to, I could hook it up to the TV, run "sudo raspi-config" and bring it back to desktop mode -- or just run "startx" from the command line.

Last edited by navindra (22-11-2020 01:15)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Thank you, navindra,
it is your work, that is awesome!

navindra wrote:

You're almost there. Simply SSH to the pi, then from the pi command prompt type:

vncserver

Now a new virtual desktop will be started and it will launch the full graphical desktop. It will tell you which desktop it launched on -- typically it will be :1 -- so now you can connect to :1 or :5901 depending on your client and you will be able to configure RealVNC exactly as you desire (or see the instructions in the earlier link I provided).

Yes, the full Raspberry desktop starts then. Nice option, thank you for the hint!
But this is where the cat bites its tail. I can't connect to the desktop for the same reason as above - per default it is using the wrong auth method for my vncviewer. My workaround now has been to connect to the desktop once with the vncviewer of my android smartphone and to change the crucial option Authentication from unix to "VNC password". This was quite uncomfortably on that little touchscreen, but it worked. The new chosen password is automatically saved persistently somewhere inside RealVNC on the Raspi. Afterwards I could connect with xtightvncviewer to the Raspi, yay!

navindra wrote:

That should work. You can quit the desktop or run this command to kill it:

vncserver -kill :1

Yep, works.

I had no micro-HDMI to HDMI adapter when I first got my Pi, so I did the installation completely headless. Now I have a converter and if I wanted to, I could hook it up to the TV, run "sudo raspi-config" and bring it back to desktop mode -- or just run "startx" from the command line.

Headless installation, wow! I hooked my Pi 400 to my TV for the initial settings, because the default distro that shipped with the kit seemed to have no DHCP-client and SSH-server active.

A small problem is my Laptop display, which has only 1366x768 pixel (16:9). When I forward Pianoteq with --fullscreen, the vnc view does not fit on my desktop. Very useful seems to be PTQ's "compact interface". When I additionally switch off the virtual keyboard, the compact view fits perfectly (fotos before/after).

My general feasibility study has been successful now, with your generous help.

In the next days/weeks the optimization and performance tuning of my Pi has to be done (new SD card with a fresh Raspberry OS, the cpufreq-utils stuff etc.).

Pianoteq rulez, cheers!

https://i.postimg.cc/cLNJ17bd/fullscreen-interface-ptq7-xtightvncviewer.png
https://i.postimg.cc/MZNTNJ0M/compact-interface-ptq7-xtightvncviewer.png

Last edited by groovy (22-11-2020 14:49)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

groovy wrote:

Yes, the full Raspberry desktop starts then. Nice option, thank you for the hint!
But this is where the cat bites its tail. I can't connect to the desktop for the same reason as above - per default it is using the wrong auth method for my vncviewer. My workaround now has been to connect to the desktop once with the vncviewer of my android smartphone and to change the crucial option Authentication from unix to "VNC password". This was quite uncomfortably on that little touchscreen, but it worked. The new chosen password is automatically saved persistently somewhere inside RealVNC on the Raspi. Afterwards I could connect with xtightvncviewer to the Raspi, yay!

Cool! FYI, you can configure all this from the command-line, which is how I did it myself:

https://www.raspberrypi.org/documentati...ccess/vnc/ -- section is "Authenticating to VNC Server".

Headless installation, wow! I hooked my Pi 400 to my TV for the initial settings, because the default distro that shipped with the kit seemed to have no DHCP-client and SSH-server active.

I didn't have a Raspberry Pi OS image but I used the wizard on a desktop computer to create a brand new one. It was impressively easy.

To enable SSH, all I had to do was create an empty "ssh" file in the root of the micro SD card. DHCP worked out of the box.

A small problem is my Laptop display, which has only 1366x768 pixel (16:9). When I forward Pianoteq with --fullscreen, the vnc view does not fit on my desktop. Very useful seems to be PTQ's "compact interface". When I additionally switch off the virtual keyboard, the compact view fits perfectly (fotos before/after).

Awesome! I'm fairly certain you would be able to scale down the full interface to make it fit as well. The client on my iPad can resize the view, for example... works in both landscape and portrait mode.

The top menu can be dismissed as well to get some extra space.

My general feasibility study has been successful now, with your generous help.

Congrats, looks awesome! Great you got this working!

May I ask which audio interface or sound card you used?

Last edited by navindra (22-11-2020 20:40)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Any opinion on using M-Audio Air Hub with Raspberry Pi 4 for dedicated Pianoteq use case? It looks like a perfect audio interface with huge volume knob and separate headphone output and no inputs.

https://m-audio.com/air-hub

I see only Windows drivers on the website does it mean it does not need any for Linux? I have tried my NI Komplete Audio 2 and it works perfectly.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

I could not stop today, until I've got my first tones from the Berry :-).
So I can ask your last question first. I connected one USB-Port of the PI400 with my Korg B2, which has a combined USB-MIDI/AUDIO interface onboard. It has a fixed samplerate of 24-bit/48kHz.

My first smoketest was the blues demo with the demanding NY Steinway. A good and rockstable compromise seems to be 48000 Hz with 32000 Hz internal samplerate and 96 samples buffersize. Pianoteq's Performance index is 20 (foto). Chord detection and virtual-keyboard disabled.

Some of my tweaks so far ...

/etc/security/limits.d/audio.conf

@audio   -  rtprio     95
@audio   -  memlock    unlimited
@audio   -  nice      -19

(this file was placed by the installed packet jackd, I just had to uncomment the nice-factor)

... and the other ARM tips from the  README_LINUX.txt (v7.0.3).

To play this setup realtime, I set the Korg local-off and turn its internal speakers up. At the moment this is just a proof-of-concept. My main system is an Intel N4200 with Focusrite 2i2gen2, two Fostex satellites incl. subwoofer. Would be interesting to see how the N4200 (Perfindex 36) performs, when paired just with a vncserver and without a full desktop environment.

There are again a lot of great tips in your last post, thank you navindra! Some of it I knew and forgot over time, like the SSH activation with the SD. But the Auth change from CLI was new to me, very useful!

What is that "wizard" you mentioned? an image-builder? Sounds ideal for a one trick pony PC.

Btw I found a little quirk when using display number :10. When I want to start my PTQ environment on the Pi400 manually from a remote Laptop, I have to ensure it has no "ForwardX11 yes" enabled in the ssh-client. This opens per default a DISPLAY :10 at login and vncserver can't start its own :10 then. But those things can easily be sorted out.

A few things for my todo list eventually:
Timer frequency for tighter response? (1000 Hz, 250 Hz, else on ARM?)
RT-kernel? Selfcompiled kernel? Alternative for RealVNC? Jackd?

https://i.postimg.cc/ryBjG6r1/PI400on-B2.jpg
https://i.postimg.cc/xTLRtsvW/pianoteq-pi400-performance.png

Last edited by groovy (22-11-2020 22:40)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

I have nothing concrete to add (with apologies) - but to say, watching along here has been inspiring - determination and admirable ingenuity! Props and just wow! The Pi looks sweet!

Pianoteq Studio Bundle (Pro plus all instruments)  - Kawai MP11 digital piano - Yamaha HS8 monitors

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Looks wonderful! I tried a self-compiled RT-kernel when I first setup my Pi 4 but didn’t see any noticeable difference in performance, presumably because milliseconds is hardly real-time (usually measured in microseconds). Timer frequency might be more promising as the Pi default is apparently only 100Hz.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Qexl wrote:

I have nothing concrete to add (with apologies) - but to say, watching along here has been inspiring - determination and admirable ingenuity! Props and just wow! The Pi looks sweet!

Indeed! I'm really glad Modartt invested in this and Edgar created his guide.

groovy wrote:

I could not stop today, until I've got my first tones from the Berry :-).
So I can ask your last question first. I connected one USB-Port of the PI400 with my Korg B2, which has a combined USB-MIDI/AUDIO interface onboard. It has a fixed samplerate of 24-bit/48kHz.

Oh wow, that's awesome! That all-in-one USB interface is really cool. The higher-end Yamahas are coming with that as well.

What is that "wizard" you mentioned? an image-builder? Sounds ideal for a one trick pony PC.

Yes, Raspberry Pi Imager: https://www.raspberrypi.org/software/

Thanks a lot for reminding me of compact mode. It's a magnificient improvement with no real downside.

Courtesy of Piano World:

http://forum.pianoworld.com//gallery/42/full/13921.jpeg

http://forum.pianoworld.com//gallery/42/full/13922.jpeg

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

navindra wrote:

Yes, Raspberry Pi Imager: https://www.raspberrypi.org/software/

Ah, thanks! Yesterday I found https://github.com/RPi-Distro/pi-gen and thought that has been meant.

It generates Raspberry Pi OS images and I tried to generate a base desktop system (Stage 3) but it built the lite system image (Stage 2). Maybe my config line has been wrong, don't know:

...
STAGE_LIST='stage0 stage1 stage2 stage3'
...

But that's another story. -

Nice foto updates!

I imagine a Pianoteq release in the future, that has a vncserver compiled in!
Like kvm, a popular Linux virtual machine host, that can start VMs headless as vnc-service.

Last edited by groovy (24-11-2020 19:18)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

This is all extremely impressive Navindra, and kudos to you for sharing your setup for others.

I can't help but think, however, that this just proves the point of how great an iPad OS native version of Pianoteq could be...

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

tfort wrote:

This is all extremely impressive Navindra, and kudos to you for sharing your setup for others.

I can't help but think, however, that this just proves the point of how great an iPad OS native version of Pianoteq could be...

This I have to agree with. I bet  Modartt will sell a ton when released for the iPad OS.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Hi,

I boiled down a few things on my PI 400:

* Installation of Raspberry Pi OS lite (no preinstalled desktop environment).
* Kernel compiled with 1000 Hz timer (default was 100 Hz).
* tigervnc-standalone-server instead of realvnc-vnc-server.

During the development I'm starting the VNC server on the Pi by hand as user pi:

$ vncserver

Per default this command looks for my /home/pi/.vnc/vnc.conf ...

$geometry = "800x600";
$localhost = "no";
$SecurityTypes = "VncAuth"

... and starts a VNC service for my pianoteq script in /home/pi/.vnc/Xvnc-session:

#!/bin/sh
/home/pi/pianoteq7.sh
vncserver -kill $DISPLAY

The script pianoteq7.sh finally invokes the Pianoteq binary:

#!/bin/sh
sudo cpufreq-set -g performance
/home/pi/Pianoteq\ 7/arm-32bit/Pianoteq\ 7 --multicore max --fullscreen
sudo cpufreq-set -g ondemand

From this moment on Pianoteq can be used/played headless.

If I want to see the GUI of Pianoteq to select presets or change settings, I have to use a vncviewer on a tablet, PC/notebook or smartphone. I tested successfully:

* tigervnc-viewer
* xtightvncviewer
* realvnc-vnc-viewer

Invocation is always the same:

vncviewer <IP of the PI>:1

When Pianoteq is quit as usual, the governor is reset from "performance" to "ondemand" and the running vncserver on display :1 is killed again.

As in the beginning a new VNC session can be started by entering the command vncserver again. FIN.

Because I'm using an USB-audiointerface, I switched off Pi's internal sound support in /boot/config.txt:

dtparam=audio=off

One example VNC session with a tablet (foto):

https://i.postimg.cc/sg2R0m1y/sams-ptqpi2.jpg

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

These are really awesome refinements!

groovy wrote:

* Installation of Raspberry Pi OS lite (no preinstalled desktop environment).
* Kernel compiled with 1000 Hz timer (default was 100 Hz).
* tigervnc-standalone-server instead of realvnc-vnc-server.
* dtparam=audio=off

Did any of these result in noticeable improvement?

#!/bin/sh
/home/pi/pianoteq7.sh
vncserver -kill $DISPLAY

Why is the last line needed? When Pianoteq quits and the script completes, X and vncserver should self-exit.

https://i.postimg.cc/sg2R0m1y/sams-ptqpi2.jpg

Very nice! Thanks for sharing the improvements!

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

navindra wrote:

.......
3. On my iPad, configured my VNC client to connect to the Pianoteq virtual desktop at a touch.
.......

Please, what about connecting between Ipad and Raspberry? is it Bluetooth, Wifi,... ???
Many thanks.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Thank you, navindra!

groovy wrote:

* Installation of Raspberry Pi OS lite (no preinstalled desktop environment).
* Kernel compiled with 1000 Hz timer (default was 100 Hz).
* tigervnc-standalone-server instead of realvnc-vnc-server.
* dtparam=audio=off

Did any of these result in noticeable improvement?

The alsa audio/midi driver is using the faster clock timer now:

$ cat /proc/asound/timers 
G0: system timer : 1000.000us (10000000 ticks)
P1-0-0: PCM playback 1-0-0 : SLAVE
P1-0-1: PCM capture 1-0-1 : SLAVE

A cyle is 1 ms now (1000.000us) and has been 10 ms with the standard kernel. System should react snappier for the cost of CPU power. It seems to be so after short live playing, but I can say more when I have recompiled the kernel for direct comparison with the default 100 Hz timer (leasts 45 min on the Pi400).

The system processes are reduced now to:

$ pstree
systemd─┬─Xtigervnc───8*[{Xtigervnc}]
        ├─agetty
        ├─alsactl
        ├─cron
        ├─dbus-daemon
        ├─dhcpcd
        ├─rngd───3*[{rngd}]
        ├─rsyslogd───3*[{rsyslogd}]
        ├─sshd───sshd───sshd───bash───pstree
        ├─systemd───(sd-pam)
        ├─systemd-journal
        ├─systemd-logind
        ├─systemd-timesyn───{systemd-timesyn}
        ├─systemd-udevd
        ├─thd
        ├─vncserver───Xvnc-session───pianoteq7.sh───Pianoteq───9*[{Pianoteq}]
        └─2*[wpa_supplicant]

(after "apt-get remove pi-bluetooth avahi-daemon")

Why is the last line needed? When Pianoteq quits and the script completes, X and vncserver should self-exit.

Pianoteq just disconnects as client from the virtual display in this environment. The vncserver keeps running so I have to kill it after quit from the pianoteq binary.

The performance index represented by the top blue line seems to be slightly lower yet, not constantly 20, sometimes fluctuating to 18...20 (Blues demo v7.0.4 std NY Steinway D Prelude again). Other small changes: Went back to Modartt's recommended ...

@audio - rtprio 90
@audio - nice -10
@audio - memlock 500000

... and stopped listening to the MIDI Through Port-0 (just need the MIDI from the Korg B2).

The real performance is probably better, when the performance grapher window is closed, because it sends continuously data via the Wifi VNC connection.

I had not a single crackle so far playing my stuff (being just a short snapshot of course).

https://i.postimg.cc/Cxr4vq42/ptqpi2-raspian-lite.png

Last edited by groovy (27-11-2020 11:28)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

groovy wrote:

Thank you, navindra!

groovy wrote:

* Installation of Raspberry Pi OS lite (no preinstalled desktop environment).
* Kernel compiled with 1000 Hz timer (default was 100 Hz).
* tigervnc-standalone-server instead of realvnc-vnc-server.
* dtparam=audio=off

Did any of these result in noticeable improvement?

The alsa audio/midi driver is using the faster clock timer now:

$ cat /proc/asound/timers 
G0: system timer : 1000.000us (10000000 ticks)
P1-0-0: PCM playback 1-0-0 : SLAVE
P1-0-1: PCM capture 1-0-1 : SLAVE

A cyle is 1 ms now (1000.000us) and has been 10 ms with the standard kernel. System should react snappier for the cost of CPU power. It seems to be so after short live playing, but I can say more when I have recompiled the kernel for direct comparison with the default 100 Hz timer (leasts 45 min on the Pi400).

The system processes are reduced now to:

$ pstree
systemd─┬─Xtigervnc───8*[{Xtigervnc}]
        ├─agetty
        ├─alsactl
        ├─cron
        ├─dbus-daemon
        ├─dhcpcd
        ├─rngd───3*[{rngd}]
        ├─rsyslogd───3*[{rsyslogd}]
        ├─sshd───sshd───sshd───bash───pstree
        ├─systemd───(sd-pam)
        ├─systemd-journal
        ├─systemd-logind
        ├─systemd-timesyn───{systemd-timesyn}
        ├─systemd-udevd
        ├─thd
        ├─vncserver───Xvnc-session───pianoteq7.sh───Pianoteq───9*[{Pianoteq}]
        └─2*[wpa_supplicant]

(after "apt-get remove pi-bluetooth avahi-daemon")

Why is the last line needed? When Pianoteq quits and the script completes, X and vncserver should self-exit.

Pianoteq just disconnects as client from the virtual display in this environment. The vncserver keeps running so I have to kill it after quit from the pianoteq binary.

The performance index represented by the top blue line seems to be slightly lower yet, not constantly 20, sometimes fluctuating to 18...20 (Blues demo v7.0.4 std NY Steinway D Prelude again). Other small changes: Went back to Modartt's recommended ...

@audio - rtprio 90
@audio - nice -10
@audio - memlock 500000

... and stopped listening to the MIDI Through Port-0 (just need the MIDI from the Korg B2).

The real performance is probably better, when the performance grapher window is closed, because it sends continuously data via the Wifi VNC connection.

I had not a single crackle so far playing my stuff (being just a short snapshot of course).

https://i.postimg.cc/Cxr4vq42/ptqpi2-raspian-lite.png


I don't see why increasing the timer should be better for dropouts (clicks). It will reduce the rate of Pianoteq's processing since context switching will occur more often. The reduction in Pianoteq's performance index seems to indicate a reduced performance.
I find a good test is playback of selected midi files which can quickly empty the buffer and clearly shows increases in cpu usage when this occurs. The best way to see this is using the max buffer size and 256 polyphony when playing back the midi file. Then monitor the cpu usage. It becomes clear that dropouts occur when the cpus cannot handle the load in real time because the buffer is too small.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

levinite wrote:

I don't see why increasing the timer should be better for dropouts (clicks).

Who said that?
Of course it is more CPU intensive to use a faster system clocking (1000 Hz), I wrote "for the cost of CPU power". Maybe you have overseen it in your full quote

The idea is higher precision, faster response, less jitter for that price. Maybe the forum thread Linux clocksources/timers is of interest.

Last edited by groovy (27-11-2020 16:13)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

alains29 wrote:

Please, what about connecting between Ipad and Raspberry? is it Bluetooth, Wifi,... ???
Many thanks.

Yes, it is over Wi-Fi. Both my iPad and Pi are connected to the same network.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

For comparison I recompiled a 100Hz-kernel on the same sources I previously used for the 1000Hz-kernel.

I gave both kernels a different name so I can reboot them alternatively by changing my entry in /boot/config.txt:

kernel=kernel7l-my1000Hzconfig.img
#kernel=kernel7l-my100Hzconfig.img

The result is stunning. I predict you would never play a 100Hz system once you tried the one with 1000Hz! Precise, quick responding keys!

With 100Hz there is a randomness / jitter in the response, the brain can't adapt to. It feels, as if the piano "resists" somehow.

As a result with 1000Hz it feels more like being connected to a real instrument. Musically and technically more inspiring, fascinating.

Cheers

Some details for the record:

cat /proc/version 
Linux version 5.4.79-v7l-1000Hz+ (pi@ptqpi2) (gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)) #1 SMP Wed Nov 25 10:15:46 CET 2020
cat /proc/asound/timers 
G0: system timer : 1000.000us (10000000 ticks)

cat /proc/version
Linux version 5.4.79-v7l-100Hz+ (pi@ptqpi2) (gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)) #2 SMP Fri Nov 27 21:05:36 CET 2020
cat /proc/asound/timers 
G0: system timer : 10000.000us (10000000 ticks)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

That's a interesting result.
Are there any specific staps that need to be taken? I recall compiling a 1000Hz kernel for my odroid-xu4, but either the compilation failed or the kernel wouldn't boot.



groovy wrote:

For comparison I recompiled a 100Hz-kernel on the same sources I previously used for the 1000Hz-kernel.

I gave both kernels a different name so I can reboot them alternatively by changing my entry in /boot/config.txt:

kernel=kernel7l-my1000Hzconfig.img
#kernel=kernel7l-my100Hzconfig.img

The result is stunning. I predict you would never play a 100Hz system once you tried the one with 1000Hz! Precise, quick responding keys!

With 100Hz there is a randomness / jitter in the response, the brain can't adapt to. It feels, as if the piano "resists" somehow.

As a result with 1000Hz it feels more like being connected to a real instrument. Musically and technically more inspiring, fascinating.

Cheers

Some details for the record:

cat /proc/version 
Linux version 5.4.79-v7l-1000Hz+ (pi@ptqpi2) (gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)) #1 SMP Wed Nov 25 10:15:46 CET 2020
cat /proc/asound/timers 
G0: system timer : 1000.000us (10000000 ticks)

cat /proc/version
Linux version 5.4.79-v7l-100Hz+ (pi@ptqpi2) (gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)) #2 SMP Fri Nov 27 21:05:36 CET 2020
cat /proc/asound/timers 
G0: system timer : 10000.000us (10000000 ticks)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

MrRoland wrote:

That's a interesting result.
Are there any specific staps that need to be taken? I recall compiling a 1000Hz kernel for my odroid-xu4, but either the compilation failed or the kernel wouldn't boot.

No, I just followed https://www.raspberrypi.org/documentati...uilding.md
and changed the kernel feature "Timer frequency" via make menuconfig:

https://i.postimg.cc/x8CLvTsN/kernel-timer-frequency.png

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

groovy wrote:

For comparison I recompiled a 100Hz-kernel on the same sources I previously used for the 1000Hz-kernel.

I gave both kernels a different name so I can reboot them alternatively by changing my entry in /boot/config.txt:

kernel=kernel7l-my1000Hzconfig.img
#kernel=kernel7l-my100Hzconfig.img

The result is stunning. I predict you would never play a 100Hz system once you tried the one with 1000Hz! Precise, quick responding keys!

With 100Hz there is a randomness / jitter in the response, the brain can't adapt to. It feels, as if the piano "resists" somehow.

As a result with 1000Hz it feels more like being connected to a real instrument. Musically and technically more inspiring, fascinating.

Cheers

Some details for the record:

cat /proc/version 
Linux version 5.4.79-v7l-1000Hz+ (pi@ptqpi2) (gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)) #1 SMP Wed Nov 25 10:15:46 CET 2020
cat /proc/asound/timers 
G0: system timer : 1000.000us (10000000 ticks)

cat /proc/version
Linux version 5.4.79-v7l-100Hz+ (pi@ptqpi2) (gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)) #2 SMP Fri Nov 27 21:05:36 CET 2020
cat /proc/asound/timers 
G0: system timer : 10000.000us (10000000 ticks)

The standard timer on my PI4 system is 4000uS already. Perhaps it will not be as dramatic a difference but I am willing to try. Would you post the image so we might be able to try it without having to compiile. BTW, how long did it take to compile?

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Based on this https://passthroughpo.st/config_hz-how-...ffect-kvm/ it seemed like 250Hz would be a good value to try from the 100Hz default.

pi@pianoteq:~ $ uname -a
Linux pianoteq 5.4.79-v7l+ #1 SMP Sat Nov 28 23:34:16 PST 2020 armv7l GNU/Linux
pi@pianoteq:~ $ cat /proc/asound/timers 
G0: system timer : 4000.000us (10000000 ticks)

However, so far I can't tell the slightest difference between the 2 kernels. I'm not sure this change is worth it.

Last edited by navindra (29-11-2020 11:12)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

If you hear no difference between 100 Hz and 250 Hz, the change is not worth it in my opinion.

In the past I heard and felt a difference between Debian's default 250 Hz and 1000 Hz on 64-bit intel.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

I tried 1000Hz as well and I think the performance characteristics are definitely very different -- but unfortunately I suspect the change is for the worse in informal stress tests. I'm not 100% certain. I'll have to record and run the same MIDI file against both to know.

I will park here for a while and compare the two. I'll probably default to my 250Hz kernel since it's newer than the original one.

pi@pianoteq:~ $ cat /proc/version
Linux version 5.4.79-v7l+ (ubuntu@diligent-newt) (gcc version 10.2.0 (Ubuntu 10.2.0-8ubuntu1)) #2 SMP Sun Nov 29 01:38:40 PST 2020
pi@pianoteq:~ $ cat /proc/asound/timers
G0: system timer : 1000.000us (10000000 ticks)

Summary: In my informal tests, I can't really perceive a difference between 100Hz and 250Hz, but I believe there is noticeable negative performance impact on CPU usage with 1000Hz in stress tests -- more spikes. I will stick to 250Hz, but if one is currently happy with 100Hz, I don't believe there is a need to change this setting.

Last edited by navindra (29-11-2020 19:08)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Great that you tried!

A few percent performance can be won by changing the timer to periodic (no dynticks) in the kernel. It ticks constantly then and not dynamically. It smoothened the lines in the performance index grapher a bit.

On the other hand it is more stress for the system I guess, so I discarded this change yesterday, because I get no real benefit. The only kernel customization is 1000 Hz at the moment and I have no spikes.

PS: Btw, the audiointerface has an impact on the performance index. You could change it temporarily to control this factor (don't forget to reboot afterwards, USB-interfaces are "sticky" sometimes).

Last edited by groovy (29-11-2020 11:48)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

OK, you got me exited to give the 1000Hz kernel another try
It is compiling while I'm typing.
Would be great if things work out this time.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

MrRoland wrote:

OK, you got me exited to give the 1000Hz kernel another try
It is compiling while I'm typing.
Would be great if things work out this time.

I hope I didn't give the wrong impression but the results I got with the 1000Hz kernel were not good.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Yeah, I know, but I needed to try myself
So I managed to compile the kernel and everyting boots fine
/proc/Asound/timer shows that 1000Hz is used.
Playing with Pianoteq feels a little more responsive, but the performance index is decreased 1 point.
The output load graph also shows it's closer to being maxed out.
Ah, well, I'm just gone try it for a while and revert everything if I don't like it.

Last edited by MrRoland (29-11-2020 19:26)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

For science, I overclocked the Raspberry Pi 400 to 2100MHz instead of the default 1800MHz. This is something that the Raspberry Pi Foundation have strongly hinted is perfectly fine because the heat spreader works so well.

It's a nice little bump -- my Performance index is now locked in at 23 instead of 20. I wasn't complaining before, but the improvement on the stress tests is definitely noticeable and it's free!

Instructions -- simply add this to /boot/config.txt and reboot:

over_voltage=6
arm_freq=2100

Courtesy of Piano World:

http://forum.pianoworld.com//gallery/42/full/13954.png

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Somehow I thought 1800 MHz would be the limit, thanks for that idea!

Under my test-conditions the higher PerfIndex (23) decreases the audio-load a bit, but it is not really necessary (screenshot before/after):

https://i.postimg.cc/SQVJ0mW8/pi400-1000-Hz-1800-MHz.pnghttps://i.postimg.cc/PrxNT047/pi400-1000-Hz-2100-MHz.png

Although I used your entries ...

over_voltage=6
arm_freq=2100

... my Pi400 decides to use 2200 MHz instead of 2100 MHz. Probably some turbo mode ongoing.

Good to know some more headroom is available.

Late EDIT: Hz->MHz

Last edited by groovy (01-12-2020 07:53)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Mine also started doing the 2200MHz thing. I'm not sure why -- it is functioning very well.

pi@pianoteq:~ $ lscpu
Architecture:        armv7l
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               3
Model name:          Cortex-A72
Stepping:            r0p3
CPU max MHz:         2200.0000
CPU min MHz:         600.0000
BogoMIPS:            396.00
Flags:               half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32

pi@pianoteq:~ $ vcgencmd measure_temp
temp=30.0'C
Last edited by navindra (01-12-2020 03:32)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

Just discovered, that 'Multicore rendering: MAX' is selectable in the GUI of Pianoteq v7.0.4.
The CLI option '--multicore max' seems to be not necessary any longer on arm-32bit.

Last edited by groovy (02-12-2020 08:12)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

groovy wrote:

The system processes are reduced now to:

$ pstree
systemd─┬─Xtigervnc───8*[{Xtigervnc}]
        ├─agetty
        ├─alsactl
        ├─cron
        ├─dbus-daemon
        ├─dhcpcd
        ├─rngd───3*[{rngd}]
        ├─rsyslogd───3*[{rsyslogd}]
        ├─sshd───sshd───sshd───bash───pstree
        ├─systemd───(sd-pam)
        ├─systemd-journal
        ├─systemd-logind
        ├─systemd-timesyn───{systemd-timesyn}
        ├─systemd-udevd
        ├─thd
        ├─vncserver───Xvnc-session───pianoteq7.sh───Pianoteq───9*[{Pianoteq}]
        └─2*[wpa_supplicant]

With your optimizations, how long does it take from the moment you press the on switch for you to have a piano sound?

As a reference, mine (with no optimizations) takes an average of 40 seconds from the moment I press the on-switch to being fully operational.

Last edited by navindra (03-12-2020 07:27)

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

navindra wrote:

With your optimizations, how long does it take from the moment you press the on switch for you to have a piano sound?

Hello,
it takes 25 seconds (using your autostart via crontab).

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

groovy wrote:
navindra wrote:

With your optimizations, how long does it take from the moment you press the on switch for you to have a piano sound?

Hello,
it takes 25 seconds (using your autostart via crontab).

Very nice!

The native sound engine on my piano takes about 8 seconds to boot but loading the sound settings and time for interface to actually be functional is around 20 seconds.

So this is very good.

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

The wake-up time could be ~10 seconds less, I guess, when the Pi400 would start without WiFi networking. Starting the network and obtaining the DHCP-address takes 9.3 s (dhcpcd.service) in my boot plot.

$   systemd-analyze plot > mybootplot.svg

https://i.postimg.cc/vmsp12t1/pi400-ptq-boot-plot.png

After the network is ready, the user environment is started containing my autostart cronjob with VNC and Pianoteq.

I am thinking about configuring one key on the Pi400 to switch on/off Wifi arbitrarily (never tried that before).

Re: Pianoteq 7 on Raspberry Pi 400 -- with iPad as interface!

groovy wrote:

The wake-up time could be ~10 seconds less, I guess, when the Pi400 would start without WiFi networking. Starting the network and obtaining the DHCP-address takes 9.3 s (dhcpcd.service) in my boot plot.

After the network is ready, the user environment is started containing my autostart cronjob with VNC and Pianoteq.

I am thinking about configuring one key on the Pi400 to switch on/off Wifi arbitrarily (never tried that before).

Or you can set the pi and your router to use a static IP address, then you can disable the dhcpcd service, I did this with mine.