Author Topic: How to edit env gen time constant values in SpinCad?  (Read 302 times)

mportnoy

How to edit env gen time constant values in SpinCad?
« on: January 15, 2021, 04:12:22 PM »
Hello
I have a need to edit time constant values inside of Spin Cad env gen block.  I need to be able to edit attack/release/threshold values so that the pots connected to the block have an adjustable range in milliseconds.  As it stands it seems these values are quite short.

Is this a possibility?

Digital Larry

Re: How to edit env gen time constant values in SpinCad?
« Reply #1 on: January 15, 2021, 07:50:45 PM »
At the moment, now that I look at it and dig deep into the recesses of my memory, the values shown for "Attack" and "Release" are actually the corner frequencies of the one pole low pass filters that do the enveloping.  As such, the left side (which goes down to 0.51 Hz, the lowest corner frequency you can get without using extended precision techniques) is the slowest and the rate increases (rise time decreases) as you slide to the right.  Given that these are really single pole low pass filters, they have an exponential response, so the "rise time" has to be defined as something we can all agree on such as 10% to 90%.

This article talks about analog filters but the concepts are the same.

https://www.signalintegrityjournal.com/blogs/12-fundamentals/post/853-back-to-basics-bandwidth-and-rise-time

RT (rise time) = 0.35/(-3 db BW)

So at 0.51 Hz, the rise time would be expected to be 0.35/0.51 or about 0.69 seconds.  You can probably make a spreadsheet which gives you the expected RT for various BW.

Now, have I measured it?  No.  But I think this is how it should work.
« Last Edit: January 15, 2021, 08:23:26 PM by Digital Larry »
Digital Larry
DSP tinkerer and former transistor twister

mportnoy

Re: How to edit env gen time constant values in SpinCad?
« Reply #2 on: January 16, 2021, 11:59:34 AM »
Thank you for the reply, Larry.

Based on your description, it sounds like the env generator won't achieve what I need.  I'm looking to take the audio input and turn it into a control signal whose attack and release times can be adjusted in ms, and whose threshold can be altered as well.

Do you think this is a possibility using SpinCad blocks, or would I have to move to hand coding?

Digital Larry

Re: How to edit env gen time constant values in SpinCad?
« Reply #3 on: January 16, 2021, 12:25:24 PM »
Well, you CAN make an envelope follower out of bits in the "Controls" menu, but there's no way that the readout is going to be in "msec".  I'm not entirely sure why I left the attack/release as filter corner freq, other than:

a) I knew what it meant and adjusted it by ear anyway
b) Nobody complained about it while I was actively developing the software. 

Also, I am not quite sure what the "threshold" would do in this situation.  I understand what "threshold" does on a compressor.  You might be able to accomplish a threshold using the "MAXX" or "Maximum" block, which outputs the higher of the two inputs.

I'm also skeptical that the low pass filter blocks that I put in the "Filters" menu are adjustable down to the minimum corner frequency, but you can also hand edit the generated Spin ASM to adjust the coefficient.

If you can come up with a Spin ASM block that does what you want, I might be compelled to add it to SpinCAD.

Thanks,

DL
Digital Larry
DSP tinkerer and former transistor twister

mportnoy

Re: How to edit env gen time constant values in SpinCad?
« Reply #4 on: January 16, 2021, 03:23:52 PM »
Thank you Larry.

As I'm thinking about it, threshold could possibly be handled by a simple volume block with a pot attached to it.  At least, thats a how it's often done in the analog world. 

From there, you'd need something to act as a kind of envelope follower I suppose, as long as the env attack time and decay time could be adjusted.  The time constants don't need to be measured precisely, they only need to be variable.

What do you think?


Digital Larry

Re: How to edit env gen time constant values in SpinCad?
« Reply #5 on: January 16, 2021, 03:51:29 PM »
Not really sure.  It doesn't cost much to try it.  Sorry if I seem evasive but if I can't answer things off the top of my head, I generally don't dig much deeper on it.  As you know you can also ask questions about algorithm development over at the Spin forum.
Digital Larry
DSP tinkerer and former transistor twister

Digital Larry

Re: How to edit env gen time constant values in SpinCad?
« Reply #6 on: January 18, 2021, 10:03:07 AM »
Reading back through this, I think it's going to be hard to make an envelope follower with adjustable attack/release out of smaller components, but only because the single pole LFO blocks with adjustable frequency can't be set to low enough frequencies from the UI.  I have on occasion built a structure from SpinCAD and then tweaked some values in SpinASM.  So you could probably build up a structure in SpinCAD and then tweak it in SpinASM.

Now I do have half a mind to start using SpinCAD again as I was thinking about making a board for that purpose.  As with most ideas though it gets lost in the jumble of every other idea I have and not enough time in the day.  But I might add an adjustable filter that would let you do that.  Maybe even add attack/release inputs to the envelope block.   Big maybe.

Be great if I had someone to do the work and all I had to do was have ideas!   :icon_biggrin:

DL
Digital Larry
DSP tinkerer and former transistor twister