[PD] Syncing an event with refresh rate in GEM

IOhannes m zmoelnig zmoelnig at iem.at
Thu Oct 11 18:55:27 CEST 2007

Batuhan Bozkurt wrote:
> So the required stimuli are a "beep" sound (which is a 3.5khz sine with 
> 7 ms duration) and a "flash" (which is basically a white circle visible 
> only for 20ms).
> The problem is, it is very hard for an object to "flash" with this short 
> duration. If you look at the patch you'll see that less than 50% of the 
> trials do not produce anything.


> I have to come up with a workaround to this and I thought maybe if I can 
> syncronize the onset of the flash with the refreshing rate, I can at 
> least make the disk visible for all of the trials. I can sacrifice the 
> precision in terms of duration but that is bound to happen I guess.

the first thing i noticed is that you are running Gem with the default 
framerate, which is 20 fps (50ms!)
there is plenty of time where you can trigger the flash right after a 
render-cycle and the flash will disappear before the next one.

so the first thing you ought to do is use a higher framerate, best 
choice will be the same rate as your monitor (60Hz): [gemwin 60]

it's hard to display a flash for 10ms if every frame stays there for 
50ms... :-)

the next thing is to synchronize your trigger events with the gem-rendering.

just insert a [t a b] object to the gemchain (e.g. [gemhead]), the 2nd 
outlet will band everytime the gemchain is executed (the actual 
rendering (buffer swapping) is done immediately after all gemheads have 
returned, which is 0 logical time after the bang (but some microsecs 
real time)


More information about the Pd-list mailing list