(Teletype) IN cv read latency?

#1

Last night I ran into what seems to be a significant amount of latency reading the cv at the IN input.
I setup Pressure Points (and same behavior with Rene) so that the Gate on touch was patched to trigger in 1 on TT, and the CV output of Pressure Points/Rene was patched to IN on TT. The idea being, TT would echo (CV to VCO, TR1 to envelope+vca) and capture what I played. But, I’d always have to tap a stage twice before the correct CV amount was read. I simplified the script down to this for debugging:

#1
X IN
CV 1 X
TR.P 1

No obviously, not patched through the TT, I don’t hear any kind of delay between Gate/stage press and CV updating directly from PP/Rene. I started to play around with adding DEL.

#1
DEL Z: X IN
DEL Z: CV 1 X
DEL Z: TR.P 1

Through trial and error, slowly increasing the value of Z, I found that I needed a value of at least 80 for X to be accurate to the input voltage read from Pressure Points. 100 was the best, never having a case where the value wasn’t correct.

But 100ms seems like a crazy amount of latency to me. I wouldn’t expect the read/scan time of the IN jack to be that long, and I’m possitive it doesn’t take Pressure Points, a fully analog switch, that long to change it’s CV output from stage to stage.

Anyone have any insight? Thanks!
fw 2.1.0 ad358cd

0 Likes

Teletype 3.0
#2

Ah, reading back on my bookmarked posts, it looks like @lloydcole hit the same thing.

0 Likes

#3

100ms is a lot. so what happens is: when you execute IN it doesn’t actually read from ADC, it reads from an internal variable that gets updated every 61ms (same handler also reads the param knob, if i’m reading it correctly). so worst case scenario you would have at least 61ms latency in order to have an accurate read.

@tehn is there some technical reason we can’t just read from ADC whenever IN gets executed?

2 Likes

#4

I had the same issue when I tried to create a quantized cv-sequence-recorder. Most of the values were delayed by one step. In fact, I’d say that for most use cases I can imagine, this sort of latency makes it relatively useless.

If it’s somehow problematic to read the ADC when IN gets executed, maybe there could be an extra script that gets executed every time the ADC is read? That would feel more deterministic than what is currently going on. Or would that be too much additional load if it executed every 60 ms (I think M doesn’t go lower than 75ms or so?)

1 Like

#5

Now that you all talk about this, i remember having these issues when trying to record incoming CV to populate a pattern.
This is indeed a big deal.

0 Likes

#6

No idea why it was originally done like that. But SPI bus contention/locking is going to be in the mix.

Also, you probably only want to read the values for IN and PARAM once per execution context.

I know @sliderule wants to rewrite the scheduling (esp. to improving slewing), sorting out ADC reading might be best added into that.

0 Likes

#7

Id like to add my voice in support of this! Would be great to get that latency down. I’ve delaying around 75ms to compensate.

Out of interest, how do the TxI inputs compare to this? Is there the same issue?

1 Like

#8

nope. let’s try it. spi is fast-- even with an inefficient script (ie, multiple reads in the same script)

perhaps it makes sense to no re-query spi if a read comes within the same 1ms or so

good point. might get some timing jitter with script execution.

5 Likes

#9

This is great news, thanks !

0 Likes

#10

@bpcmusic - tagged to see if he can answer this question.

1 Like

#11

agreed this is a good candidate for a new scheduler. but that will be a pretty major update, i think we should fix this before we get there.

agreed, and should be trivial to implement. i’ll play with this in the next couple of days.

we already have this problem if you use audio rate triggers… really what we need is a good scheduler that supports different priorities for different tasks.

2 Likes

#12

Thanks all for the attention! This particular use case is near and dear to me as one of the primary use cases I have for the TT is creating a ‘improvisational sequencer’ that can capture played notes.

If anyone has changes they’d like me to try, I’m game.
My wife and I have a 4mo old, so my own latency is higher than normal at the moment, but I’ll turn around feedback as quickly as I can.

3 Likes

#13

Hmm. It will be different as the TXi communicates over the i2c bus.

I have a similar architecture as the TT in some regard as that there is one thread that reads the inputs and prepares the output and a second thread that responds to i2c commands. As this is literally the only thing the Teensy is doing, I read as fast as possible and store the value.1 When an i2c read comes in, it identifies the value that is requested and returns it immediately (no read or conversion needs to be performed). This was done in order to keep the execution time of the read as fast as possible … which, as i2c reads are inline on the TT, will help keep the TT’s timing as tight as possible.

I’ll run the script when I get home tonight and report back. You have me very curious. :wink:

Funny you all would be talking about input resolution. I published a firmware update yesterday that I’d been fiddling with for the last several days working to increase the responsiveness and accuracy of the read operations by adjusting the analog smoothing algorithm. You can learn more on my update post here:


1 In looking at the read code, it looks like I have it set to 500 microseconds - or half a millisecond. That seems very fast. Clearly it isn’t overflowing as I have run TXi tests for days, but I think that I want to validate that it really is doing 8 analog reads, smoothing, mapping/scaling, and quantization that quickly.

2 Likes

#14

The behavior of the expanders is similar to Teletype without them.
But all in all a little bit worse, because after playing for a while Teletype crashes compete

X TI.CV 1
TO.CV1 X

I use Monome Earthsea POS on TI CV 1, and EDGE to trigger script 1 in Teletype.

0 Likes

#15

Yikes. Does it actually crash? There was a tremendous amount of work that @tehn, @sam, and @scanner_darkly (among many others) did to increase performance and stability of the i2c communications on the Teletype.

I’ve pounded the heck out of it and have found it to be super-stable.

0 Likes

#16

which version of the firmware are you running? do you use i2c backpack or are they connected directly to teletype?

0 Likes

#17

issue for IN latency added: https://github.com/monome/teletype/issues/132

3 Likes

#18

Teletype Firmware is 2.1.0, I use my own DIY backpack
It is reproducible

0 Likes

#19

Would you consider trying 2.0 and 2.0.1 and seeing if they have the same issue?

edit actually if you could answer @bpcmusic’s question underneath before trying…

0 Likes

#20

Powered backpack or the one that is more of a breakout for the ii connectors (and doesn’t reach over and plug into the europower jack)? Also, how many devices do you have on that bus?

Sorry for all the questions!!

1 Like