hvcc icon indicating copy to clipboard operation
hvcc copied to clipboard

Alternative to [fexpr~]

Open reeson46 opened this issue 5 years ago • 11 comments

Hello. I'm learning PD and doing Andy Farnell's patches from his book. I want to use some of the patches in the game. I'm stuck on compiling this patch that has [fexpr~] object in it. Is there an alternative? I saw that Heavylib has this [hv.epx] object, but I'm guessing it's not the same.

reeson46 avatar Jun 09 '19 18:06 reeson46

that's [hv.exp], and it's an exponential function, replacement for [exp~]. @Simon-L did a static [expr~] compiler (see here) a while back, but I don't know if (or think that) it supports [fexpr~]. Ultimately, you may be better off trying to replicate the behaviour you are looking for by using lower-level Pd objects (e.g.: [rpole~] and [rzero~]), if at all possible.

giuliomoro avatar Jun 09 '19 18:06 giuliomoro

I see. Well, I'm very new to all this, but as I'm looking at Simon's patch, it's not for the audio signal. The whole object that I'm trying to replace is [fexpr~ $x1 - $x1[-1]]. I don't know what exactly this expression does.

reeson46 avatar Jun 09 '19 19:06 reeson46

check Pd's help patch for [fexpr~]:

The [fexpr~] object has exclusive variable types, defined as:
- $x#[n]: an input audio sample from inlet # indexed by 'n'
- $y#[n]: an output audio sample from outlet # indexed by 'n'
where 'n' for $x# has to satisfy: 0 => n >= -vector size
and 'n' for $y# has to satisfy: -1 => n >= -vector size

It doesn't actually specify what $x1 means, but I guess it is the same as $x1[0]. So $x1 - $x1[-1], seems to be doing the same as [rzero~ 1]. To test that I made this patch:

Screen Shot 2019-06-09 at 21 11 18

click the bang and check the console: you will see that the outputs generated by the [rzero~] and [fexpr~] are indeed the same.

giuliomoro avatar Jun 09 '19 20:06 giuliomoro

Thank you so much. It works :D

reeson46 avatar Jun 09 '19 20:06 reeson46

I just tried to recompile with [rzero~ 1] and I get this message: [rzero~] accepts only signal input. Arguments and control connections are ignored.

reeson46 avatar Jun 09 '19 22:06 reeson46

then send a signal to the right inlet of [rzero~] instead:

[<your stuff here>]
|
|     [sig~ 1]
|     |
[rzero~]

giuliomoro avatar Jun 09 '19 22:06 giuliomoro

Although I get the same message, it's all good in wwise now. Maybe the sound that is coming from that part is a little bit louder, but nothing I can fix with h_param in wwise. Thanks again 👍

reeson46 avatar Jun 09 '19 22:06 reeson46

Did you remove the argument 1 from [rzero~1 ] ? Or maybe that message always comes up every time you use [rzero~]

giuliomoro avatar Jun 09 '19 22:06 giuliomoro

Yes, I did. Here's the patch. [rzero~] is in "flowing_water_generator" runnin_water.zip

reeson46 avatar Jun 09 '19 23:06 reeson46

Also, I just remembered. When I compile for wwise from Vs2015 folder, sometimes I get this warning: WwisePluginEngineParams.cpp(90): warning C4065: switch statement contains 'default' but no 'case' labels The patch works fine in wwise. but still, sometimes I get this warning, and sometimes I don't.

reeson46 avatar Jun 10 '19 18:06 reeson46

that warning is not a problem. It's the Microsoft compiler (or Visual Studio) who are needlessly pedantic.

giuliomoro avatar Jun 11 '19 00:06 giuliomoro