porres / pd-else

ELSE - EL Locus Solus' Externals for Pure Data
Do What The F*ck You Want To Public License
287 stars 36 forks source link

scope3d~ #2041

Closed porres closed 5 months ago

porres commented 6 months ago
ben-wes commented 6 months ago

i changed the things according to the first comment here: https://github.com/porres/pd-else/compare/master...ben-wes:pd-else:master

the way perspective functions is a bit arbitrary since the field of vision for perspective:1 is randomly chosen by me. but if you set it to 0, there's no perspective at all anymore ... so if you rotate the view then, it's an isometric view (parallel lines stay parallel).

framerate sets the actual frames per second that the scope will try to achieve (this controls the render interval in the tick method). its default is currently 50

i don't really understand the nsamples setting. to me, it's more logical to define the nth audio sample that should be sampled for display in the oscilloscope. that's what interval did. i see that nsamples minimum is 2 though - so i assume it means how many samples are covered by a line. i adapted this to scope3d~ now ... but not sure i understood correctly!

ben-wes commented 6 months ago
  • add 'range' message to set display range (could probably replace 'zoom')
  • the dimensions, whatever they are, should match the range, so you can stretch it like it is with [oscope~]

it's easy to implement - but a non-proportional scaling in 3d doesn't look very nice. it would actually be the default behavior which i avoided with these lines here: https://github.com/ben-wes/pd-else/blob/d5a524a670268eec498d1f9853c181505ca5fd77/Code_source/Compiled/audio/scope3d~.pd_lua#L255

ben-wes commented 6 months ago

receive is implemented as well now (as message and flag).

porres commented 6 months ago

why no PR? :)

porres commented 6 months ago

trying it but getting errors Screen Shot 2024-03-06 at 13 18 06

porres commented 6 months ago

I can just recreate the object and it works though

ben-wes commented 6 months ago

yeah... there's a fix in the state stuff that kills old objects. sorry.

ben-wes commented 5 months ago

ah ... i didn't really look at the error message yesterday anymore when on the phone. there was actually a bug for restored states with a custom framerate. will send a PR for that.

porres commented 5 months ago

the way perspective functions is a bit arbitrary since the field of vision for perspective:1 is randomly chosen by me. but if you set it to 0, there's no perspective at all anymore ... so if you rotate the view then, it's an isometric view (parallel lines stay parallel).

still unclear to me...

it's easy to implement - but a non-proportional scaling in 3d doesn't look very nice.

can we try? otherwise there's no reason to offer different values for horizontal and vertical sizes. And at least [scope~] looks nice doing this.

framerate sets the actual frames per second that the scope will try to achieve (this controls the render interval in the tick method). its default is currently 50

so it is the refresh rate in hertz, huh?

So default is 50 frames per second? that'd be 20 ms for a frame rate, right?

What if the buffer has a period that's longer?

I think it makes better sense to set a refresh period in ms, as in [scope~], which is the 'delay' message, so we should also rename it to 'delay', right?

cheers

porres commented 5 months ago

we need a minimum size

porres commented 5 months ago

it's nice to set some default colors into the usual ELSE theme

porres commented 5 months ago

receive symbols with dollar signs are not working, they need to be expanded by 'realizedollar'

ben-wes commented 5 months ago

it's nice to set some default colors into the usual ELSE theme

sure! which ones should we use?

porres commented 5 months ago

which ones should we use?

sames [scope~] I guess

ben-wes commented 5 months ago

ok, copying from https://github.com/porres/pd-else/blob/144861705efa9ad90fab7996b1ed37c96af1f6b8/Code_source/Compiled/audio/scope~.c#L976C5-L978C84

ben-wes commented 5 months ago

the way perspective functions [...] still unclear to me...

it's a very simple "3d engine". each point gets projected on the canvas, i.e. rotated and then scaled according to a very simple formula: 6 / (6 + posZ * perspective). this is really quite arbitrary since this value of 6 could be different. with a perspective of 0, the z-position obviously becomes irrelevant.

can we try? otherwise there's no reason to offer different values for horizontal and vertical sizes. And at least [scope~] looks nice doing this.

sure. i mean ... with the drawing outside the object boundaries, the object size is not so relevant anyway. :)

so it is the refresh rate in hertz, huh? So default is 50 frames per second? that'd be 20 ms for a frame rate, right?

exactly.

What if the buffer has a period that's longer?

doesn't matter in this case here since the object handles a ring buffer and will just draw what's available based on the last block that was read into this buffer.

I think it makes better sense to set a refresh period in ms, as in [scope~], which is the 'delay' message, so we should also rename it to 'delay', right?

ah, sure - we can do that as well!

ben-wes commented 5 months ago

we need a minimum size there is - it's currently 1. :)

porres commented 5 months ago

it's currently 1.

make it 20, that's what scope~ has

porres commented 5 months ago

'delay' is a stupid name, I guess 'rate' is better (also for [scope~]), this was something inherited from fucking cyclone...

porres commented 5 months ago

actually... delay in scope is "onset time delay between displays (default 0)"

porres commented 5 months ago

so it does make sense and it doesn't make sense to call it 'delay' in scope3d~, I'm renaming to just 'rate'

ben-wes commented 5 months ago

alright... but if it's a rate, it should be in Hz, not ms? then we're just renaming the previous framerate?

porres commented 5 months ago

it's a period rate! I renamed it, but it doesn't seem to work, wanna check it?

porres commented 5 months ago

or can you make it like a delay between displays?

porres commented 5 months ago

yeah, seems I ruined things :) probably I don't mess with the code anymore :)

Screen Shot 2024-03-07 at 17 11 27

porres commented 5 months ago

closed this accidentally, haha

porres commented 5 months ago

but I should create a new reboot I guess

porres commented 5 months ago

yeah, let's start over https://github.com/porres/pd-else/issues/2050