Simple value change sensor
Thought I'd pass this on. It's a sensor that detects a change in value. This example sends out a reset command to something else. But here's how it works using the previous event module. "Previous event". Stores the incoming event value and outputs the previously stored value. As can be seen "Time" is the incoming value, in my case it comes from a panel control. So whenever the control is changed the new value doesn't equal the old value for one clock cycle. When a change is detected a single clock reset is generated. Not that the reset needs to be the end result, but it certainly does detect a new value and generates a single cycle flag. Hope it comes in handy, it's pretty simple thanks to the Previous Event module.
Comments
-
No, that's not what it does,
What your code does is, if there are two sequential 'time' events with different values, then the sample rate clock sends a stream of events at sample rate until there is a time event with the same value as the last. Probably not ideal to be sending the audio clock stream at a reset control?
If you replaced that SR.C with Time, it would likely do what you think it does. However, it still wouldn't be guaranteed to do what you expect during initialisation.
What you seem to need is a dup filter, There are a selection of those in the library. They are basically the same thing but with initialisation handled properly.
The ones with ' are optimised, but not 100% guaranteed at initialisation - read the descriptions! The ' versions are normally the best choice ;)
1 -
The time input is carried on the audio clock. Sorry, I should have said so. Remember how they reset the delay modules so they produced no sound until the time of the delay was exhausted after a reset. That's what this does. This code works as follows: whenever a new time value enters the "previous event" module the previous value is sent out and remains out until the next audio clock. During the one cycle delay period the comparator realizes there is a difference and momentarily connects the serial clock to it's upper or true output. The comparator then switches it off on the following clock cycle. Obviously the "previous event" is functioning as a single cycle audio delay but the output of the comparator does not run a chain of audio events downstream, only one clock is passed to the reset during the one cycle delay. You can preload an initial value on startup on the bottom input of the pe module. The problem there is it reloads that value whenever the ensemble is stopped or possibly when a switch is used too. So I chose to use an audio clock on the front panel dial for the time. That guarantees proper initialization right there. But you have a good point, I might be able to use event input for the time control and follow it by dup filter that resets the delay and come out ahead on cpu usage. Good idea, but at least I found a way to do it from a signal carried on the audio clock and shared it. It might come in handy. Later and thanks for the response. I sure have learned a lot in this forum.
0 -
Just use Dup Flt'
0 -
Can I connect the output of the dup filter to the reset on those delays directly or would I need something like an event merge in between. The resets accept a clock event without a value. I'll try it I guess. Talk Later, thanks again.
0 -
The reset on those delays needs to have a value of zero, use a latch.
0 -
Yeah, True. This might work. I'm pretty sure the ES module sets a true router output on startup. So it should reset the delay. On the other hand the event merge may send out a reset on startup if the bottom input is open. If so leave it open and connect the dup flt to the top of the merge. The two pics might be identical?
0 -
I can't get it to work with an event duplicate filter while using an event input for the panel dial. I just added a latch with a zero input on the dup flt below. Seems like it should work. Any ideas?
0 -
why are you making it so complicated?
Something like this should work just fine, unless there is other external context you have not explained?
0 -
Actually I think it does work, there's something else happening afterwards that's not clear yet. The single pulse with the audio input and the original circuit above works fine. Something is out of sync or something.
0
Categories
- All Categories
- 19 Welcome
- 1.4K Hangout
- 60 NI News
- 735 Tech Talks
- 3.9K Native Access
- 15.9K Komplete
- 1.9K Komplete General
- 4.1K Komplete Kontrol
- 5.5K Kontakt
- 1.5K Reaktor
- 364 Battery 4
- 817 Guitar Rig & FX
- 416 Massive X & Synths
- 1.2K Other Software & Hardware
- 5.5K Maschine
- 7K Traktor
- 7K 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