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

Specific envelope needed!

DSP related issues, mathematics, processing and techniques

Re: Specific envelope needed!

Postby Spogg » Tue Mar 31, 2020 5:51 pm

I modded an envelope by Martin.

This is just to see if it's basically what you want. If you want exponential decay or more, that will have to be down to Martin I'm afraid.

So it's just a proof of concept really. But if it does what you want at least you can make progress with your project until something better comes along.

Cheers

Spogg
Attachments
env for Tom dev 1.fsm
3.06
(125.72 KiB) Downloaded 1250 times
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Specific envelope needed!

Postby tulamide » Tue Mar 31, 2020 6:42 pm

Spogg wrote:I’m becoming progressively more intrigued by the application you have in mind! :lol:

Just to repeat back… You stab a note on-off fast. The envelope sets off on its journey, going up one side, pausing for a breather, and then going back down the hill. But, like Sisyphus, if you stab the note again you immediately restart at the bottom again.
If that’s the case there could be a very sudden change of level from max to minimum level. Would that be acceptable or could it cause nasty clicks?

Cheers

Spogg

Yes, the change is of concern, but I wouldn't know how to change just without giving up monophony per osc group to keep it in blue (and I really want that)? Tips more than welcome.

And thank you for your mod, I will test it!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Specific envelope needed!

Postby BobF » Tue Mar 31, 2020 6:44 pm

env for Tom dev 1 w_added exp.fsm
(269.25 KiB) Downloaded 1306 times


For Tom with added exponential.....

Later then, BobF.....
BobF
 
Posts: 598
Joined: Mon Apr 20, 2015 9:54 pm

Re: Specific envelope needed!

Postby adamszabo » Tue Mar 31, 2020 6:54 pm

Yes this is pretty close to what Tom asked for. The only optimization I would do is to replace the divisions with reciprocals instead, they use much less cpu:

Code: Select all
streamin env;   streamboolout done;
streamin a;      streamout out;
streamin h;
streamin d;

float cnt=0;
float ahd=0;
float F0=0;
float F1=1;
float inva=0;
float invd=0;

mov eax,ecx; and eax,15; cmp eax,0; jnz hop;
movaps xmm1,a; rcpps xmm1,xmm1; movaps inva,xmm1;
movaps xmm1,d; rcpps xmm1,xmm1; movaps invd,xmm1;
movaps xmm0,a; addps xmm0,h; addps xmm0,d;
movaps ahd,xmm0;
cmpps xmm0,cnt,1; movaps done,xmm0;
hop:

movaps xmm1,F1;
movaps xmm0,env; cmpps xmm0,xmm1,4; andps xmm0,cnt;
movaps xmm2,inva; mulps xmm2,xmm0;
movaps xmm3,ahd; subps xmm3,xmm0; mulps xmm3,invd;
minps xmm2,xmm3; minps xmm2,xmm1; maxps xmm2,F0;
movaps out,xmm2;

addps xmm0,xmm1; movaps cnt,xmm0;


Its not hard to make this into poly, I have attached a schematic to show it, but unfortunately I only have the FS alpha here so you have to open it to see and do it like that in older versions. To make the envelope exponential you can just multiply the output signal by itself with a single multiplication (insert a multiplication and connect the envelope output to both multiplication input).
Attachments
AHD envelope.fsm
(48.35 KiB) Downloaded 1247 times
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Specific envelope needed!

Postby Spogg » Wed Apr 01, 2020 7:51 am

Squaring or cubing the output of a linear envelope generator will give a desirable decay at the end.

But there could be an issue for the attack, because the rate of change at the very start will be slow, and then speed up as the attack phase progresses, and this gives the impression of added latency. For very fast attacks it may not be a problem but for slightly lower speeds (like for strings maybe) it simply doesn’t sound quite right and feels too laggy. You can see this behaviour in Bob’s example.

That why Martin’s exponential envelopes (which I use all the time) have a linear attack and exponential decay and release stages.

The very best type of attack curve is logarithmic or inverted exponential (not sure of the correct term here). It was lucky that analogue synths used the charging of a capacitor for the attack and release stages. For the attack stage it starts off fast and the rate of increase slows down as it approaches the sustain or hold level. Usually the attack “aiming” voltage is higher than the sustain voltage, so on a scope you would only see about 60% of the curve before it held at the sustain level. But you would see the whole exponential curve shape on the release decay.

But first we need for tulamide to confirm exactly what he would like…

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Specific envelope needed!

Postby Spogg » Wed Apr 01, 2020 4:01 pm

Here is a version with linear attack and exponential release (but an ASM version for the whole thing would be better).

And tulamide's lovely new Slow scope.

Cheers

Spogg
Attachments
env for Tom dev 2 exp release .fsm
3.06
(117.14 KiB) Downloaded 1260 times
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Specific envelope needed!

Postby tulamide » Thu Apr 02, 2020 12:05 am

I will test the envelope generators now, and will report back, but I'm pretty sure, what Adam provided as ASM code plus a possible switch that allows for Spogg's idea of logarithmic attack + exponential decay (hold is just a straight line, graphically spoken, so linear the only thing that makes sense, I would think?) would be the optimum.

This is, beacuse the envelope would be used for two different applications of data modulation.

Thank you very much for the help so far, and I hope we can get to a final version! Just give me a day for my tests!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Specific envelope needed!

Postby Spogg » Thu Apr 02, 2020 7:27 am

tulamide wrote:(hold is just a straight line, graphically spoken, so linear the only thing that makes sense, I would think?).


Yes, correct. The hold value is exactly 1.0 for the envelopes I shared. ADSRs have a steady "hold" value depending on the Sustain level setting and the length of time is dependent on the time the note is held down, but not so on the AHR envelopes.

Also I should add (and you probably realised already) that you could select between squared and cubed for the exponential decay, to choose a curve shape most suitable for what you need. For a volume contour they sound quite different.

Have fun!

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Specific envelope needed!

Postby tulamide » Sat Apr 04, 2020 1:35 am

I've done the tests!

Here's what my dream envelope generator module would be like:
- The attack phase switchable between linear and logarithmic (I want to offer the user the possibility to switch)
- The decay phase switchable between linear and exponential (again, offer it to the user)
- Makes use of Adam's optimizations regarding divisions (currently I have to copy and paste his code with every new version)

The reason I'm asking for these changes to be made, instead of doing it by myself is simple. I'm literally navigating blindly, when it comes to ASM (or DSP), which makes errors propable, if not a sure thing. But I really need this to be a hassle-free, stable, reliable and fast implementation.

The contour of the exponential decay is good as it is now.
The contour of the logarithmic attack should come close to this:
Frame 1.png
One minute mockup in Figma (www.figma.com)
Frame 1.png (5.71 KiB) Viewed 20610 times
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Specific envelope needed!

Postby adamszabo » Sat Apr 04, 2020 12:16 pm

Phew that took a while, but I made a version for you where you can change the attack and decay curves however you want, you can drag the curve graphics (taken from Trogs Tools, thanks Trog!). They can go positive or negative. Unfortunately I have only been using the FS Alpha versions for years now so you have to open it with the alpha. All the code is in assembler, optimized to max, enjoy!
Attachments
env for Tom curve adamszabo (Alpha 2643).fsm
(47.78 KiB) Downloaded 1246 times
env_curve.png
env_curve.png (15.52 KiB) Viewed 20595 times
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

PreviousNext

Return to DSP

Who is online

Users browsing this forum: No registered users and 22 guests