sixolet / fx

Base framework for supercollider send/insert FX for norns.
4 stars 3 forks source link

param tweaks #4

Open sonocircuit opened 3 weeks ago

sonocircuit commented 3 weeks ago

Hi Naomi

I made some minor changes to fx.lua so that there are more formatting options for params available. let me know if you think fx mod would benefit from this and I can submit a PR.

Here I added formatter as arg to pass any optional formatting.

Here I added values as argument to pass a table containing values. This adds the possibility to pass specific values rather than the index only. If the values arg (a table) is missing the passed value defaults to the index (current behaviour). thinking about it, there might better name for the arg.

Here I added a params:hide so that the dry/wet param is hidden by default. If the params of and fx aren't banged the dry/wet param would be visible when the slot is set to none. This is not an actual improvement, just something that was bugging me.

let me know what you think. and thank you for the fx ecosystem, it's truly a fantastic extension.

best

Sacha

sixolet commented 3 weeks ago

All of this looks solid, except that if I understand correctly, values would be a reverse map of options, right? Can we construct some of that automatically?

On Mon, Jun 10, 2024 at 2:16 PM sonocircuit @.***> wrote:

Hi Naomi

I made some minor changes to fx.lua so that there are more formatting options for params available. let me know if you think fx mod would benefit from this and I can submit a PR.

Here https://github.com/sonocircuit/fx/blob/dc6fce3af168eab55dccfc671cb4b12d34537e49/lib/fx.lua#L20-L21 I added formatter as arg to pass any optional formatting.

Here https://github.com/sonocircuit/fx/blob/dc6fce3af168eab55dccfc671cb4b12d34537e49/lib/fx.lua#L34-L37 I added values as argument to pass a table containing values. This adds the possibility to pass specific values rather than the index only. If the values arg (a table) is missing the passed value defaults to the index (current behaviour). thinking about it, there might better name for the arg.

Here https://github.com/sonocircuit/fx/blob/dc6fce3af168eab55dccfc671cb4b12d34537e49/lib/fx.lua#L55 I added a params:hide so that the dry/wet param is hidden by default. If the params of and fx aren't banged the dry/wet param would be visible when the slot is set to none. This is not an actual improvement, just something that was bugging me.

let me know what you think. and thank you for the fx ecosystem, it's truly a fantastic extension.

best

Sacha

— Reply to this email directly, view it on GitHub https://github.com/sixolet/fx/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMOZYKDEQBREXYRYMLZBKLZGYJR3AVCNFSM6AAAAABJDB6PK6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DIOBUGA4TKMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sonocircuit commented 3 weeks ago

sorry for being unclear. I'll try to explain with an example:

FxShimmer:add_option("pitch_ratio", "pitch ratio", "pitchRatio", {"fourth", "fifth", "octave"}, 1)

in the example above the value of pitchRatio corresponds to the index of the option, so 1, 2 or 3. This is the default behaviour.

local pitch_options = {"fourth", "fifth", "octave"}
local pitch_values = {1.3348, 1.4983, 2.0}

FxShimmer:add_option("pitch_ratio", "pitch ratio", "pitchRatio", pitch_options, 1, pitch_values)

when an additional table with values is passed as argument the value of pitchRatio would be 1.3348, 1.4983 or 2.0.

I hope this helps.

sixolet commented 2 weeks ago

Oh, I see. So you could add "option" params that correspond to numerical values, and not have to map them in your code?

I feel like this is cool, but the interface to add_option is something I stole from norns params:add_option(id, name, options, default), so I am not sure how much I want to change it. Is it notably difficult to make a pitch_values constant in your code and use pitch_values[thing] there?

sonocircuit commented 2 weeks ago

yes, exactly. the main reason behind this is that I used to doing this on the lua rather than the sc side. I normally remap the values within params:set_action(), hence my feeling that this type of functionality was missing. But I totally understand you wanting to adhere as close as possible to norns' interface. I just thought that, as you're already deviating from the standard with the addition of key it wouldn't be that intrusive and compatible with the current behaviour.

shall I remove it and send a PR for the other two things?

all the best, s