core cell works only when entering
hello reaktor-community,
today i have a strange "reaction problem". i want to compare two values to determine whether a lamp should light or blink. for this i need the value 1. for reasons of space (and learning core) i would do this with "core". the two inputs are either a 0 or a 1. if both inputs are 1, the output should also be 1.
in the core-cell i add both values together and see if they add up to 2. if so, the router should deliver 1 at the output. but it only send at the output when i open the core cell. as long as i am "outside" the core-cell, there is no output.
do i have to somehow "trigger" this core-circuit, so that it reacts in real time? i've also tried to attaching SR.C-triggered latches to all relevant – but that didn't help. core is still relatively new to me. maybe i overlooked something.
many thanks in advance.
Comments
-
That constant 1 only fires an even during initialisation. routers route events, so the rest of the time you will get no event at the output, and stuff down the line will get whatever value was generated at initialisation.
What is supposed to happen at the BLNK output?
0 -
thanks for the explanation. "1" should be present at the output, if both inputs are also 1.
0 -
Well if 1 is always at the output, then it's guaranteed to be 1 if both inputs are also 1! ;)
I taking a wild guess that it should be some other value in some other circumstances?
0 -
it looks like you want to realise an AND.
both outputs give you the AND logic.
the simple way is to use the AND macro. which contains one module.
the other solution is the fix for your trial. like colB wrote yours didn't work because of 'constant only fires it's value at init time' and you didn't send a 0 in case the input to the 'compare' isn't 2.
2 -
after your last comment i found the mistake (missing 0 - very stupid fault!) and tried it to fix, but got only the half way (missed the latch für the "1" - see screenshot).
thank you very much for your ideas, i learned something new!
0 -
the and-module is a pretty simple solution!
0 -
yours still only works at init time. :)
1 -
Something like this: EDIT: oops, that's basically what errorsmith posted :)
Depending on what the outputs is for and where the inputs come from, I might change some details... maybe add a dup filter. And if it outputs to gui, I would bring in dclk and latch the out to it... maybe do the whole thing as float with a test... just because then you don't pay for i2f and f2i conversions... which matters at audio rate, but not for GUI stuff...
If the inputs are always 1 or 0, then it can be simpler still ;)
Again, it depends on the context.
Do you really want an output from either input, or should one be driving the process?
What is the output for?
These are necessary considerations.
2 -
your last screenshot is exactly what i have done after your explanation – and it works perfect! :-)
i had no idea about the logic-modules. again: it was a very helpful lesson today. thanks!
2 -
excuse me if i ask again. completely different situation, but same problem. although i think i've noticed everything this time:
a notepitch (P) is to be checked for whether it is within an upper limit (U) and a lower limit (L). if the conditions are true, a 1 is triggered, otherwise an o is triggered. after this, both results (U and L) compared. if both are 1, the stored pitch is send to the output, otherwise -1. and again the core-cell only works when entering or leaving. why? i just don't understand the misconception.
thank you very much for your patience
0 -
constants only send their value at init time. You need to send the events of the compare also to the connected router.
So connect the out of the AND to the router on the right. 'Event merge' U and P and connect the merge to the upper left router. 'Event merge' L and P and connect the merge to the lower left router.
1 -
thank you very much! now it works! do i understand correctly: constants are a kind of "dead" numbers, since they do not do anything during operation, but only create a start situation?
0 -
mhh what do you expect? why should constants send their value at other times than init time? how should the constant know that it is time to resend their value? if you want to make an event with their value during 'operation' you need to latch them.
Btw since the value after merging is not important in this use case you could use EvtMerge (Event Merge) . I guess that saves cpu, but since it is used in event processing (vs audio) the cpu gain is little.
0 -
BTW the macros in the Logic folder are your friends to make your patching easier :)
structure before the AND can be replaced by 'IGT' and 'IGE'
0 -
Btw since the value after merging is not important in this use case you could use EvtMerge (Event Merge) . I guess that saves cpu, but since it is used in event processing (vs audio) the cpu gain is little.
Pretty sure a standard merge will be optimised anyway, so really the evtMerge is more for clarity of code than anything else. Also might help the compiler a little to compile faster.
do i understand correctly: constants are a kind of "dead" numbers, since they do not do anything during operation, but only create a start situation?
In core everything is event driven. Constants only generate an event during initialisation. Outside of initialisation, all events originate from some external source, either inputs or the audio clock. You can take multiple wires from an event, but its is still the same event, processed with logical simultaneity. It's worth reading the manual on this, because it is a very important topic. It's not particularly difficult, and makes programming easier, but if you don't get it clear in your head, you will keep running into problems.
Read from page 65 of the Building in Core manual, "Processing Model of Core"
(That link doesn't look good, but it is from the NI website :))
Also, Just a note on your last pic. Those four latches are floating point, but they are in an integer processing section of code, so you should really be using integer latches. It will still work, but converting between integers and floats is not free!
2
Categories
- All Categories
- 19 Welcome
- 1.2K Hangout
- 58 NI News
- 633 Tech Talks
- 3.3K Native Access
- 14K Komplete
- 1.6K Komplete General
- 3.6K Komplete Kontrol
- 4.8K Kontakt
- 1.5K Reaktor
- 336 Battery 4
- 741 Guitar Rig & FX
- 382 Massive X & Synths
- 1K Other Software & Hardware
- 4.7K Maschine
- 6.2K Traktor
- 6.2K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators