Topic: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Hi!  I have Pianoteq 6 and have used it on an old laptop I had laying around (worked just fine).  However, it was clunky and and messy.  So I'd like to switch to using my Surface Go 2 (with the Core M3/8GB of RAM).  I did a dry run and the Go quickly became hot to the touch and the audio was full of noise.  And then it crashed.

I bought a focusrite solo thinking that would somehow take the pressure off the processor and make things work.  And now I don't know how to set the whole mess up.  The Go only has a single USB C port, and I don't know which device gets connected to which device.  So I'm looking for two answers:

1) Is it possible to run Pianoteq in the configuration laid out above?

2) How do I lay it all out?  I need basic instructions as I haven't been able to work this out.

Thanks in advance!!

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Makalajala wrote:

Hi!  I have Pianoteq 6 and have used it on an old laptop I had laying around (worked just fine).  However, it was clunky and and messy.  So I'd like to switch to using my Surface Go 2 (with the Core M3/8GB of RAM).  I did a dry run and the Go quickly became hot to the touch and the audio was full of noise.  And then it crashed.

I bought a focusrite solo thinking that would somehow take the pressure off the processor and make things work.  And now I don't know how to set the whole mess up.  The Go only has a single USB C port, and I don't know which device gets connected to which device.  So I'm looking for two answers:

1) Is it possible to run Pianoteq in the configuration laid out above?

2) How do I lay it all out?  I need basic instructions as I haven't been able to work this out.

Thanks in advance!!

Welcome to the Forum!

First thing you will need is something to allow a connection from your USB audio device (Focusrite) to your Surface.  Search for 'USB C hub'.  This will plug into your USB C port of your Surface and allow you to connect your standard USB A cable into the hub.  [I am not familiar with the Focusrite, but you may need to first install a USB driver for it.]  Make sure it is working, i.e. when you play a sound or video on the Surface, the audio is coming out of the speakers connected to your focusrite.

You will also need to connect your VPC1 (which I also have, and love) via its USB output to your Surface.  Make sure that the USB C hub has a second USB port for you to do this.  This will supply all of the midi messages to PianoTeq running on your Surface.  Make sure that you are following all of the installation steps in the manual:

https://www.modartt.com/user_manual?pro...mp;lang=en

especially for your settings in File->Audio/MIDI Setup->Device tab

No doubt that your Focusrite will sound better and be more stable than the Surface.  Make sure to check the CPU load while you are running and playing PianoTeq (via the Task Manager), as well as your Performance Index (File->Audio/MIDI Setup->Perf tab).  When you reply with your Performance index and average CPU load, we can tweak from there.

Give this a try and let me know how far you get.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Is it too late to swap your Focusrite solo <https://focusrite.com/en/usb-audio-inte...rlett-solo> for a 4i4 <https://focusrite.com/en/usb-audio-inte...arlett-4i4>?

The reason I suggest this is that the 4i4 has a MIDI input; you would connect your VPC1 to the Scarlett 4i4 with a MIDI cable and have only the Scarlett to connect to the computer.

I do not have direct experience here, so others might be able to document this being irrelevant.  I can only say that if I were setting it up, I'd want to have only a single interface connecting to the computer to minimize ways for things to go wrong.

Current generation Focusrite Scarlett interfaces use USB-C connectors, but I think they come with a USB-C/USB-A cable, so you'll need a USB-C/USB-C.  Despite the USB-C connector they are USB 2.0, though, so you only need a cable capable of USB 2.0 (that allows for a longer cable than if you needed, say, USB 3.1).

As to whether the Surface Go 2 M3 is up to running PianoTeq... I have no idea.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

I just ordered the solo a couple weeks ago, so it's still returnable.  That's one of the reasons I posted.  I like the idea of the single cable approach as one of my objectives was to reduce clutter.  Thanks for your help!!


Coises wrote:

Is it too late to swap your Focusrite solo <https://focusrite.com/en/usb-audio-inte...rlett-solo> for a 4i4 <https://focusrite.com/en/usb-audio-inte...arlett-4i4>?

The reason I suggest this is that the 4i4 has a MIDI input; you would connect your VPC1 to the Scarlett 4i4 with a MIDI cable and have only the Scarlett to connect to the computer.

I do not have direct experience here, so others might be able to document this being irrelevant.  I can only say that if I were setting it up, I'd want to have only a single interface connecting to the computer to minimize ways for things to go wrong.

Current generation Focusrite Scarlett interfaces use USB-C connectors, but I think they come with a USB-C/USB-A cable, so you'll need a USB-C/USB-C.  Despite the USB-C connector they are USB 2.0, though, so you only need a cable capable of USB 2.0 (that allows for a longer cable than if you needed, say, USB 3.1).

As to whether the Surface Go 2 M3 is up to running PianoTeq... I have no idea.

Last edited by Makalajala (31-01-2021 20:53)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Thank you for your thoughtful and thorough reply.  The VPC1 is an awesome instrument.  I have a hub on hand, so I'm set there.  I'll follow your instructions now and see what happens.

Thanks again!

klaberte wrote:
Makalajala wrote:

Hi!  I have Pianoteq 6 and have used it on an old laptop I had laying around (worked just fine).  However, it was clunky and and messy.  So I'd like to switch to using my Surface Go 2 (with the Core M3/8GB of RAM).  I did a dry run and the Go quickly became hot to the touch and the audio was full of noise.  And then it crashed.

I bought a focusrite solo thinking that would somehow take the pressure off the processor and make things work.  And now I don't know how to set the whole mess up.  The Go only has a single USB C port, and I don't know which device gets connected to which device.  So I'm looking for two answers:

1) Is it possible to run Pianoteq in the configuration laid out above?

2) How do I lay it all out?  I need basic instructions as I haven't been able to work this out.

Thanks in advance!!

Welcome to the Forum!

First thing you will need is something to allow a connection from your USB audio device (Focusrite) to your Surface.  Search for 'USB C hub'.  This will plug into your USB C port of your Surface and allow you to connect your standard USB A cable into the hub.  [I am not familiar with the Focusrite, but you may need to first install a USB driver for it.]  Make sure it is working, i.e. when you play a sound or video on the Surface, the audio is coming out of the speakers connected to your focusrite.

You will also need to connect your VPC1 (which I also have, and love) via its USB output to your Surface.  Make sure that the USB C hub has a second USB port for you to do this.  This will supply all of the midi messages to PianoTeq running on your Surface.  Make sure that you are following all of the installation steps in the manual:

https://www.modartt.com/user_manual?pro...mp;lang=en

especially for your settings in File->Audio/MIDI Setup->Device tab

No doubt that your Focusrite will sound better and be more stable than the Surface.  Make sure to check the CPU load while you are running and playing PianoTeq (via the Task Manager), as well as your Performance Index (File->Audio/MIDI Setup->Perf tab).  When you reply with your Performance index and average CPU load, we can tweak from there.

Give this a try and let me know how far you get.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Coises wrote:

Is it too late to swap your Focusrite solo <https://focusrite.com/en/usb-audio-inte...rlett-solo> for a 4i4 <https://focusrite.com/en/usb-audio-inte...arlett-4i4>?

The reason I suggest this is that the 4i4 has a MIDI input; you would connect your VPC1 to the Scarlett 4i4 with a MIDI cable and have only the Scarlett to connect to the computer.

I do not have direct experience here, so others might be able to document this being irrelevant.  I can only say that if I were setting it up, I'd want to have only a single interface connecting to the computer to minimize ways for things to go wrong.

Current generation Focusrite Scarlett interfaces use USB-C connectors, but I think they come with a USB-C/USB-A cable, so you'll need a USB-C/USB-C.  Despite the USB-C connector they are USB 2.0, though, so you only need a cable capable of USB 2.0 (that allows for a longer cable than if you needed, say, USB 3.1).

As to whether the Surface Go 2 M3 is up to running PianoTeq... I have no idea.

Unfortunately, such an upgrade would double the price.  He already has one mic preamp he's not using (presumably), which is where a good chuck of the MSRP is invested.

I have run my VPC1 using both the MIDI connector to my audio device, as well as the USB connector back to my computer.  Both worked without any issues.
In this case, he only has one USB port on the Surface, so the keyboard is going to have to plug into something that's not the Surface itself.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

I agree with klaberte. I used a (very) cheap USB-C hub on my PC, for my sound card and USB-MIDI cable, it worked fine but sometimes it was unstable, perhaps you have to try a couple before having good results. To install focusrite drivers, just plug the sound card to an USB port and a new USB storage unit will be detected (like if the focusrite was a pendrive). Inside this unit there is a HTML document with step by step instructions. Hope it helps.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

I just had a thought...

If you have a method for doing full system backups set up, do one; either way, create a system restore point.  Then, following whatever instructions are provided, install the drivers and connect the Focusrite you have to your Surface Go 2.  (You 'll need to scrounge a USB-C to USB-C cable if you don't already have one.)

Then, open Pianoteq and go to File | Audio/MIDI setup.  You won't have a MIDI device, but set up the output to use ASIO drivers to the Focusrite.

Then, play the demo file.

That should tell you if the computer can handle Pianoteq with the Focusrite.  If it works, then you can decide whether to get a USB hub or an audio interface with a MIDI input.  If it doesn't work, and you can't get it to work, then you pretty much have your answer.

Last edited by Coises (01-02-2021 08:45)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Update (even though the original post issue should have been solved, it may be useful for others):
I bought a generic USB 2.0 hub and I get not significant difference of latency if I connect both the USB-MIDI and the audio interface to the hub or if I connect them to different free USB ports on my laptop.
I get 10 ms of real latency (measured with an oscillosope, on PT interface it says 48kHz * 64 buff = 1.3ms). The use or not of the hub does not change this figure. I don´t know how to paste images to the forum, but the difference is not noticeable.
By the way I'm using a MP11 with its USB-MIDI output (not the DIN5 connector) and a miniDSP 2x4HD sound card (all effects by passed) with its own ASIO driver. The laptop is an MSI GL62M 7RD (Intel 7700hq) in power saving mode.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

I get 10 ms of real latency (measured with an oscillosope,[...]

Hi,
between which points in time?
And could you share the raw values?

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

groovy wrote:

I get 10 ms of real latency (measured with an oscillosope,[...]

Hi,
between which points in time?
And could you share the raw values?

Hi, I generated the MIDI messages with a Teensy mictrocontroller. Then, at the same time the messages were sent, a digital pin was set high. I chose the trigger of the osc to be the digital pin signal, and the other channel the audio output. The time is between the digital pin signal (rising edge) and the audio signal.
I know the best option would be to trigger the oscilloscope with the DIN5 TX wire but the way I made the measurement is easier.

EDIT: I should measure this again to share the values because I only took photos with my mobile phone.

Last edited by marcos daniel (01-03-2021 16:55)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Nice method, marcos, if I understand you correctly:

https://i.postimg.cc/bv8sd77q/teensy-osc.jpg

1 ms is usually needed for one MIDI event.
With a Linux alsa-driver (48kHz, 64 samples = 1.3 ms, async) for example the buffer-latency is 3 x 1.3 ms =3.9 ms).

If you found 10 ms then 5.1 ms are "lost" somewhere in USB-BUS, USB-driver, etc., which probably is normal.

PS: Oh, I saw you used an external USB-DAC, then my sketch is not correctly (there is one more USB connection at the output). Thank you.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Yes, your scheme is correct

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Fine.
Then it could be useful to determine the amount of latency in the MIDI keyboard itself.
Assuming you found 10 ms latency between MIDI event and Audio event.
And for example 25 ms between click event of the fingernail on a key and Audio event.
Then 25 ms - 10 ms = 15 ms is the latency in the keyboard itself.
Important? No :-) But interesting somehow 8-)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Well, you gave me an idea, and this weekend I am not very busy so just for curiosity, I made some latency measurements with the oscilloscope.
I covered the following items:
*Time between key stroke and MIDI message (on a Kawai CL35)
*Time between MIDI message and the sound produced on Kawais CL35 and MP11
*Time between MIDI message and the sound produced by Pianoteq
*Difference in latency between GNU/Linux and Windows
Hardware used: OWON SDS 1022 oscilloscope, Kawai CL35 digital piano, Kawai MP11 digital piano, MSI GL62M 7RD laptop (cpu: i7 4770hq), generic Chinese laptop (i7 4710mq), miniDSP 2x4HD audio interface, ESI UDJ6 audio interface, ESI MIDIMate II USB-MIDI interface.
Software: Pianoteq 6, Windows 10, Ubuntu Studio 20.04.
I discovered that it is possible to watch MIDI events on the oscilloscope with a non-invasive method, just attaching the probe to the MIDI cable, without any electrical contact, as shown in the following picture:
https://postimg.cc/fJBRPrfW
https://i.postimg.cc/CxVnRyZ8/fig1.png
This way, I got the waveform corresponding to the MIDI protocol, somewhat distorted , but good enough to trigger the scope. Notice, the duration of a bit, corresponding to 31250 baud, the speed of MIDI serial communication.
https://i.postimg.cc/3xC4pLpc/fig2.png

In order to get the time at which keys are pressed, I opened the CL35 and connected the other probe to one of the OR diodes of the scan matrix. I don´t know whether that diode corresponds to the first or second sensor. The connection is not visible, but the picture gives an idea of how it was made.

https://i.postimg.cc/wxZmdRg0/fig3.png
Keys are scanned at 11kHz, as can be appreciated in the waveform:
https://i.postimg.cc/1Xkn02JL/fig4.png
https://i.postimg.cc/QC9KThkQ/fig5.png
So, until now, we can have the times between the keys being played, and the notes being sent through the MIDI cable.
Just for comparison, I measured the latency of the digital piano (from keys being played to sound being reproduced). I performed these measurements on my Kawai CL35.
https://i.postimg.cc/GhDs33pr/fig6.png
Next, I wanted to know, the latency of a digital piano when playing notes from an external source, in this case I tested both CL35 and MP11. To achieve this, I sent notes from the PC and watched for the time between the arrival of the MIDI message and the production of the sound. In this section, we don’t know the time added by the USB to MIDI conversion, we are only looking at the latency between MIDI and audio.
https://i.postimg.cc/j5kJ2LNq/fig7.png
Same procedure was followed to measure latency of Pianoteq with different interfaces and buffer settings, and, in this case, we can estimate the total latency as:
Total latency= key press to MIDI message latency + MIDI message to sound latency.
It is worth noting that latency is not constant among different successive tests.
Results:
The following values are averages of at least 3 measurements:
*CL35 Key press - MIDI message sent latency: 3.98 ms
*CL35 Key press - sound produced latency: 5.92 ms
*CL35 MIDI event received - sound reproduction latency: 1.97 ms
*MP11 MIDI event received - sound reproduction latency: 2.50 ms
So, if we want, for instance, to play MP11 sounds using CL35 keyboard using a DIN5 MIDI cable (who would do that?) we would hear the sound from the MP11 3.985 + 2.50 = 6.485 ms after having pressed the key, instead of the 5.92 ms that takes the CL35 to play its own sounds. Curiously, the higher end MP11 is a bit slower than the cheaper CL35.
Now let’s turn to PC’s latency, here the image gets a little more complicated because we can set different buffer values. In addition, we can choose in Windows between the native drivers and ASIO4all. For Ubuntu GNU/Linux there are many settings which can be improved but I used the stock image. Sample rates were chosen to be 48kHz and the buffer size 64 and 128 in most cases. Measurements made on the MSI laptop are marked with M, the ones made on the generic laptop with G. Just to add some information, I took old values from this post of mine in pianoworld forum, from year 2013, in which I complained because I wasn’t able to get a decent latency (http://forum.pianoworld.com/ubbthreads...._USB_.html). I had tested some latencies taking the difference in time between audio signals coming from Pianoteq and CL35. In order to make a fair comparison, we need to add 1.97 ms to those old values.

https://i.postimg.cc/LXs1mzJ0/fig8.png
The PC was a laptop with an Intel Pentium 2020m processor. Finally, I took the measurements from this another post, https://forum.modartt.com/viewtopic.php...13#p967413 employing an ODROID XU4 (ARM processor, Raspbian Linux OS) with the UDJ6. This way we get four extra values for UDJ6 interface under Linux. I indicate these last values as 2020M and ARM.
It is worth mentioning that the delays measured with this procedure (timing between MIDI signal and sound) match perfectly with the ones measured with the Teensy microcontroller procedure mentioned before.

https://i.postimg.cc/ZqHNkf5d/fig9.png

Generally speaking, I feel that latencies of about 10 milliseconds are OK. I don’t feel comfortable in those cases which latency is about 15 ms and above. I don’t know if anybody else experimented this, but I get my hands tired if I play with this latency.
To make a comparison, taking the speed of sound in air to be 343 m/s, 3 ms of latency are equivalent to 1.03 m of distance from speakers, so 15 ms of latency would be equivalent to have speakers at about 5 meters, which I don’t think is very far, but I started doing those measurements in 2013 because I noticed the latency (at that time, I thought that the word ASIO was a warranty of 0 latency).
It is interesting that driver ASIO4all performance varied widely for different systems with the same interface. The best option seems to be the internal sound card, but I must point that both ESI UDJ6 and miniDSP 2x4HD are not intended as audio interface for live playing, the first one is for DJs (not offense intended, but they don’t play in the same sense a pianist plays) and miniDSP is more an audio processor than an interface. I wonder how well would an entry level Focusrite / Behringer / M-Audio, etc. perform. By the other hand ALSA is not great but consistent among systems.


Appendix: values of latency

*miniDSP 2x4HD
M, Profile ‘minimum latency’, sample rate: 48 kHz, buffer size: 64 samples, latency: 10.6 ms
G, Profile ‘minimum latency’, sample rate: 48 kHz, buffer size: 64 samples, latency: 11.65 ms
M, Profile ‘minimum latency’, sample rate: 48 kHz, buffer size: 128 samples: 14.19 ms
G, Profile ‘minimum latency’, sample rate: 48 kHz, buffer size: 128 samples: 15.14 ms
M, Windows Audio Exclusive mode, 48 kHz, 192 samples: 23.28 ms
M, ASIO4all, 48 kHz, 64 samples: 13.84 ms
G, ASIO4all, 48 kHz, 64 samples: 15.36 ms
M, ASIO4all, 48 kHz, 128 samples: 14.3 ms
G, ASIO4all, 48 kHz, 128 samples: 16.4 ms
M, Linux (ALSA direct hardware without any conversion), 64 samples: 15.16 ms.
G, Linux (ALSA direct hardware without any conversion), 64 samples: 15.19 ms.
M, Linux (ALSA direct hardware without any conversion), 128 samples: 23.6 ms.
G, Linux (ALSA direct hardware without any conversion), 128 samples: 22.35 ms.

*Onboard sound chip
M, ASIO4all, 64 samples: 9.27 ms
M, ASIO4all, 128 samples: 12.6 ms
M, Linux (ALSA direct hardware     without any conversion), 64 samples: not usable (pops).
M, Linux (ALSA direct hardware without any conversion), 128 samples: 11.33 ms.
G, ASIO4all, 64 samples: 9.28 ms
G, ASIO4all, 128 samples: 11.88 ms
G, Linux (ALSA direct hardware without any conversion), 64 samples:  8.68 ms.
G, Linux (ALSA direct hardware without any conversion), 128 samples:  11.77 ms.
*ESI UDJ6
M, ESI driver, 48 kHz, 96 samples (interface default): 10.44 ms
M, ESI driver, 48 kHz, 128 samples: 12.66 ms
G, ESI driver, 48 kHz, 128 samples: 13.57 ms
M, ASIO4all, 48 kHz, 64 samples: 37.47 ms
G, ASIO4all, 48 kHz, 64 samples: 7.76 ms
M, ASIO4all, 48 kHz, 128 samples: 42.63 ms
G, ASIO4all, 48 kHz, 128 samples: 10.99 ms
M, ALSA (direct hardware without any conversion), 48 kHz, 64 samples: 12.10 ms
G, ALSA, 48 kHz, 64 samples: 12.06 ms
M, ALSA, 48 kHz, 128 samples: 20.33 ms
G, ALSA, 48 kHz, 128 samples: 20.5 ms
2020M, ALSA, 48 kHz, 64 samples: 15.9 ms
2020M, ALSA, 48 kHz, 128 samples: 15.9 ms
ARM, ALSA, 48 kHz, 64 samples: 12.1 ms
ARM, ALSA, 48 kHz, 64 samples: 20.3 ms

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Wow, impressive work! My English is not good enough to appreciate it fairly.
I like your "non-invasive method" of attaching the MIDI-cable! Great discovery, makes everything much easier!
And cool, that you opened the Kawai CL35 to tap the scan matrix.

A bit strange is, that the sound of your CL35 appears earlier (dx=4.040ms) than its triggering MIDI note (dx=4.380ms) in the pictures. Has this to do with your note "that latency is not constant among different successive tests"?
Good that you repeated some measurements, because sometimes the cpu-frequency and buffers have to "wake up" first. And MIDI-jitter exists, as I measured recently in another thread.

To tap the MIDI event on the cable is a great progress to make setups comparable. The only thing left open is the overall latency, that one that the pianist feels, between touching a key surface and hearing the piano sound. And setups with USB-MIDI sources.

Thank you so much!

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

groovy wrote:

Wow, impressive work! My English is not good enough to appreciate it fairly.
I like your "non-invasive method" of attaching the MIDI-cable! Great discovery, makes everything much easier!
And cool, that you opened the Kawai CL35 to tap the scan matrix.

A bit strange is, that the sound of your CL35 appears earlier (dx=4.040ms) than its triggering MIDI note (dx=4.380ms) in the pictures. Has this to do with your note "that latency is not constant among different successive tests"?
Good that you repeated some measurements, because sometimes the cpu-frequency and buffers have to "wake up" first. And MIDI-jitter exists, as I measured recently in another thread.

To tap the MIDI event on the cable is a great progress to make setups comparable. The only thing left open is the overall latency, that one that the pianist feels, between touching a key surface and hearing the piano sound. And setups with USB-MIDI sources.

Thank you so much!

Yes perhaps there is not statistical significant difference, I should have added the standar deviations and the number of repetitions, but I was in lazy mode. As I wanted to do many measurementes and just for curiosity, I only made three o four of each, and sometimes there were up to 2 milliseconds of difference between consecutive measurements. I think there must be some kind of queue of events, plus some jitter, so you get what you get...

I think the point where the scan matrix detects the contact is a good approximation to the touch of key surface. I thought of placing a mic to capture the sound, but that would had been dependent on the speed (force) applied to the key.
By the way, could you paste the link to your post on MIDI jitter?
Thanks

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Thank you for the additional Infos. Must have been a hard-working weekend for you. Laziness nope

My recent link about MIDI-jitter (and latency) starts here:
https://forum.modartt.com/viewtopic.php...25#p972725

marcos daniel wrote:

I think the point where the scan matrix detects the contact is a good approximation to the touch of key surface.

Yes, but it would be good to know it for sure, now you found a way to capture a signal from the outgoing MIDI note.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Hello again,

the opposite of non-invasive is ...

https://i.postimg.cc/85Jb1cpM/MIDI-shunt-100-Ohm.jpg

I sacrificed a MIDI-cable, cut through one of its two wires and soldered a shunt (100 Ohm) between the ends. Your guilt, Marcos! ;-)
When a MIDI event passes I get a voltage over the resistor that I sent to the analog input of a soundcard. Not sure, if really needed, but to protect my soundcard I put a hum-destroyer/transformer at the input.

The Pianoteq sound generated by this MIDI event I sent to the second input channel of the soundcard.
Recording both signals (MIDI and Audio) shows the latency between both signals:
https://i.postimg.cc/g0BDF8WG/MIDI-Audio-latency-UM1-SX-2i2-44-1-64s.png

I repeated it more than ten times and always got 12 ms between start of the MIDI-byte and start of the Audio (as shown in the picture).

Of course the latency depends on the sample-frequency in PTQ, on my netbook I'm using just moderate 44.1 kHz with 64 samples.   

Some of the other parameters of the chain:
- 5-pin DIN MIDI-output of an old Goldstar GMK-49.
- MIDI-to-USB Interface Edirol UM-1SX
- Netbook CPU Intel N4200
- Pianoteq v7.2.0, Ant. Petrof Prelude (like to play Blues atm)
- Linux/alsa kernel 4.9.x (compiled)
- USB-Audio Scarlett 2i2 gen2

Cheers

Last edited by groovy (08-03-2021 23:26)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

One step beyond, where everything starts: With the fingerclick on the key.
I recorded this moment with a dynamic Microphone and compared it with the generated MIDI Note on the first channel again. Playing forte  results in ~6 ms between those two events:

https://i.postimg.cc/2SBxXbgs/keyclick-Mic-MIDI-GMK-49-forte.png

Mezzoforte is more in the range 8 - 11 ms.

@Marcos In your picture with matrix vs. midi there seem to be 3.4 ms between the start of both events. Seems to mark the upper (unreachable?) limit of a real moved key.

Conclusio:
With the setup I decribed in my last post the over-all latency of a forte played key is around (6 ms + 12 ms) = 18 ms

(a real Grand (or has it been an Upright?) is somewhere around 30 ms IIRC)

PS: Interesting could be the latency of heavy massive keys with 2 - 3 sensors per key.

Last edited by groovy (09-03-2021 20:36)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Wow I hadn't seen this!
When you say you got 12ms, do you mean that the time was excactly the same?

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Yes, each of the ten measurements in Audacity had a 'Length of Selection' of 12 ms (not 11 or 13 ms). The time resolution is limited to 1 ms in that window (00h00m00.012s).

Last edited by groovy (24-03-2021 08:26)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

groovy wrote:

Yes, each of the ten measurements in Audacity had a 'Length of Selection' of 12 ms (not 11 or 13 ms). The time resolution is limited to 1 ms in that window (00h00m00.012s).

Could it be related to focusrite drivers?
In this PW post, some years ago, I had found a relative standard devition between measurements ranging from 1.6 to 19%

edit: I forgot to paste the URL
http://forum.pianoworld.com/ubbthreads...._USB_.html

Last edited by marcos daniel (24-03-2021 19:43)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

marcos daniel wrote:

Could it be related to focusrite drivers?

It is the standard usb-audio kernel module (which is also responsible for MIDI), don't know. Eventually it helped, that the system timer is 1000 Hz and not common 250 Hz or 100 Hz.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

I'm having access to an oscilloscope in the meantime and tested another Pianoteq hardware. Although two main components have changed (CPU and USB-Audiointerface), I found again around 12 ms latency between incoming MIDI Note-On byte and generated audio:


https://i.postimg.cc/yNpfnTym/MIDI-to-Audio-latency-UM-1-SX-Pi400-64bit-Korg-B2.png


Platform this time had been my Raspberry Pi 400 with ARM  Cortex-A72, PiOS 64-bit beta and the internal USB-Audiointerface of a Korg B2 Digitalpiano.

(my previous test had been with an Intel N4200 based Laptop, Debian Stretch 64-bit and Focusrite 2i2 gen2.)

In both setups the same MIDI-to-USB Interface (Edirol UM-1SX) was used at the input.

To generate cyclic MIDI Note-On events I used a software-sequencer this time (Muse).

The internal Korg audiointerface has a fixed samplerate of 48 kHz and so it had a small advantage in this competition against the 44.1 kHz that I used in my Focusrite rig.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

... an unexpected observation:

In the last setup (Pi400, Korg B2) the sample buffersize had been 64 at 48kHz, that I now changed temporarily to 128. I expected, that the latency increases just around 4.2 ms:

64 -> 3 * 1.3 ms = 3.9 ms
128 -> 3 * 2.7 ms = 8.1 ms
delta = 8.1 ms - 3.9 ms = 4.2 ms

But I measured a delta of 9 ms, which is more than double (21 ms in the following display minus 12 ms from my previous post):


https://i.postimg.cc/TwSm1Mmv/MIDI-to-Audio-latency-UM-1-SX-Pi400-64bit-Korg-B2-128samp.png


Could be the reason, why I usually prefer playing PIanoteq with smaller buffersizes like 64 - 96 at rates of 44.1 - 48 kHz.

Last edited by groovy (29-03-2021 10:35)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Interesting discussion. In doing quick by the ear comparisons using analog audio sent back into the piano, so that I hear both the piano internal sound and the Pianoteq sound, what makes a difference in latency for me is the host sample rate, which can be different than the internal sample rate even when "direct sampling without conversions" is used. I use a PI4 with sound via hdmi but once converted to analog sound latency is negligible. I would also speculate that some of the usb jitter could be due to the polled nature of usb 1 and 2. Don't know about usb 3.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Before I update to Pianoteq v7.2.1 and changes are possible (but unexpected) a short summary in a chart. Increasing the buffersize (64->96->128->192) increases the audio lag vs. the incoming MIDI byte linearly:

https://i.postimg.cc/Xq3WGR2z/MIDIvs-Audio-lag-Korg-B2-Pi400-Ptqv7-2-0.png

Although alsa is using 3 samplebuffers (README_LINUX.txt of Pianoteq) the tested example of a real system has a lag with factor 6.


PS: The samplebuffer 96 is an exception. While using 48000 Hz externally the internal samplerate was 32000 Hz. But I included it, because the internal rate just affects the performance index, not the latency.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

With the data from the previous posts (in this topic and the ones referenced), I've built some graphs. It seems that ALSA takes 3n the size of buffer (with n=1,2 or 3), depending on who knows (?). By the other hand, ASIO4all and the vendor's drivers show slopes between 2 and 3. Notice that except in the three trends lines I present, the slopes are calculaed based just with two points.

https://i.postimg.cc/x1XjHxrw/plot0.png
https://i.postimg.cc/qRqdVgk9/graph2.png

Last edited by marcos daniel (01-04-2021 05:09)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Hi Marcos,
nice to see some more data mining!

marcos daniel wrote:

It seems that ALSA takes 3n the size of buffer (with n=1,2 or 3), depending on who knows (?)

Don't know, but I can offer a hypothesis: Besides the alsa usbaudio driver (3 periods) the DAC-hardware itself could have a buffer of 3 periods, which would add up to 6 in this example (or multiple in other hardware).

From HIFI-DACs it is known, they often have big buffers, because break-free audiostreaming is the intention and not a very fast latency after pushing the play-button.

In the non-additive latency thread you can find an exception. The USB Scarlett 2i2 gen2 had been driven in SYNC mode there, which means just 2 periods instead of 3. The function I found there had been f(x) = 4.0x + 7.3, in other words the slope had been 4. If my hypothesis is true, the explanation would be:  2 periods in the alsa usb-driver plus 2 periods in the hardware DAC results in 4.

More common is the ASYNC mode today with an extra period (2+1=3).

It is not the best idea in my opinion to mix USB-Audiointerfaces with onboard-Audiointerfaces (PCI bus and others), because they have their own architecture and other drivers. Non-USB interfaces and their drivers usually have a flatter slope and a smaller static offset, because no USB-bus has to be passed. -

You wrote "(with n=1,2 or 3)". But it seems we just have evidence for 3n (with n=2 or 3) with ALSA USB at the moment -- or have I overseen something?

Last edited by groovy (01-04-2021 09:35)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

... an update with the Focusrite 2i2 gen2 on the Raspberry Pi 400:


https://i.postimg.cc/SskP10nh/MIDIvs-Audio-lag-Korg-B2-2i2gen2-Pi400-Ptqv7-2-1.png


Its trend line equation is f(x) = 6.1x + 3.3. Slightly lower latency, than the Korg B2 interface. Probably because the 2i2 gen2 supports the UAC2 standard and the B2 not.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

groovy wrote:

You wrote "(with n=1,2 or 3)". But it seems we just have evidence for 3n (with n=2 or 3) with ALSA USB at the moment -- or have I overseen something?

I took the green bar about 2 as 3, remember I made those lines with just two points... but you are right.

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

You are right too, when you take the bar labeled 'Gfast internal' into account.  I guess that was the internal / onboard codec of your 'generic Chinese laptop (i7 4710mq)'.

I just meant all the USB-Audiointerface combinations we both examined. With Alsa we just found 6x or 9x the buffer size represented by the slope -- but not one with 3x.

So it seems at the moment that the README_LINUX.txt of Pianoteq is not applicable to USB-Audiointerfaces:

"With the Alsa driver, the latency is 3 times the buffer size (a buffer of 64 samples at 44100Hz gives a latency of 4.3 ms)."

But more important: Should 3n (with n=2 or 3) be the rule for Alsa+USB -- what is the deeper reason? The more I meditate on it, the more I'm confused

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

... I have an idea, but I need to know one thing first:

How many samples are calculated by Pianoteq, before they are sent to the audiodriver?

I suppose 2 * 64 samples (= 128 samples), but is it true?


PS: Forgot to mention with setting Audio buffer size 64 samples in Pianoteq.

Last edited by groovy (09-04-2021 18:28)

Re: N00b with Pianoteq 6, a VPC1, a Surface Go, and a Focusrite Solo

Let me express it in other words. When the information about a new MIDI note arrives at the input of Pianoteq, how many buffersizes does Pianoteq compute, before the first (computed) sample appears at the input of the audiodriver?

Exactly one buffersize?
(for example when Audio buffer size is set to 64 in Pianoteq - does the first sample appear after the time 64/samplerate?)

Maybe only Modartt can answer that question, in the forum I found just the following interesting discussion:

https://forum.modartt.com/viewtopic.php...41#p951941

But not 100% clear there, if only one "BLOCK" is computed before send to Pianoteq's output.

Furthermore, does Pianoteq MIDI-input buffering? Is a timeperiod of MIDI events buffered, before they are processed? If so - how long?

Last edited by groovy (17-04-2021 11:08)