Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Lookup-Table Envelopes

For general discussion related FlowStone

Lookup-Table Envelopes

Postby HughBanton » Fri Feb 23, 2018 11:20 am

Woke up this morning and wondered .. what if ? ... (As you do)

Just wanted to check if anyone's been here before - don't want to reinvent the wheel!

I've been after a method of speeding up envelope generation, so to replace all the normal cpu-devouring maths I've been investigating calculating the shapes in advance, in green-land, and then simply looking up values from an array. So from that point basically just needs counters.

Attached is simply a first step I knocked up yesterday, a feasibility study; I appreciate there'a a lot more to making a proper functional ADSR configuration. Attack-time and Release-time floats are on the left.

I've modded Barak's adjustable curve graphic (thank you Mr. President) to access its array, and made it so that you can select the number of points, and also choose the display polarity. 128 points works fine except for low notes, and MV's de-zipper sorts that. I discovered that 1024 points works cleanly without a de-zipper, but perhaps unwieldy?

Anyway .. worth pursuing? Any experts on this approach?
Attachments
Table Envelope exp7.fsm
(45.94 KiB) Downloaded 1060 times
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: Lookup-Table Envelopes

Postby Spogg » Fri Feb 23, 2018 11:57 am

Nice! It works fine for me.

I just wondered if you’d seen Barak’s ADSR with curves for A, D and R (attached).

This uses a modified version of the stock graphic multi-stage envelope generator and this relies on reading out from float arrays.

Sorry if you were aware of this already.

Cheers

Spogg
Attachments
Barak's curvy ADSR.fsm
(164.96 KiB) Downloaded 1069 times
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Lookup-Table Envelopes

Postby HughBanton » Fri Feb 23, 2018 12:19 pm

Yes, thanks, that's where I nicked them from :D
Took me a while to figure out how to expand the arrays and keep the graphics working.

My no 1 issue can be demonstrated by playing a very short note with a relatively fast attack and long exponential release. You don't get a 'correct' release because the two curves are a mis-match. Mind you the de-zipper still maintains an acceptable performance; I've been amazed how easy it was to implement the lookup arrangement, with negligible audio glitches.

But I have a cunning plan! Curve-referencing dll needed before the day is out ... I'll explain later. (As Dr Who used to say every ten minutes).

H
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: Lookup-Table Envelopes

Postby HughBanton » Sat Feb 24, 2018 6:00 pm

OK, I've evolved the idea into a functioning ADSR, attached. I think it's all working correctly :?:

The usp of this method - looking up values from pre-calculated tables, instead of calculating on the fly - is the simplicity of the maths. All I have in the dsp modules are 2 0-127 counters, a sample&hold, and an interpolator. No divisions, no multiplications, no DENORMs; total 11 lines of code.

And I'm pretty sure it could be simplified further: a single array for A,D &R, a single Float Array to Poly module and a single counter. Multi envelopes should certainly be possible too.

Well - should suit my immediate purpose anyway ;) ! Thanks again to Barak for the graphics.

H
Attachments
Table Envelope exp17.fsm
(50.46 KiB) Downloaded 1022 times
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: Lookup-Table Envelopes

Postby tulamide » Sun Feb 25, 2018 2:44 am

I like the idea, and it seems accuracy is the only issue?

However, from what I saw in your schematic, I think you would benefit greatly from my Spline class. You could draw your envelope with it, and it offers a float array output of any interpolation step at any time with free size setting. So, wether you need 256 or 1024, with a single command you get both from the same drawn envelope. The 1024 version is then 4x as precise as the 256 one.

Another great tool was done by TheOm. I don't remember the exact name of the tool, but it features a graphical envelope creator that outputs a float array.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Lookup-Table Envelopes

Postby HughBanton » Sun Feb 25, 2018 2:01 pm

Many thanks tulamide. I think most of all I'm relieved that I haven't received a flurry of 'That's not going to work because ... "! As far as I can tell the technique is pretty sound.

Accuracy does become an issue on e.g. very long decays, when (on headphones at least) you can just about hear an abrupt stop. Which I guess just implies that a much longer table is needed in such circumstances.

TheOm's tool was 'Line Editor', and I can see that that and/or Splines would indeed be greatly worth investigating, many thanks. I've realised that any shape whatsoever can be presented to each segment, with no cpu hit whatsoever - still just down to simple counters.

Since yesterday I've proved my 'single counter, single array' theory, using Append Float Array to chain the segments. I've now got a 6-stage envelope working in this way : Delay, Attack, Decay, Sustain .. followed by a second Attack & Decay during Stage4 to generate release transients. Absurdly simple to implement.

Hey ho, back to 'work' (?)
H
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire


Return to General

Who is online

Users browsing this forum: No registered users and 57 guests