Need Help: How to detect rising or falling CV?

This forum is for discussing Reason. Questions, answers, ideas, and opinions... all apply.
Post Reply
User avatar
Catblack
Posts: 1020
Joined: 15 Apr 2016
Contact:

23 Apr 2018

I'm just throwing out the question, does anyone know how to detect rising or falling CV? I'd prefer it if I could get a positive result for rising and a negative for falling, but I could just use a CVA-7 to adjust it.

I'm not sure what CV devices might let me temporarily hold a value for comparison, other than perhaps Lolth and Miranda. The min/max detection on a CVA-7 might work, except that it has a 1 second minimum auto reset on those, and I think I'd need to update quicker than that.

Has anyone run into this before?
If you ain't hip to the rare Housequake, shut up already.

Damn.

User avatar
Raveshaper
Posts: 1089
Joined: 16 Jan 2015

24 Apr 2018

Hmm. I guess I am lacking a key piece of information here, but it seems to me this would be covered by:
cv_last = cv_this
cv_this = rgiv (n)
cv_diff = cv_this - cv_last

No? Use EMI to analyze it this way and spit out -1, 0, or 1 based on cv_diff to be mapped elsewhere?
:reason: :ignition: :re: :refillpacker: Enhanced by DataBridge v5

User avatar
Catblack
Posts: 1020
Joined: 15 Apr 2016
Contact:

24 Apr 2018

Raveshaper wrote:
24 Apr 2018
Hmm. I guess I am lacking a key piece of information here, but it seems to me this would be covered by:
cv_last = cv_this
cv_this = rgiv (n)
cv_diff = cv_this - cv_last

No? Use EMI to analyze it this way and spit out -1, 0, or 1 based on cv_diff to be mapped elsewhere?
I mean, in the rack. I am putting my Remote development on hold for a while currently.

I wasn't sure if there was a way to do what I'm wanting to mostly in Thor's programmer or not. I think I'll have to use the DVC-1 Digital Voltage Comparator, but that's not ideal because It does (more or equal) or (less or equal). There's nothing that does straight up comparison -- the DVC-1 should really have 5 states to compare. (gt, gte, e, lte, lt.)

The other logic REs I have, Truth and Elementary Logic Gates just work on pulses, not on values.

I'll figure this out eventually, just wish I could avoid REs.
If you ain't hip to the rare Housequake, shut up already.

Damn.

User avatar
selig
RE Developer
Posts: 11685
Joined: 15 Jan 2015
Location: The NorthWoods, CT, USA

24 Apr 2018

For this to work you need more than one sample in time, so there will always be some delay in detecting rising vs falling signals.

It’s simple math otherwise, meaning what you do is add two consecutive samples/batches and compare them. If the first value is less than the second, the signal is rising. If the first is greater than the second, it’s falling. Obviously if they are equal the signal is neither.

To do this you need to ‘hold’ the first sample so you can compare it to the second, then output the result which should take three batches (192 samples):
1: take first sample
2: compare to second
3: output result

Doing this with stock devices is going to be tricky, especially getting the timing tight (and correct), and probably IF possible, would be extremely bloated and inefficient.

Sorry I don’t have more help, but I’m guessing the very best solution would be an RE specifically designed to do this. The second best would be combining a sample/hold with a comparator, but there’s still getting the timing right since I’m not sure there are REs that help with that.




Sent from some crappy device using Tapatalk
Selig Audio, LLC

User avatar
guitfnky
Posts: 4408
Joined: 19 Jan 2015

24 Apr 2018

not sure if this might be helpful. I stumbled across it last week looking for an RE for my giant 'AI drummer' combinator, but decided it probably wouldn't suit my needs.

https://shop.propellerheads.se/rack-extension/now/

per the description:
Now detects a rising edge in the CV signal above the Threshold setting. Each detection triggers a count.
I write good music for good people

https://slowrobot.bandcamp.com/

WongoTheSane
Moderator
Posts: 1851
Joined: 14 Sep 2015
Location: Paris, France

24 Apr 2018

It's super easy with DVC-1 (19 coins, by Ravenherz) and Lolth (free, by Jiggery Pokery). Simply create a 1ms delay with Lolth, output both the original signal and the delayed one in DVC-1, compare them, output 1 if CV2 > CV1 or 0 if not.

cv slope.PNG
cv slope.PNG (865.15 KiB) Viewed 574 times

There's obviously a delay of about 1ms, depending on your application it may or may not be noticeable. You'll have to decide what to do if the signals are equal (either you consider them rising, falling, or add a third "0" value). You could also use it to output a third CV if the signal is raising and a fourth if it's falling, for instance. Here's the combinator.

Detect CV Slope.zip
(2.54 KiB) Downloaded 49 times

User avatar
Raveshaper
Posts: 1089
Joined: 16 Jan 2015

25 Apr 2018

This was a good challenge and I finally came up with a completely stock solution for you. Written in 9.5 format.

Simply take Gate 1 and Gate 2 of "This - Last" BV512 and use them as your positive and negative triggers.

This patch works best if the CV source is wrapped inside. I'm narrowing the delay time down to 1 ms as the rate of the modulation increases.

Max delay time when Rate / Res is at zero needs fine tuning for some waveforms but the rest works the way you needed.
Attachments
Raveshaper - Slope Detection.cmb.zip
(2.46 KiB) Downloaded 39 times
:reason: :ignition: :re: :refillpacker: Enhanced by DataBridge v5

Post Reply
  • Information
  • Who is online

    Users browsing this forum: hide and 25 guests