Delay signal

psonice's picture

Is there a "nice" way of delaying a signal?

I have a case where I send a signal to a macro patch, which steps a counter. That triggers the processing of an image, which gets stored in a queue. When the image processing is done, I want it to send a signal back to the start which will step the timer so that when each frame is done, the next one starts automatically.

The problem with that is that it works on older boxes, where the frame might take say 0.3s to draw, but on a new box it's done so fast that the 'done' signal arrives before the 'start' signal has finished, so it fails to trigger the next frame.

So, is there a good way of delaying the 'done' signal by say 0.05s? I've considered using it to trigger a stop watch, which would then trigger a conditional when it hits a certain time, then reset itself and trigger the start, but it seems a bit messy. Any better ideas?

tobyspark's picture
frame count logic?

thinking about the problem you've got, wouldn't a frame counter to ensure qc is on the next frame before starting the next frame be a better fit?

also, without knowing the patch, should it even be possible the start signal is still true when the done signal goes high? without making watertight test cases, i'd swear i've had odd behaviour in the past to do with timing and procedural frame-by-frame stuff.

psonice's picture
It's a non-realtime patch.

It's a non-realtime patch. Basically, I'm generating a font set by rendering each character in the ascii table with string in image, then processing it to add colour + depth. The idea is to run this patch when the composition starts, generate the set of font images as a structure, then the 'main' part of the composition (which uses the font) can start.

Because of that, I want the font to render as quickly as possible. I can use an LFO to drive the counter, but on old + slow boxes it could take a while to create the font images, so the LFO would have to be slow and it'll take a while to do all 250 odd characters, which is annoying on a fast computer.

And I can only assume that the 'done' signal arrives before the 'start' signal has left, because it looks that way and because the 'done' signal doesn't drive the counter.

I have the start signal and done signal as pulses, and they're both fed into an OR gate, which drives the counter. Either will drive it if I activate them manually, but if once the 'done' signal is connected it fails to trigger. If I add a second pulse patch using both the leading and falling edge to the 'done' pulse (so that two pulses are generated), it works - but then I have a system where it's generating too many pulses and I end up with every other character in the output structure.

tobyspark's picture
joy. still sounds like a

joy. still sounds like a delay isn't the best fit, but its hard to understand these things when we're in a world of ascii on a website. and i hope the whole issue will neatly go away when i finally make the custom patch that turns a string into an image+metadata structure!

cwright's picture
uber-text

I think an "Images with String" patch would be quite powerful. I look forward to seeing that :)

psonice's picture
I'll try to get time to

I'll try to get time to clean it up and post it here later on, so it's clearer what's going on.

Re. the string image patch - I'm a bit confused as to how it would work. It's easy to make a text image and process it or move it around, and it's also fairly easy to split into words or letters and use iterator to process and animate the parts. It would perhaps make sense to have a custom patch to scroll text in various ways. What had you got in mind?

I'll include my text scrolling macro when I post up the font generator, I guess it could be useful if anyone is doing text stuff in the mean time.

psonice's picture
Tidied up + uploaded

The font generator is here: http://kineme.net/Applications/Compositions/Fontgenerator

I've also put together an example here: http://kineme.net/Applications/Compositions/Texteffects/scrolling/customfont

Both examples are just hacks to test out how it works. Much more is possible - for example per-word effects, much more complex (or readable ;) animation, and prettier fonts.

I'm still not convince by the delay, but the facts of the matter are simple - without the delay, it doesn't work. With a 0.01s delay, it works. I guess that it's only 1.2 seconds or something total.. not the end of the world :)