VSN1 Display | Intech Studio
💬 general Grid

VSN1 Display

Bryan
Bryan · · 33 replies

Is there a way to lower the latency from a knob action to the readout of the value on the display?

Replies (33)

narayb narayb ·

Are you using the default configuration of the LCD?

Bryan Bryan ·

Here's what I'm using:

if f > 0 then
f = f - 1
local a, xo =
map_saturate(v[1], v[2], v[3], 0.1, 1),
#tostring(v[1]) / 2 * s / 2 - #tostring(v[1]) - s // 32,
lcd:draw_area_filled(10, 10, 310, 230, c[1])
lcd:draw_rectangle_rounded(xc - p // 1 - 1, yc - p // 1 - 1, xc + p // 1 + 1, yc + p // 1 + 1, s, c[2])
lcd:draw_rectangle_rounded_filled(xc - p * a // 1, yc - p * a // 1, xc + p * a // 1, yc + p * a // 1, s, c[3])
lcd:draw_text_fast(v[1], xc - xo, yc + s, s / 2, c[2])
local xn = (#ids * (s / 2)) / 2 - s // 32
lcd:draw_text_fast(ids, xc - xn, yc - 1.5 * s, s / 2, c[2])
lcd:draw_swap()
end

Bryan Bryan ·

I think it's something basic that I grabbed from somewhere in here

Bryan Bryan ·

does sharing the config like this work?

grid-editor://?config-link=78xpqhubjl5yAWZZs8jE

narayb narayb ·

I see, this looks like the basic configuration to me.

narayb narayb ·

What you could do to make it faster to make the rendered visualization simpler.

narayb narayb ·

Right now each refresh of the screen makes 5 draw calls, 2 of which are pretty slow.

narayb narayb ·

This means if you are okay with reducing the visual flair of the visualization, simpler visuals can potentially reduce the delay.

narayb narayb ·

It would be pretty nice if we could measure the delay somehow.

narayb narayb ·

So for example using the following on the Draw Event should be one of the fastest (since there is no visual whatsoever).

if f > 0 then
    f = f - 1
    local a, xo =
        map_saturate(v[1], v[2], v[3], 0.1, 1),
        #tostring(v[1]) / 2 * s / 2 - #tostring(v[1]) - s // 32,
    lcd:draw_area_filled(10, 10, 310, 230, c[1])
    lcd:draw_text_fast(v[1], xc - xo, yc + s, s / 2, c[2])
    local xn = (#ids * (s / 2)) / 2 - s // 32
    lcd:draw_text_fast(ids, xc - xn, yc - 1.5 * s, s / 2, c[2])
    lcd:draw_swap()
end
narayb narayb ·

You could go one step further and add a simpler visual like this:

if f > 0 then
    f = f - 1
    local a, xo = map_saturate(v[1], v[2], v[3], 0.1, 1), #tostring(v[1]) / 2 * s / 2 - #tostring(v[1]) - s // 32
    lcd:draw_area_filled(10, 10, 310, 230, c[1])
    lcd:draw_area_filled(xc - p  // 1, yc - p * a // 1, xc + p  // 1, yc + p * a // 1, c[3])
    lcd:draw_text_fast(v[1], xc - xo, yc + s, s / 2, c[2])
    local xn = (#ids * (s / 2)) / 2 - s // 32
    lcd:draw_text_fast(ids, xc - xn, yc - 1.5 * s, s / 2, c[2])
    lcd:draw_swap()
end
narayb narayb ·

But truth be told, I don't really feel the difference here.

narayb narayb ·

Keep in mind that the screen runs at a constant 20 fps, which means that there is an inherent 50ms frametime here.

Bryan Bryan ·

Just trying to see if I can get something that updates fast enough for me to not overshoot volume level if I’m looking at the display. It’s a champagne problem because I can also just listen or look at the floating monitor control window on my computer but on quieter parts I’ve overshot and been slammed with SPL a bit higher than I’d like when the content gets louder

Bryan Bryan ·

I don’t think the 50ms added from the display should be too big of an issue but I haven’t tested the ones you shared yet

Bryan Bryan ·

oh yeah this one is great

Bryan Bryan ·

just tried it out

narayb narayb ·

nice! glad to hear it

narayb narayb ·

rounding is an expensive function, we used it for the visual because it looks nicer

narayb narayb ·

but draw area will always be the fastest one

Bryan Bryan ·

Cool, I didn’t particularly care for rounds anyways. Still gotta figure out the other display elements based on the mockup I did a while ago but if it comes at the expense of latency I’ll keep it simple

Bryan Bryan ·

also my replacement knob just came in, this thing is nearing final form ❤️

narayb narayb ·

In terms of speed, the fastest ones are draw_area_filled and draw_text_fast.

Polygons are probably the slowest especially if they are filled, rounding comes after that probably and then raster text in the form of draw_text.

narayb narayb ·

So pick your poison I guess 😄

Bryan Bryan ·

sorry for the basic question but how do I make the value readout larger if I decide to do the one that only has text?

Bryan Bryan ·

Like if I wanted the number to be really big

IMG_4090.jpg
narayb narayb ·

It would probably be too big as the numbers are all powers of 2 for text_fast

narayb narayb ·

But you can change the penultimate parameter of the first text_fast line to s from s/2

narayb narayb ·

That will double it

Bryan Bryan ·

that kind of shifts it to the bottom and a little off center but I'm not sure how to fix that

Bryan Bryan ·

Got something

Bryan Bryan ·

I used ChatGPT to get this:

if f > 0 then f = f - 1 local big_scale = s local small_scale = s / 2 local value_str = tostring(v[1]) local text_w = #value_str * big_scale / 2 local text_h = big_scale lcd:draw_area_filled(10, 10, 310, 230, c[1]) lcd:draw_text_fast(value_str, xc - text_w, yc, big_scale, c[2]) local xn = (#ids * small_scale) / 2 lcd:draw_text_fast(ids, xc - xn, yc - big_scale * 1.2, small_scale, c[2]) lcd:draw_swap() end

narayb narayb ·

Yeah, looks good!

Discord

View on Discord

This post is from the Intech Studio Discord community.

Open thread →