enzienaudio / heavy

heavy public issue tracker and static dsp code releases
https://enzienaudio.com
ISC License
71 stars 4 forks source link

Expr object alternative? #232

Open ashtonmills opened 7 years ago

ashtonmills commented 7 years ago

Hi there

I am translating one of Andy Farnell's patches to use with Wwise, the original (birds) uses tabread~ to get the parameter values, so I am changing these over to lines so I can operate envelopes from within Wwise.

For this patch 'duration' informs everything, so all parameters need to be scaled from 0 to D, where D is the current value for duration. You can see from the patch I have used an expr object to normalise the FMAttack from a range of 0 - 100 to a range of 0 to X I'm using the equation f =a + (X-A) (b-a) / B-A) Where f = new value I need A = original minimum (0) B=Original maximum (100) a=new minimum (25) b= new maximum ($f2) x= the input value ($f1)

I tried to upload to heavy but I don't think it takes expression objects. Is there an alternative to this?

Also am I right in saying there is no vline~ object in heavy? So if I wanted to include decay in envelope I would need to use line~ and a delay object,is that right?

In the picture ignore the tabreads etc I'm still converting them.

Thanks a lot

Ashton

capture

dbaxaudio commented 7 years ago

Check Enziens GitHub for their custom vline object.

There isn't an expression object so I think you need to recreate the formula with objects, though maybe there's a better option?

On 10 Aug 2017, at 14:29, ashtonmills notifications@github.com wrote:

Hi there

I am translating one of Andy Farnell's patches to use with Wwise, the original (birds) uses tabread~ to get the parameter values, so I am changing these over to lines so I can operate envelopes from within Wwise.

For this patch 'duration' informs everything, so all parameters need to be scaled from 0 to D, where D is the current value for duration. You can see from the patch I have used an expr object to normalise the FMAttack from a range of 0 - 100 to a range of 0 to X I'm using the equation f =a + (X-A) (b-a) / B-A) Where f = new value I need A = original minimum (0) B=Original maximum (100) a=new minimum (25) b= new maximum ($f2) x= the input value ($f1)

I tried to upload to heavy but I don't think it takes expression objects. Is there an alternative to this?

Also am I right in saying there is no vline~ object in heavy? So if I wanted to include decay in envelope I would need to use line~ and a delay object,is that right?

In the picture ignore the tabreads etc I'm still converting them.

Thanks a lot

Ashton

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

diplojocus commented 7 years ago

hi @ashtonmills

Here's a patch that I believe implements the same function you were doing with [expr] (also included the text version at the bottom of this post): Archive.zip

You're correct that [expr] is not supported, though you can generally create workarounds for it and another user has created a static expr generator that might be useful for you: https://github.com/Simon-L/pd-static-expr

@dbaxaudio is correct, for a [vline~] replacement check out the hv.vline patch in heavylib. https://github.com/enzienaudio/heavylib/blob/master/hv.vline.pd

scale.pd

#N canvas 278 238 632 621 10;
#X obj 41 498 +;
#X obj 41 437 /;
#X obj 41 319 -;
#X obj 41 384 *;
#X text 97 539 f(x) = minA + x * (maxB - minB) / (maxA - minA);
#X obj 41 36 inlet input;
#X obj 41 540 outlet;
#X obj 389 35 inlet minB;
#X obj 495 37 inlet maxB;
#X obj 447 348 -;
#X obj 407 173 f \$3;
#X obj 415 300 f \$4;
#X text 377 300 maxB;
#X text 368 175 minB;
#X obj 407 232 t b f f;
#X obj 319 81 loadbang;
#X obj 319 103 t b b;
#X obj 492 123 t b f;
#X obj 202 338 -;
#X obj 151 229 t b f f;
#X obj 243 114 t b f;
#X obj 152 36 inlet minA;
#X obj 242 36 inlet maxA;
#X text 112 176 minA;
#X text 117 295 maxA;
#X obj 155 293 f \$2;
#X obj 151 174 f \$1;
#X connect 0 0 6 0;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
#X connect 5 0 2 0;
#X connect 7 0 10 0;
#X connect 8 0 17 0;
#X connect 9 0 3 1;
#X connect 10 0 14 0;
#X connect 11 0 9 0;
#X connect 14 0 11 0;
#X connect 14 1 9 1;
#X connect 14 2 0 1;
#X connect 15 0 16 0;
#X connect 16 0 26 0;
#X connect 16 1 10 0;
#X connect 17 0 10 0;
#X connect 17 1 11 1;
#X connect 18 0 1 1;
#X connect 19 0 25 0;
#X connect 19 1 18 1;
#X connect 19 2 2 1;
#X connect 20 0 26 0;
#X connect 20 1 25 1;
#X connect 21 0 26 0;
#X connect 22 0 20 0;
#X connect 25 0 18 0;
#X connect 26 0 19 0;

scale-help.pd

#N canvas 1157 400 412 300 10;
#X obj 54 46 hsl 128 15 0 100 0 0 empty empty empty -2 -8 0 10 -262144
-1 -1 12700 1;
#X floatatom 125 200 5 0 0 0 - - -, f 5;
#X floatatom 234 95 5 0 0 0 - - -, f 5;
#X floatatom 62 198 5 0 0 0 - - -, f 5;
#X obj 123 146 scale 0 100 25 100;
#X text 278 95 duration;
#X text 192 44 input;
#X connect 0 0 3 0;
#X connect 0 0 4 0;
#X connect 2 0 4 4;
#X connect 4 0 1 0;
ashtonmills commented 7 years ago

Thanks a lot guys I will look into this later on.

ashtonmills commented 7 years ago

Omg Joe just had a look at this as I was afk when you sent it. Perfect ! That's so helpful!