Topic: Pianoteq STILL Creates SLOW MIDI Files

UPDATED:

The Pianoteq standalone app generates MIDI recordings that are slow by about 1 second in 10 minutes. When Pianoteq is used as a VST instrument, there is no such problem.

A consequence of this problem is that I've been using the Pianoteq standalone app to generate music for my videos, and the sound gets progressively out of sync with my playing. I now use Pianoteq as a VST to generate the audio, which stays nicely synced with the video.

How do I know of this problem?

1) I used a stopwatch to time myself playing for exactly 10 minutes. I then used the stopwatch to time the playback, and it shows the playback to last 10 minutes 1 second. I've done this several times, being careful to push the stopwatch button exactly at the same time as the first (and last) note in the timed sequence, using some lead-up notes to rhythmically prepare myself for each.

2) I recorded a MIDI file simultaneously in the Pianoteq standalone app AND as a VST in Garageband, then used the standalone app to create audio recordings of both MIDI files, then imported the audio recordings into Garageband, synced up the first note, and observed that the recordings are out of sync at the end by about 1 second.

The problem is in the creation of the MIDI recording itself, not in the "export to audio file" feature.

-Jordan


---

ORIGINAL TOPIC: Video sync issues, Pianoteq plays and exports at ~99.7% speed

While making an upcoming video and editing in the audio from Pianoteq to match my finger movements, carefully lining up the sound to the first keypress, by the time the piece is finished the audio has gradually lagged behind by nearly a second. The audio seems slowed down by about 1 second in 6 minutes. It doesn't seem to be a video issue either, because when I make an audio recording at the same time as the Pianoteq recording and play them back, syncing up the beginning, they also gradually become out of sync, with the Pianoteq playback lagging behind the reality. 44.1khz vs 48khz makes no difference.

I'm using iMovie to edit; it could solve the problem if only it could slow down the video by less than 1%, but unfortunately it can't.

Does your Pianoteq behave this way? Try making an audio recording using a microphone (or your phone) to capture the live speaker output, then sync that up with the Pianoteq recording and see if it stays in sync, or if, like mine, Pianoteq plays back slow.

I'd greatly appreciate any help in getting an exact 100.0% speed Pianoteq recording. The only solution I can think of is a bad one: using another video editor and manually inserting 15-30 duplicate frames throughout.

Here's my last video where I show the Pianoteq interface (along with me playing), and the red-highlighted keys are in sync at the beginning but out of sync at the end, at which point the sound has lagged behind by about half a second.

https://youtu.be/P2c_Cb_531I

-Jordan

Last edited by Halley5 (18-06-2020 19:10)

Re: Pianoteq STILL Creates SLOW MIDI Files

So the first question is how long does the piece actually take to play ?

What you're doing is comparing iMovie's video timing with Pianoteq's audio timing.  The problem is that you've no actual timing of the piece independent of those to use as an absolute reference.

You need to establish a proper baseline measurement with a reliable stopwatch.  Don't rely on video timing to be right.  I'd go the other way - assume it's wrong, as it's the source of much grieve for many people.  Transcoding can also introduce of issues like this.

I'd also consider trying a different video editor.  Maybe Da Vinci Resolve which has a free version.

StephenG

Re: Pianoteq STILL Creates SLOW MIDI Files

Are you sure this isn't a case of your video going ever so slightly too fast?

Specifically: If your camera is set to shoot at 29.97 frames per second, but the footage gets treated as 30.00 frames per second by the editor, then you'd expect the video to drift ahead of any separately recorded audio by just about the amount you are seeing.

Edit:

The finished video does seem to have been exported @ 30FPS, so certainly worth checking what rate it was shot at.

Last edited by xooorx (30-04-2020 23:32)

Re: Pianoteq STILL Creates SLOW MIDI Files

xooorx wrote:

Are you sure this isn't a case of your video going ever so slightly too fast?

Specifically: If your camera is set to shoot at 29.97 frames per second, but the footage gets treated as 30.00 frames per second by the editor, then you'd expect the video to drift ahead of any separately recorded audio by just about the amount you are seeing.

Edit:

The finished video does seem to have been exported @ 30FPS, so certainly worth checking what rate it was shot at.

I second the theory that it's an issue with NTSC Drop Frame.

Spotify: https://open.spotify.com/artist/2xHiPcCsm29R12HX4eXd4J
Pianoteq Studio & Organteq
Casio GP300 & Custom organ console

Re: Pianoteq STILL Creates SLOW MIDI Files

No, this is a real thing, although I'm getting less of a slowdown than Jordan.  I've seen it mentioned a few times in this forum, each time followed by a strong hint that the OP has made a mistake.

What I did to test:
1. Record a piece and save as MIDI
2. Open the MIDI in Pianoteq (standalone) and render to .wav
3. Open the MIDI in Reaper DAW, add Pianoteq as a VST and render to .wav
4. Import the first .wav file into Reaper for comparison

Result: zooming in and checking that things line up to within 1 millisecond, everything is synchronised for the first note, and the VST-generated audio lines up perfectly with the MIDI.  But the two audio tracks don't line up with each other.  The one from stand-alone Pianoteq is longer than the MIDI.  The last MIDI note-on is at 12:24.215, and the corresponding peak in the audio is at 12:24.438.  It's a 0.03% discrepancy.  Scrolling through the MIDI file, I can see a gradual drift as the piece goes on.

No videos involved in this process, so don't blame the frame rate.

Easy solution for Jordan: don't slow down the video, speed up the audio instead! If you're not already using a DAW, then download Audacity (free software for any of Linux, Macintosh, Windows), open the audio file in Audacity and shrink it to the correct length.

Last edited by hanysz (01-05-2020 00:31)

Re: Pianoteq STILL Creates SLOW MIDI Files

hanysz wrote:

No, this is a real thing, although I'm getting less of a slowdown than Jordan.  I've seen it mentioned a few times in this forum, each time followed by a strong hint that the OP has made a mistake.

Hmmm... OK... I did some tests and yes I agree that there's a real thing: Pianoteq "Export to audio file" renders ever so slightly slow! It's losing about 20ms per minute here, same as what you are reporting.

I would guess (though I would no longer *bet*) that the majority of Jordan's drift is still down to 29.97 fps video being treated as 30.00 fps. But the discrepancy you are talking about: Yes, it's real. I'm looking at it right now.

My Test:
1. Generate a MIDI file that's just one note being played *exactly* once per second for a couple of minutes
2. Load it into pianoteq
3. Export to audio file
4. Look at the audio file

Re: Pianoteq STILL Creates SLOW MIDI Files

So, you have about a divergency of definitely some 0.03% or .3%!

Man, am I ever glad discrepancies were anyway discovered!

Last edited by Amen Ptah Ra (01-05-2020 05:45)
Pianoteq 8 Studio Bundle, Pearl malletSTATION EM1, Roland (DRUM SOUND MODULE TD-30, HandSonic 10, AX-1), Akai EWI USB, Yamaha DIGITAL PIANO P-95, M-Audio STUDIOPHILE BX5, Focusrite Saffire PRO 24 DSP.

Re: Pianoteq STILL Creates SLOW MIDI Files

Not sure if this is related to your problem but this article mentions issues related to different clocks being used by software and hardware in relation to MIDI, ASIO, etc..

Here's one section that caught my eye from that article :

A second set of MIDI timing problems arose due to PCs providing two different timers. Older versions of Windows, older MIDI interfaces, the VST and ASIO specifications, plus Cubase/Nuendo (and many other sequencers) normally rely on Windows' TGT (timeGetTime) timer, which apparently has a resolution of one millisecond. Meanwhile, some newer audio and MIDI interfaces, such as those with true DirectMusic drivers, plus some other sequencers, use the QPC (QueryPerformanceCounter) timer, which can theoretically be more precise (with a timestamp based on units of 0.1ms).

StephenG

Re: Pianoteq STILL Creates SLOW MIDI Files

My guess either variable (peak) framerate instead of constant framerate in your video editing software, drop frame rate in video camera (my mobile phone had this issue) or midi clock mismatch. Also in Powerdirector (for example) one can use 'sync by audio' instead of manual sync. Even when though you have this issue resolved I would think about line in to camcorder (if your camera has this feature). I now use line in after carefully finding the optimum levels, I hear no loss in quality this way and find the recording process better, easier and more natural. The days of syncing audio in video editing are gone for me!

Last edited by MeDorian (01-05-2020 16:12)

Re: Pianoteq STILL Creates SLOW MIDI Files

Halley5 wrote:

While making an upcoming video and editing in the audio from Pianoteq to match my finger movements, carefully lining up the sound to the first keypress, by the time the piece is finished the audio has gradually lagged behind by nearly a second. The audio seems slowed down by about 1 second in 6 minutes. It doesn't seem to be a video issue either, because when I make an audio recording at the same time as the Pianoteq recording and play them back, syncing up the beginning, they also gradually become out of sync, with the Pianoteq playback lagging behind the reality. 44.1khz vs 48khz makes no difference.

I'm using iMovie to edit; it could solve the problem if only it could slow down the video by less than 1%, but unfortunately it can't.

Does your Pianoteq behave this way? Try making an audio recording using a microphone (or your phone) to capture the live speaker output, then sync that up with the Pianoteq recording and see if it stays in sync, or if, like mine, Pianoteq plays back slow.

I'd greatly appreciate any help in getting an exact 100.0% speed Pianoteq recording. The only solution I can think of is a bad one: using another video editor and manually inserting 15-30 duplicate frames throughout.

Here's my last video where I show the Pianoteq interface (along with me playing), and the red-highlighted keys are in sync at the beginning but out of sync at the end, at which point the sound has lagged behind by about half a second.

https://youtu.be/P2c_Cb_531I

-Jordan

I do remember some time ago one video I made was slightly out of sync towards the end. Unlike my other videos, I had done some editing to the Pianoteq midi file using Midi Editor before rendering it and then syncing the audio in my video editing software.

My conclusion at the time was that the metronome in Pianoteq was (slightly) different to the Midi Editor metronome setting, I would not have changed this and to my knowledge would be the default 120 bpm but possibly some other tempo in Pianoteq.

This is the only time my videos had a sync issue. If in your case you have edited the midi file in some other software, then it might be worth checking Pianteq metronome settings and the midi editor metronome settings are both the same, both at 128bpm for example. Also even if the metronome sound is off, it is still active in the midi file.

Last edited by MeDorian (01-05-2020 23:19)

Re: Pianoteq STILL Creates SLOW MIDI Files

hanysz wrote:

No, this is a real thing, although I'm getting less of a slowdown than Jordan.  I've seen it mentioned a few times in this forum, each time followed by a strong hint that the OP has made a mistake.

What I did to test:
1. Record a piece and save as MIDI
2. Open the MIDI in Pianoteq (standalone) and render to .wav
3. Open the MIDI in Reaper DAW, add Pianoteq as a VST and render to .wav
4. Import the first .wav file into Reaper for comparison

Result: zooming in and checking that things line up to within 1 millisecond, everything is synchronised for the first note, and the VST-generated audio lines up perfectly with the MIDI.  But the two audio tracks don't line up with each other.  The one from stand-alone Pianoteq is longer than the MIDI.  The last MIDI note-on is at 12:24.215, and the corresponding peak in the audio is at 12:24.438.  It's a 0.03% discrepancy.  Scrolling through the MIDI file, I can see a gradual drift as the piece goes on.

No videos involved in this process, so don't blame the frame rate.

Easy solution for Jordan: don't slow down the video, speed up the audio instead! If you're not already using a DAW, then download Audacity (free software for any of Linux, Macintosh, Windows), open the audio file in Audacity and shrink it to the correct length.

This is really interesting, and video is one good way to draw attention to this. I've often looked at my videos and thought the sync was drifting but so slightly I put it down to my over analyzing. I also wondered if auto sync might be more centered and the beginning and ends out.

The syncing in video always seemed off to me and this was one of the reasons I changed over to line recording to video camera, it seemed more in sync, immediate.

Re: Pianoteq STILL Creates SLOW MIDI Files

I faced the same problem. I recorded video on Android at a speed of 60 frames per second. I was processing a video on Mac in Davinci. The sound was exported from Pianoteq from Ableton with different sampling rates - 44100, 48000 and 96000. When I added the soundtrack to Davinci, the tracks became different in length. The difference was small, but still! I tried editing the video in Final Cut and now I don’t notice any problems with the desync.

Re: Pianoteq STILL Creates SLOW MIDI Files

scherbakov.al wrote:

I faced the same problem. I recorded video on Android at a speed of 60 frames per second. I was processing a video on Mac in Davinci. The sound was exported from Pianoteq from Ableton with different sampling rates - 44100, 48000 and 96000. When I added the soundtrack to Davinci, the tracks became different in length. The difference was small, but still! I tried editing the video in Final Cut and now I don’t notice any problems with the desync.

Yes I noticed this also. Maybe exporting at 96000 or 19200 might solve this problem? I did use 19200 in my vids sometimes but was not looking for sync issues, just audio quality.

I was also thinking if a 96000 audio file was converted to a 48000 or 44100, do these files have different durations however small?

Re: Pianoteq STILL Creates SLOW MIDI Files

Looking through the information about the media object in the VLC-player, I noticed that the frame rate was something around 60.00367 per second.  And these decimal places were different for different videos.  Apparently video editors interpret the number and duration of frames differently.  And apparently with sound files a similar situation.

Last edited by scherbakov.al (02-05-2020 13:04)

Re: Pianoteq STILL Creates SLOW MIDI Files

Thanks scherbakov.al. Complex stuff! My recordings are filmed on my camcorder these days, 16 bit 48khz, I've not had any sync issues yet in video editing and rendering is usually done with AAC at 48khz, again no issues.

Re: Pianoteq STILL Creates SLOW MIDI Files

I have just made an hour long video to test my line recording. The video stayed 100% in sync throughout, after trimming and rendering still 100% in. Although I setup my camera and mixer to enable this some time ago, I payed no real attention to sync, I just thought it must be more lined up, and never thought that my old method of using rendered midi files were actually running slow!

It seems unless one can match 100% with the midi file, then the result will be as if the audio is from an entirely different source (and time) from the video performance. I'm able to achieve this without going to the trouble of rendering and syncing. I would recommend line recording over syncing rendered midi files, and I can't see (or hear) any benefit now for ever doing so again.

Re: Pianoteq STILL Creates SLOW MIDI Files

I think I've got to the bottom of "Export to audio file" running slow.

Pianoteq MIDI files specify a division of 960 ticks per quarter note, at a tempo of 500000 microseconds per quarter note.

So that should work out to 520.8333333 microseconds per tick.

But "Export to audio file" seems to be rendering the files at exactly 521.00 microseconds per tick: It's a rounding error!

This might seem a tiny difference but it's enough to drift noticeably out of sync with video within a few minutes, and to be just plain wrong a few minutes after that.

And if the exported audio ever gets mixed with a line recording then it's enough to cause phasing problems right from the start.

Re: Pianoteq STILL Creates SLOW MIDI Files

Thanks for the clear explanation!

Re: Pianoteq STILL Creates SLOW MIDI Files

Nice detective work xoooorx!  That lines up pretty well with my measurements.

It's worth noting that Pianoteq does the right thing when you run it as a VST instrument within a DAW.  The problem is only when you use Pianoteq's standalone export function.

Re: Pianoteq STILL Creates SLOW MIDI Files

xooorx wrote:

But "Export to audio file" seems to be rendering the files at exactly 521.00 microseconds per tick: It's a rounding error!

Good catch, xooorx, this is fixed in Pianoteq 6.7.1 !

Last edited by julien (05-05-2020 10:57)

Re: Pianoteq STILL Creates SLOW MIDI Files

My personal thanks go to Halley5, who seems to have gotten a ball rolling!

Thank you, man.

And julien, I appreciate your having fixed a title bar display of the new EQUALIZER.

Thank you.

Pianoteq 8 Studio Bundle, Pearl malletSTATION EM1, Roland (DRUM SOUND MODULE TD-30, HandSonic 10, AX-1), Akai EWI USB, Yamaha DIGITAL PIANO P-95, M-Audio STUDIOPHILE BX5, Focusrite Saffire PRO 24 DSP.

Re: Pianoteq STILL Creates SLOW MIDI Files

The problem is still there in version 6.7.1.

I used a digital stopwatch to time myself playing for exactly 10 minutes, and when I timed the playback from Pianoteq (without exporting to audio) I got an increase of 1 second. (Actual numbers: live playing: 9:59.96, playback: 10:01.00)

I made a video test which became gradually out of sync like before, and another test using Pianoteq as a VST in Garageband, which had no problems, stayed in sync, and passed my stopwatch test.

I appreciate the attention this issue is getting.

-Jordan

Re: Pianoteq STILL Creates SLOW MIDI Files

Most video codecs seem to be designed for 48kHz audio. I don't know all the technicalities, but I do know that matching audio recorded at other sampling rates can cause significant drift over time. In some video editors you can change the sampling rate of the video project, but things can get messy even then.

Also, different devices, be it a camera, an audio recorder, or a computer, can easily get out of sync from each other. Some cameras, and even audio recorders don't have great internal clocks.

Not sure what your particular issue is being caused by, so just throwing out some possibilities.

Re: Pianoteq STILL Creates SLOW MIDI Files

bump - original post updated at top

Re: Pianoteq STILL Creates SLOW MIDI Files

Halley5 wrote:

bump - original post updated at top

Thank you for your update.

NathanShirley wrote:

Most video codecs seem to be designed for 48kHz audio. I don't know all the technicalities, but I do know that matching audio recorded at other sampling rates can cause significant drift over time. In some video editors you can change the sampling rate of the video project, but things can get messy even then.

Also, different devices, be it a camera, an audio recorder, or a computer, can easily get out of sync from each other. Some cameras, and even audio recorders don't have great internal clocks.

Not sure what your particular issue is being caused by, so just throwing out some possibilities.

Some use something called SMPTE as a time code to align an audio file to a video.
Whenever your camera has it, you maybe may use it to align your video to also your MIDI.

Pianoteq 8 Studio Bundle, Pearl malletSTATION EM1, Roland (DRUM SOUND MODULE TD-30, HandSonic 10, AX-1), Akai EWI USB, Yamaha DIGITAL PIANO P-95, M-Audio STUDIOPHILE BX5, Focusrite Saffire PRO 24 DSP.

Re: Pianoteq STILL Creates SLOW MIDI Files

Halley5 wrote:

bump - original post updated at top

Are you sure both MIDI files have exactly the same tempo ? I can't reproduce that , I have recorded a very long midi sequence simultaneaously in Pianoteq 6.7.3, Garageband and Reaper, for 34 minutes, and they all are perfectly in sync when I import the Reaper and Pianoteq midi files in Garageband, and also when I import the wav file generated from Pianoteq in garageband.

Re: Pianoteq STILL Creates SLOW MIDI Files

I'm glad I'm not the only one who has had problems with this. I had a three hour recording. (Very long, I know) but by the end it had gotten over 6 minutes out of sync with both the video, and the original midi file.

Re: Pianoteq STILL Creates SLOW MIDI Files

Amen Ptah Ra wrote:

Some use something called SMPTE as a time code to align an audio file to a video.
Whenever your camera has it, you maybe may use it to align your video to also your MIDI.

Time code works when you chain two devices together while recording, but typically only professional gear can input/output time code.

I've recorded fairly long video along with Pianoteq without drift issues... but not 3 hours. Camera drift is VERY likely to happen after 3 hours, although 6 minutes is still huge. If everything else is correct I would suspect a sampling rate issue there (something other than 48 kHz). If you get your frame rate messed up in any way within your video editor you will get significant drift too.

Julien's idea would definitely be worth checking, I've accidentally bumped tempo without realizing it until trying to match exported audio to a video track. One second off in 10 minutes is quite a lot.

Last edited by NathanShirley (28-06-2020 07:00)

Re: Pianoteq STILL Creates SLOW MIDI Files

NathanShirley wrote:

If everything else is correct I would suspect a sampling rate issue there (something other than 48 kHz).

I have experienced that issue. Audio sample rate was 44.1 kHz. I suspected that something within the video-editing/video-exporting process (audio resampling within the app, working or target audio-video format or whatever) caused audio and video to get out of sync. Changed the separately recorded audio to 48 kHz and the audio and video remained in sync.

Last edited by Stephen_Doonan (28-06-2020 12:39)
--
Linux, Pianoteq Pro, Organteq

Re: Pianoteq STILL Creates SLOW MIDI Files

Haley5 wrote:

The problem is in the creation of the MIDI recording itself, not in the "export to audio file" feature.

Have you tried to run any tests with 5-pin MIDI DIN connectors along with a USB connection?  On macOS an older type serial connection might present more options to you than a newer USB one by itself does.

With my YAMAHA DIGITAL PIANO P-95 connected via 5-pin MIDI DIN connectors plugged directly into a MOTU Micro Lite (USB MIDI interface) I've got some which immediately I can check off the Yamaha Keyboard Properties window inside MIDI Studio of the Audio MIDI Setup on macOS.  They seem unavailable to direct MIDI device to computer connections made over only an attached USB cable alone.

MIDI Beat Clock and MIDI Time Code are additions available as properties I can check off that the keyboard transmits and receives, while General MIDI and MIDI Machine Control I can check off also but as features of the MIDI device whenever connected through 5-pin MIDI DIN connections.

Each of the designations show under Transmits and Features and has a check box so long as I'm making the adequate connections on MIDI serial cables with their MIDI DIN connectors.

I’m saying this to say that MIDI Beat Clock and MIDI Time Code, both available to anyone using 5-pin MIDI DIN connectors, also might alleviate some of the MIDI timing problems you experience.

Last edited by Amen Ptah Ra (03-07-2020 13:48)
Pianoteq 8 Studio Bundle, Pearl malletSTATION EM1, Roland (DRUM SOUND MODULE TD-30, HandSonic 10, AX-1), Akai EWI USB, Yamaha DIGITAL PIANO P-95, M-Audio STUDIOPHILE BX5, Focusrite Saffire PRO 24 DSP.

Re: Pianoteq STILL Creates SLOW MIDI Files

I wonder, if anyone will have any MIDI timing problems once MIDI 2.0 officially becomes introduced?

Pianoteq 8 Studio Bundle, Pearl malletSTATION EM1, Roland (DRUM SOUND MODULE TD-30, HandSonic 10, AX-1), Akai EWI USB, Yamaha DIGITAL PIANO P-95, M-Audio STUDIOPHILE BX5, Focusrite Saffire PRO 24 DSP.