Topic: Chromebook + Pianoteq

I picked up an Acer Chromebook as a travel laptop last month.  At $179, this is probably the cheapest Pianoteq-capable laptop you can get.  (I got the touchscreen version for $279 in preparation for future Android support under ChromeOS.)  After some fiddling today, I finally got Pianoteq working on this laptop.

First, turn on developer mode + install Crouton.  (Many instruction guides for this.)

At this point, you will have to type some extra commands at the crosh shell.  (Future update will probably resolve this as a fix has been submitted upstream just this week -- https://code.google.com/p/chromium/issu...?id=399008 .)

## load the midi seq module
sudo modprobe snd-seq-midi
## set rights
sudo chmod 777 /dev/snd/seq

  ## The above startup commands can be added into the crouton scripts in /usr/local/bin/

## start ubuntu
sudo startunity

Then inside unity (or XFCE or whatever your preferred shell is), copy Pianoteq over to /opt/ and launch from there.

As for performance, Pianoteq runs about 75% faster under ChromeBook+Crouton versus a standard Linux laptop with the exact same CPU.  My guess is ChromeOS only loads 25% of the drivers & services you find in an ordinary Linux install.  (Takes less than 5 seconds to boot up.)

You can also dual boot Linux + ChromeOS but that requires opening up the hardware and removing the write protect screw.  I would have done that if I absolutely had to but luckily have been able to avoid that for now.

Last edited by Mossy (11-09-2014 13:41)

Re: Chromebook + Pianoteq

What is the basis of your measurement that Pianoteq runs  75% faster on the Chromebook?  CPU load 1/4 of non-Chromebook?  The best measure would be the DSP load reported by Jack for the same latency settings.,

Re: Chromebook + Pianoteq

How well can Pianoteq run on a celeron?  I would think you could play a handful of notes, but not a reasonably complex piece of music with a damper pedal.

Re: Chromebook + Pianoteq

The way I measured was with offline generation of a 100+ polyphony midi file.  (See the benchmark thread.)  I will say I was comparing 2 different distros.  My Linux distro preference is Fedora 20 so I'll have to download the Ubuntu LiveCD to have a true apples-to-apples comparison.

As for whether a Celeron performs well or not, you have to remember that Intel's naming schemes are meaningless.  You cannot assume that a I3 will automatically outperform a Celeron.  Instead, look at architecture, cores, clock speed.  A Celeron 2995U is a Haswell dual core 1.4ghz CPU.  A Haswell I3 would be roughly the same thing but with hyperthreading (2 more quasi-cores).  I5 has 4 cores, I7 has 4 cores + hyperthreading.  Since Pianoteq only can use 2 cores max, a Haswell I3/I5/I7 1.4ghz would run no faster than a Haswell Celeron 1.4ghz.  Then you need to add like 15% or so to each generation -- a Haswell 1.4ghz runs about the same speed as a Ivy Bridge 1.8ghz (temporarily had this laptop).

And from my quick experience, this Chromebook w/ Celeron 2995U can do 100+ polyphony at 48khz with no problems.

Last edited by Mossy (12-09-2014 03:42)

Re: Chromebook + Pianoteq

If these two laptops really have the same basic architecture, then a reduction in processing speed of 75% on a system without any other significant workload seems much more likely to point to some kind of misconfiguration (or misdesign). My first test would be to run top or htop (in the former, press '1' to see per-cpu load in the summary lines on top) in a terminal to observe the load put on individual cores (with hyperthreading you should see 4 virtual cpu cores if I read the spec for your cpu right). When rendering a midi file, the load from pianoteq is distributed to three of them according to a quick try (both with v4.5 and v5). Also check the cpu frequencies. Something wrong with multithreading (e.g. HT setup) and frequency throttling could account for this kind of difference, whether due to the setup of your Linux system or even the actual hardware configuration.

Re: Chromebook + Pianoteq

Celeron 2995U is a dual core CPU -- no hyperthreading.  On both Acer E1-432 running Fedora 20 x86 and Chromebook C720P, both coress are pegged at 100% the entire time.

Again, it's different Linux versions.  ChromeOS uses a way newer Linux kernel than Fedora.  There may be other software stack factors but I'm using a Mate-desktop LiveUSB to do an "out of the box" test.  What this does mean is if it's a software issue, ChromeOS obviously has figured out how to optimize for performance & power.  (Another comparison -- Acer E1-432 lasts 4 hours running Fedora, Chromebook lasts 9 hours.)

I'm right now downloading Ubuntu 14.04 to test that on a LiveUSB.  If I could rip the hard drive out of the E1, I would even test ChromeOS on it w/ the same Crouton config.  Unfortunately, when I opened up the laptop, the hard drive was hidden underneath the motherboard.

Last edited by Mossy (12-09-2014 13:55)

Re: Chromebook + Pianoteq

Loaded drivers and background processes can account for a few megabytes in RAM and a few percent of CPU load. But 75% speed difference: never, sorry. When there's such a big difference, either one system is under permanent load, or (more likely) the two systems are not really comparable after all in terms of speed. Or one system was, as already suggested by others, severly misconfigured, so that e.g. the CPU never ran with full speed.

Last edited by kalessin (12-09-2014 16:05)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

At first, very interesting project to use a chromebook/chromeOS as host for a linux/pianoteq guest system! Thanks Mossy!
When chromebooks go under 200 EUR I probably will try that.

Mossy wrote:

Since Pianoteq only can use 2 cores max, [...]

Just for interest, is the "limitation" to 2 cores verified somewhere? Until today I thought all cores are used.

cheers

Last edited by groovy (12-09-2014 16:12)

Re: Chromebook + Pianoteq

groovy wrote:
Mossy wrote:

Since Pianoteq only can use 2 cores max, [...]

Just for interest, is the "limitation" to 2 cores verified somewhere? Until today I thought all cores are used.

I seriously doubt this as well. Firstly there's no technical reason for it. Either you can use parallelism, or you can't. If it works with 2 CPUs, it works with 64, or even 256. The efficiency drops, i.e., you gain less and less by each additional core, but that doesn't change the fact that multithreading techniques all work without change for "2+" CPUs, not just two.

Secondly I would like to mention that Pianoteq manages to push my CPU (i5-3337U) significantly above 50% load, which is more or less impossible with just using two cores, since Windows treats this processor as having four cores (in fact it has two actual cores but offers four native threads). Also, the user interface speaks of 'additional cores' when enabling multi-core mode.

Mossy wrote:

Acer E1-432 lasts 4 hours running Fedora, Chromebook lasts 9 hours.

This I don't doubt. You maybe forget that the Chromebook's screen is about 30% smaller (meaning a lot less power consumption on that end), and also a small SSD rather than a 500GB hard disk. Also the Chromebook's battery is a bit larger (44Wh rather than 37Wh, if I calculate correctly). So: significantly smaller power consumption and a battery that is almost 20% bigger? Of course it runs longer...

Last edited by kalessin (12-09-2014 16:36)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

Here's my 4-core I5:

> more /proc/cpuinfo | grep MHz
cpu MHz: 1199.000
cpu MHz: 1199.000
cpu MHz: 1199.000
cpu MHz        : 1199.000

Run command to render MIDI to WAV using Pianoteq ... then while it was render, run the following commands:

> more /proc/cpuinfo | grep MHz
cpu MHz: 2267.000
cpu MHz: 1199.000
cpu MHz: 2267.000
cpu MHz: 1199.000

> dstat 15
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw
20   5  73   1   1   0|1109B 2190B|   0     0 |   0     0 | 247   700   <-- ignore this line, this is since bootup
47   3  48   1   1   0| 273B   21k| 415B  704B|   0     0 |3539  3608
46   3  49   0   1   0|   0  3277B| 435B  669B|   0     0 |3363  3770

These 2 data points -- ~50% idle plus only 2 cores bumped up to max speed -- tell me only 2 cores were being used.  (And no, Intel does not allow you to set CPUFREQ separately per core -- AMD used to let you on their Phenom 2 CPUs but not anymore either.)




As for the 75% difference in performance, I think there is something weird about Fedora.  I just tried the following on several different laptops using a Fedora LiveUSB:

"Pianoteq command to render midi -> wav"
--> 16sec
sudo "Pianoteq command to render midi -> wav"
--> 40sec

For some reason, elevating rights to root access slows Pianoteq down by 150%

By comparison, an admin account on Chromebook is about 15% slower than a regular user account.  (Again, I'm STILLLLL downloading the Ubuntu distro ... ugh.)

So Pianoteq definitely does not like priviledged accounts but what Fedora is doing is pretty wacky.  There may be config options but this is deep into the rabbit hole -- I doubt Google will give any answers for this.

Last edited by Mossy (12-09-2014 17:49)

Re: Chromebook + Pianoteq

This is all pretty interesting to me because I would love to be able to use Pianoteq live with something simple and inexpensive.  I typically use two keyboards live, a piano on the bottom and a Roland VR-09 on top for organs and synths.

For the lower piano keyboard I use an M-audio Sono 88 with local control of the built in sounds off and a better sounding virtual piano.  I've experimented with a bunch of these over the years: the original Giggapiano, the Garritan Steinway, Pianissimo, Alicia ' Keys, and finally now Pianoteq 5.

I've actually been following Pianoteq since it was first released, but version 5 is the first one I've liked enough to use. 

I have a fast I7 computer with 16GB of RAM and terabytes of hard disk space in my studio, so using Pianoteq there is no problem.  I am just looking for a simpler approach for my live rig.

So far, what works best is to use the CMP Grand Piano on my iPad in the background with Onsong for chord charts in the foreground live.  The CMP Grand Piano is currently the best sounding iPad piano.  The one I use is about 1.7 GB with 7 velocity layers.  There are individual samples for each key with no loops.  What's missing are resonance layers, pedal and hammer noises, and the level of dynamic subtlety you get with Pianoteq.

The idea of a dual boot Chromebook with one boot option calling up Pianoteq 5 and some sort of chord chart / sheet music program is extremely interesting to me.

Boy would I love to see an iPad version of Pianoteq.

Re: Chromebook + Pianoteq

Mossy wrote:

Here's my 4-core I5:

Would you mind sharing which i5 model, exactly? Many i5 are actually two-core CPUs with hyperthreading (mine is too, for example), which means that you will always see virtual 'pairs' of cores. Apart from that the fact that not both cores run on maximum speed tells us nothing, as Pianoteq cannot instruct the operating system to just run stuff on specific cores.

What the software can do and usually does is launch so-called 'threads', which are more or less light-weight processes, and the operating system will then decide what CPU they will run on. If for whatever reason it thinks it more efficient, it might even run all threads on a single core and send the others to sleep (my phone does this, for example: very often 3 of its 4 cores are completely idle and sent to sleep).

So what happens is this: Pianoteq detects 4 native processor threads, with no information if those correspond to real cores or hyperthreading (i.e., 'virtual') cores. It therefore starts 4 worker threads to do its calculations. This enables the operating system to split the work between a maximum of four cores: but there is absolutely no guarantee that this will actually happen. Especially in the case of writing a WAV you might also hit a bandwidth limitation.

The reason for you seeing only 50 percent load when exporting a WAV might actually be bandwidth, together with hyperthreading. It is almost exactly the same on my hardware here: I get around 75% system load when Pianoteq runs in realtime with 256 simultanous notes. Two hardware cores show a completely maxed-out state, while the two 'virtual' (HT) cores are running at about 50%. This is to be expected, since those two CPU 'cores' are actually simulated to make use of the 'leftovers', but there is a limited amount of those.

Very roughly speaking, HT makes use of the fact that not all commands you run on a CPU core actually do use all of its circuits. There are commands that are simpler than others, and leave maybe up to 50% of the CPU core unused. This is where HT comes in: it creates a second, virtual core in order to maximise the hardware usage. However, this is not a magic bullet.

Now, when I export a WAV, the system load actually drops significantly to almost precisely 50%, with two cores still maxed out, but the two others seemingly doing nothing. But what should not be forgotten is that Pianoteq runs at about 8-10x realtime speed for a normal MIDI file, which increases the memory and storage/IO bandwidth it uses. Intel state themselves in their hyperthreading docs that bandwidth limitations can even degrade performance under certain circumstances, or completely eliminate the gains of HT in others.

(I would like to see an example on an i7 CPU. Those are almost always 'real' quad-core processors. Some i5 are too, but only some desktop series. Mobile i5 usually are 2+2.)

Last edited by kalessin (12-09-2014 19:27)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

Mossy wrote:

Here's my 4-core I5:
[...]
Run command to render MIDI to WAV using Pianoteq ... then while it was render, run the following commands:

> more /proc/cpuinfo | grep MHz
cpu MHz: 2267.000
cpu MHz: 1199.000
cpu MHz: 2267.000
cpu MHz: 1199.000

Hmm, different results on my Quad-Core "Bay Trail" Celeron N2930. Just starting and idling  Pianoteq 5 pushes all cores to max. freq.:

$ more /proc/cpuinfo | grep MHz
cpu MHz         : 2601.328
cpu MHz         : 2600.125
cpu MHz         : 2600.554
cpu MHz         : 2600.468
(no matter, if I render some wavs or not).

Stopping Pianoteq results in lower idle freqs. Two snapshots:

$ more /proc/cpuinfo | grep MHz
cpu MHz         : 1252.710
cpu MHz         : 858.687
cpu MHz         : 2140.875
cpu MHz         : 2409.859

$ more /proc/cpuinfo | grep MHz
cpu MHz         : 1637.023
cpu MHz         : 1690.218
cpu MHz         : 680.968
cpu MHz         : 849.750

I guess this is the "magic" of my scaling_driver 'intel_pstate', the use of scaling_governor performance and the realtime-priority for audio.

cheers

Last edited by groovy (12-09-2014 19:49)

Re: Chromebook + Pianoteq

Mossy, will your Chromebook use a regular generic USB audio and midi drivers?  I would use this with my M-Audio Sono-88 which has generic midi and audio interfaces built in.  I like this because it was cheap, light, has an 88 note semi weighted keyboard, and one USB connection gives me both midi and audio.  It also lets me mix in a second stereo audio source which I use for my second keyboard, and has two headphone jacks in the front.  If that would work together and let me stretch out a little on piano at a low latency, it might be exactly what I need.

Second question: is there some sort of generic ASIO driver like ASIO4ALL for Linux that would work with this Crouton version?

Re: Chromebook + Pianoteq

I have to add a note to my last post. That all 4 cores are pushed to max freq does not mean, that all four are used. When I export the Blues Demo midifile to a wav file, indeed just 2 cores are used most of the time. My guess is, that the OS decides that "two are enough" - and  not Pianoteq (Cpu2 and Cpu3 in this case).

Two snapshots of the tool 'top' while the exporting to wav:

top - 21:19:34 up  1:43,  5 users,  load average: 2.09, 1.65, 1.21
Tasks: 136 total,   2 running, 134 sleeping,   0 stopped,   0 zombie
%Cpu0  :  0.7 us,  0.0 sy,  0.0 ni, 99.0 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  1.0 us,  0.3 sy,  0.0 ni, 98.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu2  : 56.3 us,  4.7 sy,  0.0 ni, 39.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu3  : 41.8 us,  4.1 sy,  0.0 ni, 54.1 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   3944240 total,  1394148 used,  2550092 free,    41876 buffers
KiB Swap:  4789244 total,        0 used,  4789244 free.   631780 cached Mem
[...]

top - 21:21:28 up  1:44,  5 users,  load average: 2.09, 1.76, 1.30
Tasks: 135 total,   2 running, 133 sleeping,   0 stopped,   0 zombie
%Cpu0  :  1.7 us,  0.3 sy,  0.0 ni, 98.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  1.3 us,  0.3 sy,  0.0 ni, 98.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu2  : 52.2 us,  4.3 sy,  0.0 ni, 43.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu3  : 44.0 us,  4.3 sy,  0.0 ni, 51.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   3944240 total,  1390668 used,  2553572 free,    42020 buffers
KiB Swap:  4789244 total,        0 used,  4789244 free.   628548 cached Mem
[...]

Last edited by groovy (12-09-2014 20:31)

Re: Chromebook + Pianoteq

Mossy wrote:

So Pianoteq definitely does not like priviledged accounts but what Fedora is doing is pretty wacky.  There may be config options but this is deep into the rabbit hole -- I doubt Google will give any answers for this.

Not more, than an idea:
Members of the group 'audio' often have a higher realtime-prio, set  in /etc/security/limits.conf or similar:
[...]
@audio - rtprio 90
@audio - nice -10
@audio - memlock 500000
[...]

The "superuser" root is not a member of group audio.

Re: Chromebook + Pianoteq

Quick replies:



Chromebook/USB:

My piano is Casio PX150 which only has a USB MIDI interface so Chromebook/Crouton/Ubuntu config works with USB MIDI nearly out of the box -- just need that extra command to load the driver.  (USB MPU401 MIDI interfaces, I have no idea about.)

Under Linux, no need for additional ASIO or ASIO-like drivers because Linux already offers several levels of abstraction.  ALSA + Direct Hardware would be the equivalent of ASIO.



Cores:

I used HTOP to show the thread details.  When playing interactively, 5 threads are running.   The performance numbers look something like this:
  40%
  15%
  10%
  1%
  1%

When generating a MIDI file off-line, there are only 4 threads with performance like so:
  140%
  50%
  0%
  0%

Looks very likely these threads do different jobs.  So you guys are right that Pianoteq can use more than 2 cores but threads 3/4/5 combined use up a 1/4 of a core at most -- effectively 2.25 cores for Pianoteq itself.  Now if you use PulseAudio or JACKD, those audio daemons can suck up an entire core by themselves also -- then you're at 3.25 cpu usage and every core is being pushed to max speeds.



Fedora Degradation:

This is offline MIDI->WAV generation so I don't think realtime audio rights should have an effect here.

I've also got the same problem on unpriviledged accounts on my work Fedora install.  Unfortunately, there's no way for me to uninstall all my work software packages to figure out what's the culprit.

I'll give Ubuntu a test to see if it has a similar problem ... as soon as the power outages stop around this area.

Re: Chromebook + Pianoteq

It might also be the result of over-locking. A file being generated is essentially a 'serial' ressource. Especially when considering effects like reverb, you just have to write it from beginning to end. When creating a ZIP archive, for example, you can achieve independent blocks, but I guess in the case of an audio file this is going to be virtually impossible.

In 'real time' mode the sound device is written to rather slowly, so it is not an issue. But when writing audio to a file as fast as possible, the file becomes a bottleneck. Depending on how the implementation works exactly, it might be that more or less one main thread ends up doing most of the work because it is the one responsible for writing the results. Access to shared ressources is one of the main reasons parallelism is hard and the gains are most often not linear with CPU cores.

Edit: this seems to be indeed the cause. I just created a MIDI file with maxed-out polyphony (200~250 concurrent notes, permanently). When I export this to a WAV, I indeed see a much higher load on my system, about 75%, which sounds about right considering two of my "four" cores are just hyper threading abstractions. When polyphony is lower, the load drops since the work can be split only so much and a lot of time is spent just waiting for the output. It is probably possible to improve Pianoteq's parallelism, but I speak from experience when I say that this is often easier said than done. As I said, parallelism is hard.

Last edited by kalessin (13-09-2014 08:53)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

Mossy wrote:

I used HTOP to show the thread details.  When playing interactively, 5 threads are running.   The performance numbers look something like this:
  40%
  15%
  10%
  1%
  1%

[...]

Looks very likely these threads do different jobs.  So you guys are right that Pianoteq can use more than 2 cores but threads 3/4/5 combined use up a 1/4 of a core at most -- effectively 2.25 cores for Pianoteq itself.

Yes, when I play via midi-keyboard I also have 5 child processes (also when starting the Blues Demo mid). Just two of those processes consume significant %CPU.

In a process tree we can see the two candidates:

# pstree -nlp | more
[...]
                           |-bash(1260)---Pianoteq(2189)-+-{Juce ALSA}(2190)
                           |                                                      |-{Juce MIDI Input}(2191)
                           |                                                      |-{Pianoteq}(2482)
                           |                                                      |-{Pianoteq}(2483)
                           |                                                      `-{Juce Timer}(2484)
                           `-bash(1304)---su(1346)---bash(1354)-+-pstree(2496)
                                                                                               `-more(2497)
[...]

PS.: I just saw, that not the both Pianoteq child-processes (2482 and 2483) are causing the main %CPU. It is just one of them and the other is the ALSA process 2190 ("the sound output").

Last edited by groovy (13-09-2014 09:58)

Re: Chromebook + Pianoteq

Erm... I'm reasonably sure that pstree does not show individual threads, by the way. Threads are considered part of one process. (I.e., child processes and threads are separate concepts.)

Last edited by kalessin (13-09-2014 10:48)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

kalessin wrote:

Erm... I'm reasonably sure that pstree does not show individual threads, by the way. Threads are considered part of one process. (I.e., child processes and threads are separate concepts.)

There seems to be no contradiction. From the man-page of pstree:

Child threads of a process are found under the parent process and are shown with the process  name  in
       curly braces, e.g.

           icecast2---13*[{icecast2}]

This in mind the parent process was Pianoteq(2189) and the child threads with their process names were:
{Juce ALSA}(2190)
{Juce MIDI Input}(2191)
{Pianoteq}(2482)
{Pianoteq}(2483)
{Juce Timer}(2484)

Last edited by groovy (13-09-2014 11:23)

Re: Chromebook + Pianoteq

As I said: processes and threads are different things. Threads usually do not show up in the system process list as separate entities: forked child processes do, of course, but they are not the same thing. I don't have the time currently, but I should perhaps just write a small threaded C++ program on my Linux box, let it start about 30 threads and look at pstree. My current guess is still very much that they won't show up. It is difficult to impossible to see the running threads of a program without debugger.

Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

Maybe you're right, kalessin, but then the namings in pstree and htop are wrong. Both speak of "threads", which are marked with curly braces in pstree and in htop can be marked in a different color (Option "Display threads in a different color").

One thing that confuses me is, that the five "child threads" of Pianoteq carry a Process-ID (PID). Do you mean, threads cannot carry a PID? In other words do you say, everything, that has a PID, cannot be a thread?


kalessin wrote:

As I said: processes and threads are different things. Threads usually do not show up in the system process list as separate entities: forked child processes do, of course, but they are not the same thing. I don't have the time currently, but I should perhaps just write a small threaded C++ program on my Linux box, let it start about 30 threads and look at pstree. My current guess is still very much that they won't show up. It is difficult to impossible to see the running threads of a program without debugger.

Re: Chromebook + Pianoteq

I just did a small test. It actually does seem that Linux assigns a kernel process ID for each kernel thread it runs. I wrote a small Python program that did not much more than start 10 worker threads, and I could indeed see the complete structure with pstree. So it really seems to be able to show at least all 'real' kernel threads, and those are the ones that are important.

Anyone from Modartt care to shed some light on Pianoteq's multi-core capabilities?

Last edited by kalessin (13-09-2014 14:52)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

Thanks for doing the test!

kalessin wrote:

So it really seems to be able to show at least all 'real' kernel threads, and those are the ones that are important.

The tool htop distinguishes between kernel threads and userland threads. All Pianoteq threads are listed as userland threads on my platform.

Re: Chromebook + Pianoteq

groovy wrote:

The tool htop distinguishes between kernel threads and userland threads. All Pianoteq threads are listed as userland threads on my platform.

I think what's meant there is threads in the operating system domain vs. threads in the domain of 'normal' software. The language regarding threads and processes it at the very least not very precise...

Anyway, what I meant was that there are in theory two mechanisms of creating threads. One is internal to the program and does not help you utilising multiple CPU cores. On the other hand, it is a valid tool to model certain problems and works even if the operating system is not multitasking-capable. The other is what I called a 'kernel' thread, one could also say a 'native' thread... that is, a thread the operating system creates for the program and therefore knows about. This enables the Linux kernel to balance those threads between different cores.

Last edited by kalessin (13-09-2014 16:32)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

I consider Pianoteq to be a " 'normal' software" in your diction. It is started from an unprivileged user. What about the following simple interpretation: Once started, Pianoteq offers a few threads (five on my platform), which can be handled by a multithread-aware system. How the available ressources like cpu-cores are assigned then, is the job of this underlying OS.

Re: Chromebook + Pianoteq

groovy wrote:

I consider Pianoteq to be a " 'normal' software" in your diction. It is started from an unprivileged user. What about the following simple interpretation: Once started, Pianoteq offers a few threads (five on my platform), which can be handled by a multithread-aware system. How the available ressources like cpu-cores are assigned then, is the job of this underlying OS.

Yes, that's more or less the exact definition of how it works on a multi-tasking operating system with native threads, i.e., all modern systems. Threads are logical units, a modelling tool in solving a problem... and they can be used to improve efficiency. Which is why the software uses the operating system to create them nowadays. How they are run and on which core is up to the OS kernel, of course.

Last edited by kalessin (13-09-2014 18:18)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

It's probably not just the OS but also how multi-threaded software is designed.  The WAV file is written out at about 1MB/s which is way less than OS or hardware limits as I have RAID-SSD systems that do 1GB/s.  Plus there's no difference writing to /dev/null or ramdisk files.

What probably is happening is SOME aspects of Pianoteq are multi-thread friendly -- specifically the sound modelling.  But other aspects might only dedicate a single thread to those jobs ... say input, UI, output to sound system, output to file.  So the diagram might look something like:

[ INPUT ]  ----> [ UI ]
     |
     |
[ SOUND MODELLER ] [ SOUND MODELLER ] [ SOUND MODELLER ] [ SOUND MODELLER ]
     |
     |
[ OUTPUT ]

In regular use, the INPUT or OUTPUT threads don't have much impact because humans can't press enough keys fast enough.

But in a benchmark scenario where a computer can send all 150K of MIDI signals in a nanosecond, the sound modeller then is running at full blast and perhaps sending data faster than the final OUTPUT engine can operate.

Re: Chromebook + Pianoteq

The offered threads from Pianoteq seem to be independent from the number of cpu-cores. Regular playing on a connected midi-keyboard opens 5 threads on Mossy's dual-core 2955U, on my older dual-core T7300 I just tested and on my quad-core N2930.

Mossy, one question to your "crouton guest linux".  What type of soundsystem is detected and used by Pianoteq in your guest chroot? ALSA, JACK, Pulseaudio, ...?

Re: Chromebook + Pianoteq

What Pianoteq sees is 2 devices by default:

  PulseAudio
  Chromium OS Audio Server [ default option ]

I put Pianoteq + Crouton in the background, switched back to the Chrome to run top.  It shows CRAS (ChRome Audio Server?) a process running.  I held down the sustain pedal and hit notes nonstop -- CRAS never went above 4% cpu usage.  (PulseAudio in the same test uses a ton of CPU.)

Google shows the following link for CRAS:
http://www.chromium.org/chromium-os/chr...dio-server

Giving rights to the hardware devices (chmod -R 777 /dev/snd) probably would expose the direct ALSA hardware devices but I suspect you could not choose those devices since they would be already locked out by CRAS.  You could install JACK inside Crouton/Ubuntu but I think that would simply put Jack ontop of CRAS and it seems like CRAS does everything JACK does.  (Mixing audio streams, low latency, etc.)

EDIT: looks like in developer mode, you can kill CRAS to release the direct hardware to either Pianoteq or JACK.

Last edited by Mossy (15-09-2014 01:57)

Re: Chromebook + Pianoteq

Hi,

I have a fanless Acer Chromebook cb3-111 now (219 EUR), but my first results with Chrome OS as host for a guest-linux are not so great.

I followed your hints and hotfixes and installed the default Ubuntu LTE guest with Xfce4 Desktop. The Pianoteq5-Demoversion shows two Outputs:

1.) Default ALSA Output (currently Chromium OS Audio Server)
2.) Chromium OS Audio Server

With 48000 Hz Sample rate my smallest Audio buffer is 192 samples (4.0 ms). The cpu-freq I maxed to 2.16GHz with governor performance (in the guest):

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

With just these settings Pianoteq's Perfomance Index is 22 in the guest.

But the other side of the medal: The output is sluggish and definitely more than 4ms. No fun to play.

Your idea seems to be good to circumvent CRAS and directly connect to ALSA.

Do you have acceptable latency on your Chromebook C720p?

cheers

Last edited by groovy (17-09-2014 20:41)

Re: Chromebook + Pianoteq

C720P runs with no problems.  I can't tell the difference between it and my dedicated Pianoteq I5 laptop.

I am running the beta Chromium OS.  First thing I did after getting the Chromebook was switch to the beta channel so I'm probably several updates ahead of the stable version.  I don't know how much of a difference that would be but if there was some work done to CRAS, that could explain some difference.

C720P has a faster CPU by quite a bit so I don't know how much of a factor that is.

Last edited by Mossy (18-09-2014 01:52)

Re: Chromebook + Pianoteq

Mossy wrote:

I am running the beta Chromium OS.  First thing I did after getting the Chromebook was switch to the beta channel so I'm probably several updates ahead of the stable version.

Thank you! I will try that.

Re: Chromebook + Pianoteq

I upgraded to Chrome OS Beta-Version now, which doesn't change much.

But I found another way and have excellent latency now!

In my guest Linux I added my desktop user to the group hwaudio ...

# adduser bob hwaudio

... because the permissions of the midi-input are:

crw-rw---- 1 root hwaudio 116, 1 Sep 18 21:04 /dev/snd/seq

By this my USB-keyboard becomes available in Pianoteq.

But also a very nice side-effect occured: More Audio Output devices with direct access to the soundcard appeared!

The onboard soundcard is named 'byt-max98090' and my Output is now:

"byt-max98090,: Direct hardware device without any conversions (2)"

I get minimal latency with 64 samples (1.3ms) at 48000Hz and the action feels very fast now.

For those, who are interested in some linux details:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: bytmax98090 [byt-max98090], device 0: Audio HiFi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: bytmax98090 [byt-max98090], device 1: Voice HiFi-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Intel [HDA Intel], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ amidi -l
Dir Device    Name
IO  hw:2,0,0  USB-MIDI MIDI 1

No longer necessary is the chmod 777 mentioned in the thread opening with my method, but the module load (modprobe snd-seq-midi) stays required in Chrome OS Beta.

Once again I'm stunned, how hardware-friendly Pianoteq is designed!
Thanks MODARTT!

Last edited by groovy (18-09-2014 21:57)

Re: Chromebook + Pianoteq

I put the modprobe command inside /usr/local/bin/startunity.

I tried to hack a script to launch Pianoteq without Unity or XFCE but I'm not sure what display server is needed to make this work.  (You can start XBMC directly from ChromeOS but XBMC has a "no Linux desktop" mode.)

EDIT: Pianoteq launches but there is no mouse support (X-Server probably needed) so you can't choose anything.

EDIT 2: Works in headless mode once Pianoteq has been configured once in Unity.  I did the following:

  sudo modprobe snd-seq-midi
  sudo enter-chroot
  /opt/Pianoteq/amd/Pianoteq\ 5 --headless

EDIT 3: Works using Chrome's X Server but mouse pointer does not display.  You have to guess where you roughly are.  Unfortunately, it does not support my Chromebook's touchscreen capabilities.

  sudo modprobe snd-seq-midi
  sudo enter-chroot
  host-x11 /opt/Pianoteq/amd/Pianoteq\ 5

Automated it with:

* Crosh shell
  * enter-chroot
    * create /usr/local/bin/startptq
       * sudo -u USER host-x11 /opt/Pianoteq/amd/Pianoteq\ 5

* Crosh shell
  * create /usr/local/bin/startptq
    * modprobe snd-seq-midi
    * chmod 777 /dev/snd/seq
    * /usr/local/bin/enter-chroot -x "/usr/local/bin/startpq"

So now to start up, my routine is:

* Crosh Shell
  * shell
  * sudo startptq

The only issue is the mouse pointer not showing up which I can semi-live with.

Last edited by Mossy (19-09-2014 11:58)

Re: Chromebook + Pianoteq

Mossy wrote:

I am running the beta Chromium OS.

Do yo really mean Chromium OS, the OpenSource, or Chrome OS, google's OS for chromebooks?

Mossy wrote:

The only issue is the mouse pointer not showing up which I can semi-live with.

That would be a real showstopper for me :-(
What is your intention at last? Do you want to reduce the number of commands as much as possible to start Pianoteq on a chromebook?

cheers

Last edited by groovy (19-09-2014 20:38)

Re: Chromebook + Pianoteq

Using whatever Google sends me via their  updates.  I randomly use the term Chromium vs Chrome nowadays because I've been browsing the developer forums to read up on it.

As to why start up Pianoteq directly, before I got my Chromebook, I read up on all the various Linux options thinking I would need them to do my work.  So the first thing I did was switch on developer mode and install Crouton+Ubuntu+XBMC+cli tools -- and never used any of it for the 2 weeks I was on travel.

(I do use Crouton+XBMC now for my kids to pick videos to play.)

So it's inefficient to startup a complete Unity desktop just to launch Pianoteq when there's nothing else in there I use.  I'd rather have it open under the main Chrome UI where I have access to the rest of my tools.  The missing mouse pointer is irritating but because Pianoteq changes the highlight when you hover over elements, it's not that hard to guess where you are.

Re: Chromebook + Pianoteq

Hi Mossy,

I found a way to avoid a full desktop environment by installing just X11 and the window manager 'openbox'.

First I installed a new guest Debian/jessie with just x11:

sudo sh ~/Downloads/crouton -t x11 -r jessie

Upon this base-system I installed openbox like a normal package in Debian:

# apt-get install openbox

This minimal window manager can be started with:

$ startx

In a terminal-window Pianoteq starts as usual with:

$ ./Pianoteq\ 5/amd64/Pianoteq\ 5

and has full mouse-support from the touchpad.


Performance tweaks are again ...

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

and in limits.conf ...

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

The few interactive commands could be packed in nice scripts as you demonstrated.

Thanks!

Re: Chromebook + Pianoteq

Ok, followed your hints but instead of using crouton to install another target, I just did:

host-x11 openbox &
host-x11 (pianoteq command)

Mouse works, touchpad works -- touchscreen does not.  (Touchscreen doesn't work under XBMC either but does work under Unity so I suspect not all window managers support it.)

Some weird stuff happens when you drag the window and if you minimize/click away, it seems to disappear but you can alt-tab back to it.

I may try a few other window managers to see what plays better with Chrome's touchscreen.

Re: Chromebook + Pianoteq

Mossy wrote:

host-x11 openbox &
host-x11 (pianoteq command)

... nice, no terminal-window needed!

And it even works as an one-liner:

$ host-x11 openbox & host-x11 (pianoteq command)

Mossy wrote:

Mouse works, touchpad works -- touchscreen does not.  (Touchscreen doesn't work under XBMC either but does work under Unity so I suspect not all window managers support it.)

With touchscreens I have no experience, sorry.

Mossy wrote:

Some weird stuff happens when you drag the window and if you minimize/click away, it seems to disappear but you can alt-tab back to it.

No problems with dragging here, but good to know alt-tab raises Pianoteq again, when disappeared (it happens here, when I click on another window. Maybe an openbox setting, don't know). The Pianoteq-window has no chance to escape, when started in fullscreen-mode :-)

host-x11 openbox & host-x11 (pianoteq command) --fullscreen

cheers

Last edited by groovy (21-09-2014 14:55)

Re: Chromebook + Pianoteq

I tested a bunch of other window managers (compiz, metacity, mutter and a few others) .. and it looks like they act a bit funny if you've previously run one and didn't reboot before trying another.  After rebooting before testing, openbox didn't have the same weirdness (which probably means running unity/xbmc leaves some weird bits flipped on in ChromeOS's X server).

Mutter seems to work the best but if you bring it to the foreground to kill it -- it just turns your computer off.  It's fine if you just leave the chroot and let the system auto-kill it.

And from what I can tell, touchscreen actions are being captured by Chrome's X server but none of the underlying window managers know what to do with it.  When I first start up Pianoteq, tap-to-click on the touchpad works perfect.  But the moment I touch the screen, tap-to-click is disabled and I have to press down on the mouse buttons first.  What this implies is the window manager received a touch signal that looked like "hold-down" and it's up to the desktop (Unity,Gnome3,etc) to interpret what to do.

Re: Chromebook + Pianoteq

A mixer is useful to adjust the volume of the headphones-output. To start it next to Pianoteq, I use the autostart feature of openbox-session.

The only command in my guest system is now:

$ host-x11 openbox-session

If a .config/openbox/autostart exists in the users homedir, then its content is executed. I filled it with ...

xterm -e alsamixer -c0 &
~/Pianoteq\ 5/amd64/Pianoteq\ 5 &

..., which opens a simple mixer-window for card0 and another window for Pianoteq. The volume is adjustable with arrow-up and -down yet.

cheers

Re: Chromebook + Pianoteq

It was interesting to me, how differently two similar netbooks can sound depending on their hardware. I compared my Acer Chromebook CB3-111 with a standard Acer Notebook E3-111. While the Chromebook has a new soundchip 'byt-max98090', I have never seen before , the E3-111 has a more common chip 'ALC 283'. Both sound differently to me.

Without measuring the headphones-outputs, a lot of reasons are possible. The ALC Output seems to have a slight roll-off in the bass and an overall leaner/thinner sound.

The byt-max has more mids and lower mids and a more real piano balance.  At the same time it is a bit clearer and transparent to my ears.

I like the sound-characteristics of both laptops and I'm sure, the differences could be easily measured (output-impedance, EQ). The byt-max98090 seems to be the more professional one, because it has many, many mixer items. For the moment I just wanted to share, that there are differences.

ciao

PS: Compared with the same 32 Ohm headphones Beyerdynamic DT 235.

Re: Chromebook + Pianoteq

@groovy: interesting. Not completely unexpected, though I personally have yet to find a laptop or other mobile sound device I would consider even close to being acceptable. At least all modern devices I know, ranging from smartphone and small tablet to i5 notebook, have problems with excessive noise. And I really mean excessive. Maybe I'm just being overly sensitive, but I more or less have to use external hardware just to get an acceptable noise floor.

Last edited by kalessin (30-09-2014 07:52)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

Here's the downside to using a Chromebook.

My wife powered the machine on, was puzzled by the initial screen warning that developer mode was one ... and pressed space which blew away the entire install.  (The message says press space to disable developer mode.)  The Google/ChromeOS stuff ... easy, log back in, sync and everything is back.

I haven't been able to reinstall Crouton yet because I currently am working overseas where many Google services are blocked ... one of them is the chromium source server needed to finish the setup.  Using the automatic proxy feature to download via VPN corrupts the Ubuntu packages (known bug in Ubuntu).  I'll probably have sync an internal chromium source server to finish this install.

Re: Chromebook + Pianoteq

kalessin wrote:

At least all modern devices I know, ranging from smartphone and small tablet to i5 notebook, have problems with excessive noise. And I really mean excessive.

Fortunately I don't have these problems, as both netbooks are fanless and SSD equipped, which helps a lot I guess. But I know, what you mean ... I had an eeeBOX that was noisy as hell, intermittend chirps, hum, hiss ...

kalessin wrote:

Maybe I'm just being overly sensitive, but I more or less have to use external hardware just to get an acceptable noise floor.

... I even can't stand the fan-noise of a laptop standing next to me while playing :-)

Btw, I guess I found the reason, why the headphone-outputs sound different. I measured the output-impedance today and found 59 Ohm for the Acer E3-111 versus 6.5 Ohm at the Chromebook CB3-111. The most good headphone-amps have a low impedance.

I hope, I didn't make a mistake, so here are my raw results:
I generated a 1kHz sine on each laptop with audacity and measured the voltage at the headphone-output once open and once bridged with a 33 Ohm resistor (ceramic). From the voltage-drop I calculated the output-impedance:

E3-111: 458 mV -> 165 mV => 59 Ohm
CB3-111: 385 mV -> 322 mV => 6.5 Ohm

@Mossy: Yes, there is a high risk, that someone unintentionally "recovers" a chromebook by pressing space . Google should stop that silly hurdle soon, if they want to be innovation-friendly not only on paper.

Interesting, that the guest-installation doesn't finish, when a chromium source isn't available. AFAIK the Google's audio-server CRAS is compiled from these sources (but should be disposable, when ALSA can be reached directly).

Last edited by groovy (30-09-2014 21:55)

Re: Chromebook + Pianoteq

groovy wrote:

... I even can't stand the fan-noise of a laptop standing next to me while playing :-)

Just to be clear: I was talking about the noise produced by the sound device itself. You can hear all kinds of high-frequency stuff there, especially on modern mobile hardware. The price for highly-integrated design, I guess. But yes, fans can be quite pesky buggers, too. ;-)

Last edited by kalessin (01-10-2014 07:13)
Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)

Re: Chromebook + Pianoteq

kalessin wrote:

I was talking about the noise produced by the sound device itself.

Yes, me too. - Can you name a device, you had noise-problems with?

Re: Chromebook + Pianoteq

groovy wrote:

Yes, me too. - Can you name a device, you had noise-problems with?

As I said, I have yet to find a 'good' device. I used to have a Google Galaxy Nexus (made by Samsung): eek. I have an S4 now: a bit better, but barely. I have a small Asus tablet (MeMo 7"): ouch. My current main PC is an i5 Win8 tablet (Acer W700): yikes.

My old Cowon D2 mobile audio player behaves like a dream compared to the S4... and the S4 is anything but 'cheap' hardware after all (even if I bought it after the S5 came out). And that Acer tablet is so bad I even hear the noise through the desktop speakers. To use this for Pianoteq is unthinkable, so I use my Zoom R24's audio device.

Pianoteq 6 Standard (Steinway D&B, Grotrian, Petrof, Steingraeber, Bechstein, Blüthner, K2, YC5, U4, Kremsegg 1&2, Karsten, Electric, Hohner)