Awake77
Max Output Level: -90 dBFS
- Total Posts : 48
- Joined: 2005/01/16 18:27:05
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/04/30 00:08:57
(permalink)
.....
post edited by Awake77 - 2008/04/30 00:34:05
|
bapu
Max Output Level: 0 dBFS
- Total Posts : 86000
- Joined: 2006/11/25 21:23:28
- Location: Thousand Oaks, CA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 01:41:29
(permalink)
I followed Jose's method and found that my Tascam FW-1884 needed an offset of 30 samples. With Centrace @64 Samples Buffers I get about 4.78ms.
|
G7Sharp9
Max Output Level: -83 dBFS
- Total Posts : 390
- Joined: 2003/11/07 23:56:01
- Location: New Jersey
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 12:42:11
(permalink)
Not sure if this was mentioned, but I've encountered this before and I later found out (possibly thru this forum) that I had checked the "Record Cache" or something to that nature in the Audio Options dialogue. I uncheck it, and it completely cured the "timing" issues I was having, including the quantized MIDI ones. HTH Will
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 15:52:30
(permalink)
I thought I'd contribute one more observation to this whole mess: your offset correction will vary depending on your buffer size, sample rate and whether you're recording analog or S/PDIF. So just beware that even after you've calculated the offset, if you change any of those things you'll have to recalculate the offset again.
All else is in doubt, so this is the truth I cling to. My Stuff
|
brundlefly
Max Output Level: 0 dBFS
- Total Posts : 14250
- Joined: 2007/09/14 14:57:59
- Location: Manitou Spgs, Colorado
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 16:00:52
(permalink)
your offset correction will vary depending on your buffer size FWIW, this is certainly true of some interfaces/drivers, but not all. A fixed manual offset works perfectly for all buffer sizes with my 1820m.
SONAR Platinum x64, 2x MOTU 2408/PCIe-424 (24-bit, 48kHz) Win10, I7-6700K @ 4.0GHz, 24GB DDR4, 2TB HDD, 32GB SSD Cache, GeForce GTX 750Ti, 2x 24" 16:10 IPS Monitors
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 16:03:27
(permalink)
How about analog versus S/PDIF?
All else is in doubt, so this is the truth I cling to. My Stuff
|
bapu
Max Output Level: 0 dBFS
- Total Posts : 86000
- Joined: 2006/11/25 21:23:28
- Location: Thousand Oaks, CA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 16:05:58
(permalink)
A fixed manual offset What is your offset? Relatively small? Did you have big problems before you set the offset?
|
bapu
Max Output Level: 0 dBFS
- Total Posts : 86000
- Joined: 2006/11/25 21:23:28
- Location: Thousand Oaks, CA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 16:08:20
(permalink)
bitflipper, I asked this in the techniques forum but did not get an answer. Is Centrace's latency an actual round trip latency? I assume so, but looking for confirmation.
|
brundlefly
Max Output Level: 0 dBFS
- Total Posts : 14250
- Joined: 2007/09/14 14:57:59
- Location: Manitou Spgs, Colorado
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 16:17:01
(permalink)
Is Centrace's latency an actual round trip latency? I assume so, but looking for confirmation. Yes, it's the full round trip for whatever return path you make available - whether it's an analog patch, or an all-digital software loopback using the mixer applet (bypassing the D/A and A/D conversions).
SONAR Platinum x64, 2x MOTU 2408/PCIe-424 (24-bit, 48kHz) Win10, I7-6700K @ 4.0GHz, 24GB DDR4, 2TB HDD, 32GB SSD Cache, GeForce GTX 750Ti, 2x 24" 16:10 IPS Monitors
|
Jose7822
Max Output Level: 0 dBFS
- Total Posts : 10031
- Joined: 2005/11/07 18:59:54
- Location: United States
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/03 22:19:06
(permalink)
ORIGINAL: bitflipper How about analog versus S/PDIF? Yes, Analog and Digital will obviously have different offset since digital I/Os don't go through the AD/DA process. But, as brundlefly stated, the manual offset works on different buffer sizes. I believe it also works on different sample rates since Sonar compensates for it but I'm not possitive about this. Take care!
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/04 09:44:42
(permalink)
I did a different kind of timing test, measuring the lag between executing a MIDI ON event and the start of a recorded wave from an external synth. This is different from a round-trip latency test, because it doesn't involve any playback processing or D/A conversion. It's also very easy to do. In the following screenshot, the vertical line is the Now marker, which has been set to the start of the MIDI note. You can see that each recorded wave lags the MIDI note by a different amount. The only difference is the ASIO buffer size and whether the selected input is analog or digital. The ASIO offset has been set to zero for this test so there is no compensation. Latencies are expressed in samples, e.g. "lat=122" means a 122-sample lag time. Multiply that by .0227 to get real time in milliseconds (1 sample = 22.7us at 44.1KHz). As you can see, S/PDIF is faster, in some cases by as much as 3ms. That amount of difference surprised me at first (I was expecting about 1ms difference) until I realized that the digital path not only avoids the A/D conversion, it also avoids the D/A conversion within the synthesizer. Another surprise is that the lag time is not directly proportional to buffer size. The delay is reduced as buffers are reduced, but not in a linear fashion. Under about 128 the benefit from buffer reduction reverses and lag times begin to increase. On my system, the optimal buffer size was 256 samples. Surprise #3: note the frozen soft synth, which is actually ahead of the MIDI note by 47 samples.
post edited by bitflipper - 2008/07/04 10:11:01
All else is in doubt, so this is the truth I cling to. My Stuff
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/04 16:24:53
(permalink)
I'd be very curious if anyone else did a similar test and got other/same results, especially any RME users. My worst-case scenario (1024 buffer, analog input) had a 7.5ms lag - long enough to be a problem with short-attack instruments. I wonder if other brands of interfaces have less of this problem. Jose?
All else is in doubt, so this is the truth I cling to. My Stuff
|
Jose7822
Max Output Level: 0 dBFS
- Total Posts : 10031
- Joined: 2005/11/07 18:59:54
- Location: United States
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/04 23:16:01
(permalink)
ORIGINAL: bitflipper I'd be very curious if anyone else did a similar test and got other/same results, especially any RME users. My worst-case scenario (1024 buffer, analog input) had a 7.5ms lag - long enough to be a problem with short-attack instruments. I wonder if other brands of interfaces have less of this problem. Jose? That's actually a MIDI latency test which was extensively discussed in the MIDI Jitter thread. You know I would test this out for you but I sold my Roland XP synth some time ago in order to get my current MIDI controller (a Studio Logic VMK-188 Plus), so I won't be able to perform this test :-( I personally haven't read the whole 'MIDI Jitter thread' myself but I'm sure it will help you find an answer. Happy 4th of July!!!
|
timidi
Max Output Level: -21 dBFS
- Total Posts : 5449
- Joined: 2006/04/11 12:55:15
- Location: SE Florida
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 00:37:15
(permalink)
Bit. I get basically the same results. However, being that you have midi in the soup, I don't think you are getting an accurate audio only latency reading. Actually I'd say you're getting pretty good results. what is your midi interface? I also noticed the TTS synth bounces midi to audio early. I found Battery to be dead on. and, don't remember the rest.
|
AndyW
Max Output Level: -45.5 dBFS
- Total Posts : 2956
- Joined: 2005/10/06 17:13:00
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 01:41:18
(permalink)
ORIGINAL: Jose7822 ORIGINAL: DH123 743 samples!!!!!! GRRRRHHHHHH!!!! Time to redo some parts . . . CRAP! This changes everytime I change my buffer size? Yeah, I believe it does, specially if you're using WDM since it doesn't have latency compensation like ASIO. Just calculate the buffer size(s) you use for recording and write it down somewhere. Input the one you need in the buffers offset box and you're done. You don't need to calculate all of them since this doesn't apply to playback. HTH Interesting...I just tried it at a buffer size of 128 and 1024 and the offset was -65 both times. I thought it should be the same for every one...so do I need t ogo back and get a number for every buffer size to put in manual offset? Wow...changing buffer size is now going to be a chore if so...although those are the two i use 95% of the time so may be it's OK. I am using ASIO BTW and did notice the ASIO reported latency changed. I am going to have to experiment...
|
brundlefly
Max Output Level: 0 dBFS
- Total Posts : 14250
- Joined: 2007/09/14 14:57:59
- Location: Manitou Spgs, Colorado
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 12:27:48
(permalink)
Latencies are expressed in samples, e.g. "lat=122" means a 122-sample lag time. Multiply that by .0227 to get real time in milliseconds (1 sample = 22.7us at 44.1KHz). FWIW, I find it easier to just divide by 44.1, rather than having to memorize the inverse value. As you can see, S/PDIF is faster, in some cases by as much as 3ms. That amount of difference surprised me at first (I was expecting about 1ms difference) until I realized that the digital path not only avoids the A/D conversion, it also avoids the D/A conversion within the synthesizer. With my 1820m, the difference between analog and ADAT latency is 89 samples at 48kHz, which I think is more typical, as D/A and A/D conversion usually add about 1ms each way. Another surprise is that the lag time is not directly proportional to buffer size. The delay is reduced as buffers are reduced, but not in a linear fashion. This is because there are components of latency that are fixed, so the percentage contribution of buffer latency to total latency decreases as the buffer size decreases. Under about 128 the benefit from buffer reduction reverses and lag times begin to increase. On my system, the optimal buffer size was 256 samples. This is a little weird. Due to the fixed components of latency, the percentage improvement from lowering the buffer size will decrease as you get to the low end of the scale, but there should still be an improvement (decrease) in total latency with each derease in buffer size. Are you saying your total latency actually goes up when you go below a 256-sample buffer? Surprise #3: note the frozen soft synth, which is actually ahead of the MIDI note by 47 samples. For a properly written soft synth, the alignment of MIDI and frozen/bounced audio should be perfect, assuming you can accurately locate the beginning of the audio transient. TTS-1 has been shown to have a little trouble in this area. And some soft synths deliberately "humanize" the timing of sample output. The test VSTi, Twonar, that Noel Borthwick shared with us back during the MIDI Jitter thread renders right on the money.
SONAR Platinum x64, 2x MOTU 2408/PCIe-424 (24-bit, 48kHz) Win10, I7-6700K @ 4.0GHz, 24GB DDR4, 2TB HDD, 32GB SSD Cache, GeForce GTX 750Ti, 2x 24" 16:10 IPS Monitors
|
brundlefly
Max Output Level: 0 dBFS
- Total Posts : 14250
- Joined: 2007/09/14 14:57:59
- Location: Manitou Spgs, Colorado
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 12:44:34
(permalink)
I'd be very curious if anyone else did a similar test and got other/same results, especially any RME users. My worst-case scenario (1024 buffer, analog input) had a 7.5ms lag - long enough to be a problem with short-attack instruments. I wonder if other brands of interfaces have less of this problem. I've share some results of this kind of testing in a number of other threads you may have seen. Basically what I found is that if your audio latency compensation is set up and working correctly, any variation in lag can be attributed to the variable transmission delay and response time of different MIDI interfaces and hardware synths. I found my slowest hardware synth (E-mu UltraProteus) required an additional 6ms or so of compensation on top of the 1-2ms MIDI transmission delay, while others needed only 1 or 2 milliseconds more. I also found that real-time recording of soft synths by digital loopback required a couple milliseconds additional compensation to account for a MIDI transmission/processing delay between the input echoed MIDI track and the soft synth. In other words, it took just as long (maybe even a hair longer) to echo MIDI to a soft synth as it took to echo it out a physical port.
SONAR Platinum x64, 2x MOTU 2408/PCIe-424 (24-bit, 48kHz) Win10, I7-6700K @ 4.0GHz, 24GB DDR4, 2TB HDD, 32GB SSD Cache, GeForce GTX 750Ti, 2x 24" 16:10 IPS Monitors
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 14:32:00
(permalink)
Bit. I get basically the same results. However, being that you have midi in the soup, I don't think you are getting an accurate audio only latency reading. Actually I'd say you're getting pretty good results. what is your midi interface? I also noticed the TTS synth bounces midi to audio early. I found Battery to be dead on. and, don't remember the rest. Yeh, the whole purpose of the test was to put "midi in the mix", since it's mainly what I do - record MIDI, edit, then commit the MIDI to audio by recording external synths. Some synths come in via S/PDIF, others analog. That's why it was disturbing that the lag was so different from one to another. And the latency was significantly longer than the previously-entered offset that had been calculated with a standard loopback test. Consequently, it appears that I need different offsets depending on whether I'm recording an internal soft synth, external synth via analog, external via S/PDIF, or from a microphone. And that's assuming I don't raise buffers for CPU-intensive projects. The interface is a MOTU 828MkII. The TTS-1 coming in 47 samples early was kind of weird, so I tested some others (mostly drum modules for consistency, since the test wave was a sidestick hit) and measured these delays: Session Drummer: 3 samples DFH2: 114 samples Addictive Drums: 5 samples Dimension LE: 67 samples Jamstix2: the only one that was 100% dead-on accurate That's actually a MIDI latency test which was extensively discussed in the MIDI Jitter thread. Jose, I didn't read that MIDI Jitter thread at the time because I wasn't concerned with jitter. I did, however go back and read that thread. There was the normal mixture of inaccuracies, speculation and solid information. The most oft-repeated mistake was confusing jitter with latency. This isn't really jitter, which tends to be small, variable timing fluctuations - it will rarely be consistent and it will never be in the multi-millisecond range. This test apparently shows the effects of a combination of MIDI latency and ASIO buffer latency. If it was just MIDI latency, the numbers wouldn't change when the ASIO buffer size was adjusted. I accept that there are MIDI timing limitations. At 960 ticks per measure, the maximum resolution at 120bpm is only 2.1ms (120/60= 2sec, divided by 960 = 0.00208). But what I saw was not a sub-millisecond lag, but a rather long delay of up to 7.5ms (plenty long enough to cause problems), which would be the equivalent of 3.5 ticks. That seems beyond the realm of "jitter", but I could be wrong about that. Current theory: I am wondering now if this is a result of firewire buffering. Obviously, you can't send a separate FW (or USB) packet for every MIDI event. Since you'll never accumulate enough data to properly fill the FW transmit buffer, that means sending FW packets every 0.00XXXX seconds regardless of how much data you have to send. If this theory is correct, then folks using PCI MIDI interfaces should see much better results than my test.
post edited by bitflipper - 2008/07/05 15:23:44
All else is in doubt, so this is the truth I cling to. My Stuff
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 14:34:11
(permalink)
I found my slowest hardware synth (E-mu UltraProteus) required an additional 6ms or so of compensation on top of the 1-2ms MIDI transmission delay, while others needed only 1 or 2 milliseconds more. So you're saying the lag time is mostly latency within the synthesizer itself? That kind of makes sense - although nobody ever seems to think about latency in a hardware device, you know it has to exist. I'm just surprised it's that slow.
All else is in doubt, so this is the truth I cling to. My Stuff
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 15:01:10
(permalink)
For a properly written soft synth, the alignment of MIDI and frozen/bounced audio should be perfect Yeh, you'd think so. However, in my tests I only got one soft synth to yield dead-on accurate timing: Jamstix.
All else is in doubt, so this is the truth I cling to. My Stuff
|
Jim Wright
Max Output Level: -66 dBFS
- Total Posts : 1218
- Joined: 2004/01/15 15:30:34
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 20:01:17
(permalink)
Hi Bitflipper At 960 ticks per measure, the maximum resolution at 120bpm is only 2.1ms Actually, it's 960 ticks per quarter note, not per measure. At 120 bpm, that's 500 millliseconds/quarter note; 500/960 gives a MIDI resolution of about 0.52 milliseconds. Internally, Sonar can use 'hi-res ticks', which are 960 * 2^16 ppqn, if memory serves - that gives sub-microsecond accuracy, in theory. (At least, the MFX APIs support that kind of timing). I am wondering now if this is a result of firewire buffering. Obviously, you can't send a separate FW (or USB) packet for every MIDI event. Firewire MIDI uses isochronous packets (same basic packet type as for audio: a subtype of "Common Isochronous Packets"). The basic packet rate is 8KHz (1 packet every 125 microseconds) . Firewire bandwidth of MIDI is reserved, which means that other traffic cannot 'bump' MIDI traffic (which would cause jitter). This would theoretically support high-speed MIDI (e.g. 8KByte/second of MIDI data, rather than the 3KB/sec afforded by MIDI-DIN connections). However, for compatibility with MIDI-DIN interfaces, Firewire MIDI is rate-limited to 3KB /sec. Firewire MIDI and 'MIDI-DIN" have very similar jitter and "MIDI logjam" behavior, by design. (Firewire MIDI often has somewhat higher latency (w.r.t. a PC sequencer), due to the overhead of the Firewire stack). USB MIDI is designed differently. First, it uses asynch packets, sent at background priority. This means MIDI packets can get bumped by other USB traffic (audio, disk transfer, etc.). Second, USB MIDI is not rate-limited. This reduces "MIDI logjam" smearing when lots of MIDI data is sent, and also makes Sysex dumps faster. However, it's quite possible to overload a USB-to-MIDI DIN output port (by sending more than 3KB/sec of MIDI data to the port. With USB 1.0, the USB 'heartbeat rate' is 1K, which means all MIDI data has at least 1 msec jitter (of course, it's usually more). I'm told USB 2.0 supports a faster packet rate, which in theory should allow jitter to be reduced. In practice, good PCI MIDI interfaces have the least jitter, followed by good Firewire interfaces, with USB interfaces exhibiting the most jitter. A good USB MIDI interface probably has 1-2 msec peak jitter (but that's just what I recall from recent published measurements). A bad USB MIDI interface .... you don't wanna know....... Of course, a badly designed PCI or Firewire MIDI interface will also exhibit lots of jitter, but the worst interfaces I've personally seen have been 'budget' USB interfaces. (I do use an Edirol UM-550 and EMU 0404 USB interface for various things, but use Emu 1820M PCI MIDI ports for critical recording). As for hardware synth latency - Jim Aiken did a Keyboard article on this back in July 1996. Jitter (for individual cowbell hits ) was in the range of 0.4 - 2.0 milliseconds, with latency ranging from 0.3 milliseconds (pretty good) to 1.5 milliseconds). This was for a number of Alesis, Ensoniq, Korg, Roland, Yamaha and Kurzweil modules. Under load (with a 6 note chord on beats 2 and 4), MIDI logjam effects were measured (the cowbell hit, 1 tick after beats 2 and 4, was delayed by the MIDI transmission time for 6 full Note On messages (~6 msec) - sometimes more). HTH, Jim
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/05 22:27:50
(permalink)
Actually, it's 960 ticks per quarter note, not per measure. Ah, right you are. Thanks for that information. Also thanks for blowing a hole in my "it's firewire's fault" theory. If a MIDI packet doesn't take longer than 125us to arrive, then it's unlikely that the communication channel contributes significantly to my 7.5ms latency. That got me to wondering about the MIDI connection between my interface and synth. That's old-style DIN at 38.4kb/s. But no, that's still a potential MIDI note every 26us - plenty fast, and it's a plain old no-waiting FIFO serial connection. The Keyboard article you mentioned suggests a maximum latency in the synth of 1.5ms, still too short to account for my 7.5ms latency. 0.3 to 1.5ms sounds quite reasonable for a synth, and given the age of the article I'd assume that my 4-year-old Yamaha synth has a much faster processor than anything on the market in 1996. (The phrase "jitter...was in the range 0.4 - 2.0 milliseconds" - was that a typo? Surely jitter couldn't really reach over 1000% ??? ). So three mysteries remain unsolved: why the latency is so long, why it varies with the size of the ASIO buffers, and why it varies so much between analog and S/PDIF inputs?
All else is in doubt, so this is the truth I cling to. My Stuff
|
evansmalley
Max Output Level: -76 dBFS
- Total Posts : 715
- Joined: 2005/06/07 08:25:15
- Location: Kansas City, MO, USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/06 10:11:04
(permalink)
nice post, Jim. Thanks! I can definitely hear out of groove-ness that results from just a few milliseconds... after ping-testing and moving my tracks by the right amount there's absolutely no comparison to how "musical" it feels when it's right on! This is an important issue in the real function of recording music in Sonar I think- thanks for all the research you's guys are doing on it- Ev www.evanandnature.net
|
brundlefly
Max Output Level: 0 dBFS
- Total Posts : 14250
- Joined: 2007/09/14 14:57:59
- Location: Manitou Spgs, Colorado
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/06 12:20:17
(permalink)
So three mysteries remain unsolved: why the latency is so long, why it varies with the size of the ASIO buffers, and why it varies so much between analog and S/PDIF inputs? First , just to clarify, are you talking about the difference between the note-on time of a pre-existing MIDI event, and the beginning of the audio transient that is recorded as analog input coming back form the Yamaha? The difference between analog and S/PDIF is not surprising; you're eliminating both D/A conversion of the synth's output, and A/D conversion at the interface, this is going to be worth at least 2ms, and with Firewire buffering, maybe a little more. Then you've got response time of the synth, which is probably going to be a minimum of 1ms, and could easily be more. Then you've got the one-way MIDI transmission time, which is generally on the order of 1-2ms. So if all these latencies are typical, you could easily be seeing 4-5ms "lag" between pre-recorded MIDI and analog audio from a hardware synth even if the analog input latency is compensated. Throw in a another .5 millisecond here and there for a slightly longer MIDI transmission time or slightly slower synth response or D/A conversion, and 6-7ms is not too surprising.
SONAR Platinum x64, 2x MOTU 2408/PCIe-424 (24-bit, 48kHz) Win10, I7-6700K @ 4.0GHz, 24GB DDR4, 2TB HDD, 32GB SSD Cache, GeForce GTX 750Ti, 2x 24" 16:10 IPS Monitors
|
Jim Wright
Max Output Level: -66 dBFS
- Total Posts : 1218
- Joined: 2004/01/15 15:30:34
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/06 19:45:43
(permalink)
ORIGINAL: bitflipper That's old-style DIN at 38.4kb/s. But no, that's still a potential MIDI note every 26us Actually, old-style DIN is 31.25kb/s (because the UART used in most early MIDI interfaces was a Motorola 6850, with max clock rate of 500 KHz and a clock divisor of 16, in case you're curious). And, given the that a MIDI note typically takes 3 MIDI bytes (2 when running status is used) -- at full capacity, a MIDI-DIN stream can send one note every 960 microseconds (320 microseconds per MIDI-DIN byte). Of course, if you're not sending MIDI at full capacity, notes can be placed more accurately than 960 microseconds. It was pretty easy (with 1980's technology) to schedule notes with jitter of one MIDI byte-time (320 microseconds timing accuracy, yielding jitter of +/- 160 microseconds). With some effort, I believe it was possible to schedule MIDI bytes with MIDI-DIN bit-time accuracy (32 microseconds, given the 10-bit frame used for the MIDI-DIN protocol). Curiously, the use of running-status can actually increase jitter! If a MIDI note message sometimes takes 2 MIDI-bytes, and sometimes takes 3 -- it's harder to schedule dispatching a MIDI byte at 'just the right time', so that a complete MIDI note message is received when desired. (The phrase "jitter...was in the range 0.4 - 2.0 milliseconds" - was that a typo? Surely jitter couldn't really reach over 1000% ??? ). Nope, not a typo. It depends on when the complete MIDI message happens to hit within the internal processing loop of a given synth module. Some earlier synth modules were notoriously bad (10 msec jitter, or worse). Then again, some early USB MIDI interfaces exhibited jitter of 7-10 msec -- even more when the same USB 1.1 port was sending both audio and MIDI traffic. To put things in perspective, the generally-recommended guideline for musically-acceptable realtime system performance (e.g. from pressing a controller key to the moment that a loudspeaker starts producing the corresponding note) is 10 msec latency max with +/-1 msec jitter max. Lower is better, of course. CNMAT (Center for New Music and Audio Technology) first stated those guidelines in the 90's, I think, but a number of folks within the computer-music community have endorsed them (including me). Sadly, a lot of MIDI systems don't meet those guidelines. The MMA does not endorse those guidelines, btw -- there are no official MMA guidelines relating to laten The Keyboard article you mentioned suggests a maximum latency in the synth of 1.5ms, still too short to account for my 7.5ms latency and jitter, because there is no manufacturer consensus about what those values should be. I'm not sure exactly what you were measuring -- could you describe your test setup again briefly? It's pretty easy to check the latency of an external synth, by the way (if you have a MIDI thru box and are willing to do a bit of soldering). Take one MIDI Out circuit, and tack-solder a resistor onto the output pin of the opto-isolator (a 2.2Kohm value works well). Connect an audio jack to the resistor (and the ground pin of the opto-isolator) -- this should give you a pulse wave of around 1-2 volts amplitude, with a base frequency of about 16K. Then connect things like this: DAW MIDI output -> MIDI Thru box IN MIDI Thru box Out A (with resistor tap) -> DAW Audio IN 1 MIDI Thru box Out B -> Synth module MIDI IN Synth module Audio Out -> DAW Audio In 2 DAW Audio IN 1 should capture the MIDI pulse train, while DAW Audio IN 2 should capture the synth output. Once this is working, you can measure the latency between the MIDI messages (short analog signal bursts) and the start of the synth module note. (use a synth module program with a very percussive attack for best results). - Jim
|
ben00net
Max Output Level: -90 dBFS
- Total Posts : 16
- Joined: 2008/05/25 00:36:16
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/07 09:44:05
(permalink)
woohoo - awesome post regarding the manual offset tip!! mine was out of whack by 365 samples. I've been working on a track with a few guitar parts in it and each track the timing was out (and i thought i was too drunk as well!) - turns out it was Sonar. And yes - the metronome sucks.
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/07 11:56:03
(permalink)
First , just to clarify, are you talking about the difference between the note-on time of a pre-existing MIDI event, and the beginning of the audio transient that is recorded as analog input coming back form the Yamaha? Exactly. Your explanation for the difference between analog and S/PDIF makes perfect sense. I just don't understand why the difference isn't consistent, or why it varies with the ASIO buffer size. Buffer size Analog lag S/PDIF lag Difference 1024 7.5ms 4.5ms 3ms (40% faster) 256 5.4ms 4.0ms 1.4ms (26% faster) 128 4.3ms 3.3ms 1ms (23% faster)
I would have expected the differences to be more consistent. I wouldn't obsess over it except it complicates my tidy world. It means my ASIO offset value has to change depending on whether I'm recording a synth via analog or S/PDIF and what my buffer size is. Furthermore, the offset for recording straight audio is a different number altogether. I've had to make up a chart! Thanks for lending your brain to my puzzle, Dave.
All else is in doubt, so this is the truth I cling to. My Stuff
|
bitflipper
01100010 01101001 01110100 01100110 01101100 01101
- Total Posts : 26036
- Joined: 2006/09/17 11:23:23
- Location: Everett, WA USA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/07 12:21:48
(permalink)
Jim, thanks again for the excellent information. I've been recording MIDI for many years, since Cakewalk 1.0, and never realized how sloppy MIDI is. But then, back in CW 1.0 days it was all MIDI, no computer-based synthesizers - so timing issues would have been irrelevant. It's only a problem when you're trying to sync up external and internal synths. My test "setup" was crude - no setup at all other than a synth plugged in to an interface. 1. I manually created a 16-note MIDI track via the PRV so that each note would be precisely quantized (grid snap "magnetic strength" set to 100%) 2. Recorded a synth (Yamaha MO8) being triggered from that MIDI track 3. Set the Now marker to exactly on a MIDI note in the PRV 4. Noted the sample number at that point (after setting the clock display to show samples) 5. Zoomed in on the recorded waveform until I could see individual samples 6. Changed the grid snap resolution to 1 sample and moved the Now marker to the start of the first sample (I used a percussive patch so there'd be a quick rise at the start so the beginning of the sample would be unambiguous) 7. I simply subtracted the reference sample number from that of the wave start to calculate the lag time I then repeated the test with different ASIO buffer sizes and different synths. The worst-case scenario (that was tested, anyway) was recording analog with a fairly large buffer (1024). Even software synthesizers had issues, with the TTS-1 actually arriving 47 samples premature. The only soft synth that managed to nail the timing exactly was Jamstix.
All else is in doubt, so this is the truth I cling to. My Stuff
|
jim y
Max Output Level: -76 dBFS
- Total Posts : 721
- Joined: 2003/11/08 13:16:43
- Location: The Middle of Wales.
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/07 12:29:16
(permalink)
They do make sense I think if your interface has another significant constant delay from fixed additional buffers apart from the converters - either the communication bus or a dsp in the interface - that will also affect the s/pdif and create the same impression of diminishing returns from a lower buffer size. I would expect that once the buffer delay is less than the additional delays - the reduction would become negligible in its effect on the the total delay. I think you might more easily quantify the additional delays by also trying different sample-rates. Fixed additional buffers will normally cause half as much delay when the rate is doubled - compare that with the delay obtained with the original sample-rate but half the driver buffer. That may not be possible for s/pdif though, if your synths s/pdif cannot do at least 2 rates that differ by a factor of 2. Jim
Yes, I know it's upside down.
|
bapu
Max Output Level: 0 dBFS
- Total Posts : 86000
- Joined: 2006/11/25 21:23:28
- Location: Thousand Oaks, CA
- Status: offline
RE: WTF, what's with my timing?: SOLVED
2008/07/07 14:27:52
(permalink)
To get back on Audio-only topic for a moment. I have the Tascam FW-1884 with 8 mic inputs. Eventually I want to add another 8 channel preamp with lightpipe (patched into the FW-1884 ADAT-In). Will that introduce a secondary calculated latency different than the FW-1884? Should I consider another Firewire 8 mic preamp or will that even present it's own problems? BTW, I understood that once the sample offset was calculated it would not need to be changed when sample buffers change. I found that not to be true with my FW-1884. At 128 sample buffers I got a calculated 30 buffers offset. At 64 sample buffers I got a calculated 60 buffers offset (both using Jose's ASIO only proceedure).
|