SynthMaker

oddsons & infuzions adsr 1.7 bug fixed & asm optimized

Archive · 2009 5 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

MichaelBenjamin ·

here is an optimized and bug fixed asm version of oddsons and infuzions 1.7 adsr from the sm wiki. cpu reduction to the code version is ~50% fixes: first is more of a workaround, since the sm env module seems to have a bug, it sometimes outputs values higher than 4 for a short time after release stage resulting in a nasty click. therefore the holdstage variable is minpsd by 4. second is that releasehop is no longer multiplied with S, since that made the enelope act wierd and hang on S with certain (especially small S)values. i also removed the stage(0) part since it would not have worked with stream data. if you only use green data you can stage(0) everything including minps xmm7,F4; after that stage1 begins. this envelope behaves like the adsr4 envelope, but restarts at the attack stage on a retrigger of the same note. to use different hops you need to change the variables cntr and incr according. step=1/hop. feed the streamboolout to a env module and the output from the env module into the holdstage input.

streamin A; streamin D; streamin S; streamin R; streamin holdStage; streamout out; streamboolout releaseOff; float stg=0; float hopA=0; float cntr=-16; float incr=16; float step=0.0625; float F1=1; float FM1=-1; float F4=4; float F0=0; float F2=2; float F3=3; mov eax,ecx; and eax,15; cmp eax,0; jnz end0;

movaps xmm0,A; movaps xmm1,xmm0; movaps hopA,xmm1; movaps xmm3,FM1; movaps xmm5,xmm3; movaps xmm4,D; movaps xmm6,R; movaps xmm7,holdStage;

mulps xmm0,step; rcpps xmm0,xmm0; addps xmm1,D; addps xmm3,S; mulps xmm4,step; rcpps xmm4,xmm4; mulps xmm3,xmm4; mulps xmm6,step; rcpps xmm6,xmm6; mulps xmm5,xmm6; minps xmm7,F4;

movaps xmm6,xmm7; movaps xmm4,cntr;

cmpps xmm7,F1,6; //extstage addps xmm4,incr; andps xmm7,xmm4;

movaps cntr,xmm7; movaps xmm4,xmm7;//backup cntr for comp

cmpps xmm7,hopA,5; andps xmm7,F1; cmpps xmm4,xmm1,5;//hopad in xmm1 andps xmm4,F1; addps xmm4,xmm7; cmpps xmm6,F4,0; andps xmm6,F4; addps xmm4,xmm6; movaps stg,xmm4; movaps xmm6,xmm4;//backup stg movaps xmm1,xmm4;//backup for next block movaps xmm2,xmm4;

//0,3,4,5, reserved movaps xmm7,cntr; cmpps xmm7,F0,6; andps xmm7,out; cmpps xmm4,F0,0; andps xmm4,xmm0; addps xmm4,xmm7; cmpps xmm6,F1,0; andps xmm6,xmm3; addps xmm4,xmm6;//out in xmm4

movaps xmm3,xmm1;//backup stage //4,5 reserved cmpps xmm1,F2,1; cmpps xmm2,F2,0; cmpps xmm3,F3,6; andps xmm1,xmm4; andps xmm2,S; addps xmm4,xmm5; andps xmm3,xmm4; addps xmm1,xmm2; addps xmm1,xmm3; minps xmm1,F1; maxps xmm1,F0; movaps out,xmm1;

movaps xmm0,stg; cmpps xmm0,F3,6; cmpps xmm1,F0,2; andps xmm0,xmm1; movaps releaseOff,xmm0; end0:

Large ·

Congrats on getting rid of the "pop" with the typical ADSR. BUT, why doesn't the release work? Can you set up an OSM showing the release working properly? Thanks in advance.

MichaelBenjamin ·

i forgot, you need to connect a bool to the holdstage. here is an osm.

Large ·

Cool. But there is a chopping sound when "Voices / Triggering a note that is already playing" is set to "true". It can be heard when you hit the same note repeatedly. See EXO's Multistage Envelope thread on how he fixed that.

Thanks 🙂

TheAudiophileDutchman ·

Works like a charm 😍

Just one small remark: in poly-mode I'm multiplying the stereo-signal from a wave read primitive using the key-velocity of the Voices to Poly primitive. Funny enough there's no sound when the key-velocity=1 (at this maximum, the stock SM ADSR works okay though). Every other key-velocity is just fine, so currently I'm just using a simple workaround...

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.