Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.3.0] Internal Audio Latency vs MIDI Latency #570

Open
discohead opened this issue Dec 24, 2020 · 28 comments
Open

[1.3.0] Internal Audio Latency vs MIDI Latency #570

discohead opened this issue Dec 24, 2020 · 28 comments
Assignees
Labels
* bug
Milestone

Comments

@discohead
Copy link

@discohead discohead commented Dec 24, 2020

Steps to reproduce

  1. Play an internal sample and a MIDI note on the same step.
  2. Record both outputs into DAW
  3. Note that the internal sample is always recorded ~20ms after the MIDI triggered sound (when clocked at 120bpm)

Please describe the steps to reproduce the bug. Tell us what you noticed
happening and what you expected to happen instead.

I'm just triggering a sample and MIDI instrument on the same step and recording the output of the Tracker and the MIDI instrument on separate channels in Ableton. Tracker and Ableton are both slaved to an external clock from the Expert Sleepers FH-2. Using the MIDI clock sync delay I can shift the two signals around together and I can get one or the other on the grid, but the sample is always about 20ms later than the external hardware MIDI instrument.

Attachments and links

IMG_5169

sample_midi

Often the best way to show the problem is to record a short video,
attach the Tracker project you were working on, and provide links.

Pro-tip: You can drag and drop images and .zip files directly to the edit
box when writing your bug reports. Videos are too big as attachments, you
will have to use an external service for this and provide us links. Please
don't use services that delete files after short periods of time.

Other important information

  • How often does this bug happen? (every time, often, "it only happened once")
    every time
  • Does this bug happen in previous firmware versions?
    unsure
  • Does this bug happen in every project?
    yes
@discohead discohead added the bug label Dec 24, 2020
@discohead
Copy link
Author

@discohead discohead commented Dec 24, 2020

The external MIDI instrument and Tracker are both being recorded via my UA Apollo interface. As mentioned, master clock is an Expert Sleepers FH-2, both Tracker and Ableton are slaved to that clock. The Tracker MIDI note is converted to a trigger output on the FH-2 which is being used to gate some noise that goes directly to my audio interface. The Tracker output is also connected directly to my audio interface, the sample is a small click sound with no silence before the start point. Ableton live latency settings are...
image

@ambv
Copy link
Collaborator

@ambv ambv commented Dec 24, 2020

Did you try using a setting like -40.0 for latency compensation on Tracker?

@discohead
Copy link
Author

@discohead discohead commented Dec 24, 2020

@ambv Yes, but the Midi clock sync delay ultimately has no effect on this problem since the delay is applied equally to both the internal instrument and the midi instrument. Adjusting the delay shifts both events forward/backward in time but the internal sample is always recorded ~15-20ms late, relative to the midi instrument. My external clock tempo is 120bpm.

Also, I'm seeing the exact same difference in latency between internal vs midi instruments when using Tracker as the master clock as well.

It seems to me the Tracker's audio output is being emitted about ~20ms later than the Tracker's MIDI output for any given step (@ 120bpm).

Are you not able to reproduce the issue?

@discohead discohead changed the title [1.3.0b6] Internal Sample Latency vs MIDI Latency [1.3.0] Internal Sample Latency vs MIDI Latency Dec 25, 2020
@discohead discohead changed the title [1.3.0] Internal Sample Latency vs MIDI Latency [1.3.0] Internal Audio Latency vs MIDI Latency Dec 25, 2020
@shuler323 shuler323 self-assigned this Jan 4, 2021
@joe-chip-cyber
Copy link

@joe-chip-cyber joe-chip-cyber commented Jan 4, 2021

I am able to reproduce this issue easily using firmware v1.3.0, as well as each of the 1.3 beta releases.

Tracker audio output is always 15-20ms behind the audio coming from external midi gear that is being sent Note information from the Tracker.

This seems to be a latency issue with the Tracker audio output, and this can be shown by using micro-moves to delay the midi notes being sent to the outboard gear.

At a project tempo of 120, a micro-move value of ~15 on the Midi notes brings the Tracker audio and external gear audio output closer in sync.

Additional Repro information:

Tracker: Firmware v1.3.0, Clock in: Internal, Clock Out: MIDI Out jack
Outboard Midi Sound source: Moog Minitaur, connected to Tracker Midi Out
Audio Interface: Focusrite Scarlett 18i8
Audio Recording: Logic Pro X, recorded directly to two audio tracks

@ambv
Copy link
Collaborator

@ambv ambv commented Jan 6, 2021

@discohead as your image shows, your roundtrip audio latency is 17.8ms. Try shortening your audio buffer in Ableton Live and you'll see the audio latency decrease.

As for internal audio generation being late vs sent MIDI, it's a consequence of having audio buffered. We'll see what we can do about lining those up.

@ambv
Copy link
Collaborator

@ambv ambv commented Jan 6, 2021

@joe-chip-cyber is onto something with the MIDI micro-move lining things back up. We should maybe do this automatically.

@ambv
Copy link
Collaborator

@ambv ambv commented Jan 6, 2021

@discohead, @joe-chip-cyber: in the mean time in Ableton Live you can compensate this on a per-track basis manually:
Screenshot 2021-01-06 at 18 23 24

@joe-chip-cyber
Copy link

@joe-chip-cyber joe-chip-cyber commented Jan 7, 2021

Nice suggestion for per-track delay in Live, that's a clean way around.

Unfortunately Logic Pro X only allows this delay as a "region" setting for audio tracks (per-track is available on MIDI tracks, but this doesn't help me out, since I'm only dealing with the audio coming from Tracker and the other sources). The region delay does allow me to delay the playback of already-recorded audio, but the problem remains for live monitoring of the sound.

Thanks for checking this out @ambv! Look forward to any updates

@AlexNorinh
Copy link

@AlexNorinh AlexNorinh commented Jan 14, 2021

I appreciate this issue has been acknowledged as consequence of audio buffering; just posting to confirm I also experience sampled audio v midi latency differential

(1.3.0, digitone clock-slaved to tracker via MIDI. Internal or external midi sequences in sync, samples consistently off, no drift. I had the audio from digitone routed into tracker, so I was suspicious there may have been some audio processing lag going through the device, but when routed the other direction, yields the same result).

@NoraCodes
Copy link

@NoraCodes NoraCodes commented Jan 15, 2021

I'm curious: how does Line In passthrough interact with this? Is that audio buffered too? If so, please ensure the fix doesn't cause that opposite issue for the use-case of the Tracker as a middlebox between a synth being controlled over MIDI!

@ambv ambv added this to the 1.4 milestone Jan 19, 2021
@shuler323 shuler323 added the * label Jan 25, 2021
@bnckd
Copy link

@bnckd bnckd commented Jan 27, 2021

I'm having the same issue. The workaround here is the audio latency setting and not using the tracker for midi sequencing anymore, which is a pity, as I always need the mac plus ABL live on. But my real problem is that I would like to use it detached from the computer as a main hub and this is not working out at all after almost half a year, as audio still is always late. Kind of a bummer and I hope they'll do something about it, I wrote them several mails and also addressed this issue in a bug report regarding the external sync latency, but there has never been a word about internal sync audio latency. I wonder why nobody addresses that, it's not tight at all.

@bnckd
Copy link

@bnckd bnckd commented Jan 27, 2021

Ps: if it's the audio buffer I suppose this rather cannot be changed for the good?

@hubparticipant
Copy link

@hubparticipant hubparticipant commented Feb 2, 2021

This is a big problem. Is this being handled in the latest beta? 15-20ms is kind of a big deal

@hubparticipant
Copy link

@hubparticipant hubparticipant commented Feb 2, 2021

Ps: if it's the audio buffer I suppose this rather cannot be changed for the good?

If that is the case, a per track delay compensation is the only way to somewhat remedy this.
That being said, I think a fairly limited hardware sequencer as the Polyend Tracker should be nice and tight

@NoraCodes
Copy link

@NoraCodes NoraCodes commented Feb 2, 2021

This is a big problem. Is this being handled in the latest beta? 15-20ms is kind of a big deal

Ps: if it's the audio buffer I suppose this rather cannot be changed for the good?

If that is the case, a per track delay compensation is the only way to somewhat remedy this.
That being said, I think a fairly limited hardware sequencer as the Polyend Tracker should be nice and tight

I mean, the Tracker also does sampling, synthesis, effects... it's certainly not a dedicated MIDI sequencer. Also, while it may be very significant for you, it actually doesn't affect my use case at all - I think we should take such issues as something that is being worked on, and only buy the product if and when it fits your use case.

@bnckd
Copy link

@bnckd bnckd commented Feb 2, 2021

Ps: if it's the audio buffer I suppose this rather cannot be changed for the good?

If that is the case, a per track delay compensation is the only way to somewhat remedy this.
That being said, I think a fairly limited hardware sequencer as the Polyend Tracker should be nice and tight

already filed this here over a month ago ;) #573

@hubparticipant
Copy link

@hubparticipant hubparticipant commented Feb 2, 2021

The product is advertised as a an old school tracker. These are tight and accurate. That’s kind of the point of a tracker. Therefor sloppy timing is the last thing you’d expect.
It took me two days to find this information.
20 milliseconds is a big deal

@bnckd
Copy link

@bnckd bnckd commented Feb 2, 2021

This is a big problem. Is this being handled in the latest beta? 15-20ms is kind of a big deal

Ps: if it's the audio buffer I suppose this rather cannot be changed for the good?

If that is the case, a per track delay compensation is the only way to somewhat remedy this.
That being said, I think a fairly limited hardware sequencer as the Polyend Tracker should be nice and tight

I mean, the Tracker also does sampling, synthesis, effects... it's certainly not a dedicated MIDI sequencer. Also, while it may be very significant for you, it actually doesn't affect my use case at all - I think we should take such issues as something that is being worked on, and only buy the product if and when it fits your use case.

well, the use for most is probably that of a drummachine / sampler and besides being a nice scratchpad it is a superconvenient solution for live use, but: live you'd probably also have a dedicated synth or another drummachine or whatever else needs sync. and if the audio is always late, it definitely is a very significant issue, and to be honest: when i buy a product that belongs to the electronic side of the gear universe where sync / timing / quantization is one of the most important things (and imo not just something that can be worked on along the way...) i definitely expect it to work.

@gurkenkimchi
Copy link

@gurkenkimchi gurkenkimchi commented Feb 2, 2021

The product is advertised as a an old school tracker. These are tight and accurate. That’s kind of the point of a tracker. Therefor sloppy timing is the last thing you’d expect.
It took me two days to find this information.
20 milliseconds is a big deal

welp. even my old .mod/.it won't load properly. definitely not as described on the site.

@hubparticipant
Copy link

@hubparticipant hubparticipant commented Feb 2, 2021

The product is advertised as a an old school tracker. These are tight and accurate. That’s kind of the point of a tracker. Therefor sloppy timing is the last thing you’d expect.
It took me two days to find this information.
20 milliseconds is a big deal

welp. even my old .mod/.it won't load properly. definitely not as described on the site.

I don’t know what welp means.

Backwards compatibility can be a tricky thing.

The fact of the matter is that 20 milliseconds of latency is huge. And in 20 years I’ve never seen this with hardware gear. Ever.
MIDI drift, notes shifting around etc: yes. But 20ms of latency: never.

@hubparticipant
Copy link

@hubparticipant hubparticipant commented Feb 2, 2021

The product is advertised as a an old school tracker. These are tight and accurate. That’s kind of the point of a tracker. Therefor sloppy timing is the last thing you’d expect.
It took me two days to find this information.
20 milliseconds is a big deal

welp. even my old .mod/.it won't load properly. definitely not as described on the site.

I don’t know what welp means.

Backwards compatibility can be a tricky thing.

The fact of the matter is that 20 milliseconds of latency is huge. And in 20 years I’ve never seen this with hardware gear. Ever.
MIDI drift, notes shifting around etc: yes. But 20ms of latency: never.

It is one of the reasons people use hardware. To get no latency.
Squarepusher is probably the best example as he refuses to use software because of latency issues

@bnckd
Copy link

@bnckd bnckd commented Feb 2, 2021

The product is advertised as a an old school tracker. These are tight and accurate. That’s kind of the point of a tracker. Therefor sloppy timing is the last thing you’d expect.
It took me two days to find this information.
20 milliseconds is a big deal

welp. even my old .mod/.it won't load properly. definitely not as described on the site.

off topic, but i just had a jar of "oi kimchi" for breakfastlunch :D

@ambv
Copy link
Collaborator

@ambv ambv commented Feb 2, 2021

We have this problem on our radar. As I described elsewhere this is a complex issue that DAWs like Renoise and Ableton Live deal with in multiple ways.

If you're using Tracker as the master clock, essentially the question we're after is:

If you have "C-4 M01" on one track and "C-4 01" on another track during the same step, do they sound at the same time?

The answer here depends on many factors which is why we don't have this yet in Polyend Tracker. At this point you need to compensate latency on the MIDI receiver end. On that same picture above you see that the "MIDI Clock Master" section in Renoise also has an Offset slider. That slider isn't all that you need to consider.

  • If the MIDI out that you're sending to is a synth with zero latency, the "C-4 M01" note will sound sooner than "C-4 01" because Tracker's audio engine has some internal latency due to its audio buffer it needs for its synthesis engines, reverb, master limiter, and our hardware codec's "bass boost" and "space enhancer".
  • However, that synth might either have latency of its own, or it can be chained to a pedal or other processor that adds some latency of its own. So calculating this latency automatically isn't possible to figure out.
  • Better yet, the question arises: how are you listening to your external synth sequenced by Tracker? Are both Tracker and your external synth mixed by some other mixer or DAW? Or is the external synth's sound engine routed back to Tracker via its "Line In" audio input? In the latter case, the sound from the synth is additionally shifted by Tracker's audio buffer.
  • Finally, the kicker: what if you have more than one device connected to MIDI? "C-4 M01" (MIDI channel 1) might have different latency from "C-4 M02" (MIDI channel 2).

Again, is this a Polyend Tracker-specific problem? Nope. Let's see how Renoise solves this. First off, there's an "Offset" slider
for clock information, both master and slave:
Screenshot 2021-01-16 at 11 45 02

It's also got "automatic plugin delay compensation". It can do this because VST plugins report their latency to the VST host. Tracker works with hardware and this kind of reporting is impossible.
Screenshot 2021-01-16 at 11 59 48

On top of this, Renoise has an instrument-specific MIDI OUT latency setting:
Screenshot 2021-01-16 at 12 18 01

That's not all. To deal with the situation of audio from the external MIDI synth being routed back to Renoise, it's got a special mode in its #Line Input device:
Screenshot 2021-01-16 at 12 19 47


We are working on implementing the equivalent compensation on Tracker for the 1.4 firmware series. Our internal audio buffer is 128 samples long which at 44,100 Hz is 3ms. Sometimes we need additional buffer space but it should be nowhere near 20ms. We're still investigating this side of the story.

Once we're done implementing this, we'll make a video demonstrating what the measuring process is for us and how you can replicate this yourself.

@hubparticipant
Copy link

@hubparticipant hubparticipant commented Feb 2, 2021

Ableton Live is probably the worst to use as an example/standard as it has the worst MIDI timing and has many clock sync issues.
Renoise and Logic are solid.

Anyway, it is nice to read this is at least on your guys radar.

@NoraCodes
Copy link

@NoraCodes NoraCodes commented Feb 2, 2021

If the MIDI out that you're sending to is a synth with zero latency, the "C-4 M01" note will sound sooner than "C-4 01" because Tracker's audio engine has some internal latency due to its audio buffer it needs for its synthesis engines, reverb, master limiter, and our hardware codec's "bass boost" and "space enhancer".

I want to say, also, that this issue is largely mitigated by routing audio through the Tracker, which also allows that audio to be resampled easily and to apply Tracker's EQ to that audio, which is extremely useful. So while this is definitely an issue, there is somewhat of a workaround available.

@danapeks
Copy link

@danapeks danapeks commented Feb 5, 2021

Hi great to hear this is on your radar for v1.4! Just hooked up to an external drum machine and using the Tracker as master transport and clock am also getting around 20ms delay which makes aligning drums on the tracker and the Roland just slightly out. Thanks!

@bnckd
Copy link

@bnckd bnckd commented Feb 6, 2021

If the MIDI out that you're sending to is a synth with zero latency, the "C-4 M01" note will sound sooner than "C-4 01" because Tracker's audio engine has some internal latency due to its audio buffer it needs for its synthesis engines, reverb, master limiter, and our hardware codec's "bass boost" and "space enhancer".

I want to say, also, that this issue is largely mitigated by routing audio through the Tracker, which also allows that audio to be resampled easily and to apply Tracker's EQ to that audio, which is extremely useful. So while this is definitely an issue, there is somewhat of a workaround available.

if you mean workaround as in fixing it, then yes - if you mean workaround for now, then definitely no. there is no way to perfom in conjunction with other machines except you add a 500 euro erm multiclock.

@gminorcoles
Copy link

@gminorcoles gminorcoles commented Feb 11, 2021

I am researching known issues related to midi timing prior to purchasing the tracker because I want hardware sequencers to be tighter and more stable than what is achievable on the PC. I don’t think Renoise is a fair benchmark for latency and timing issues. An MPC 4000, Mc 909, Nerdseq, or other sequencer that has audio and midi processing, is fully featured, is a good benchmark.

as for raw audio buffer latency triggering samples, the Squarp rample, the rossum assimik8or are two sample players I can think of off the top of my head with 1ms audio playback latency or better. My PC gets latency of about 1 or 2 ms or even lower using the expert sleepers tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet