Iterating through params - need help with type names and groups - Norns scripting

Hello!

Im working on a project where I would like to access the parameters names and types.

Here is an simplified example of how would like to do so:

...
function printParams()
  print("These are the current params: ")
    for i, v in ipairs(params.params) do
     print(params:get_id(i))
     print(params:t(i))
     
    end
end
...


function init()

  printParams()
...
  

That test code outputs:

These are the current params:

nil

7

output_level

3

input_level

3

monitor_level

3

engine_level

3

softcut_level

3

tape_level

3

nil

0

monitor_mode

2

headphone_gain

1

nil

7

reverb

2

rev_eng_input

3

rev_cut_input

3

rev_monitor_input

3

rev_tape_input

3

rev_return_level

3

rev_pre_delay

3

rev_lf_fc

3

rev_low_time

3

rev_mid_time

3

rev_hf_damping

3

nil

7

compressor

2

comp_mix

3

comp_ratio

3

comp_threshold

3

comp_attack

3

comp_release

3

comp_pre_gain

3

comp_post_gain

3

nil

7

cut_input_adc

3

cut_input_eng

3

cut_input_tape

3

nil

7

clock_source

2

clock_tempo

1

clock_reset

6

link_quantum

1

link_start_stop_sync

2

clock_midi_out

2

clock_crow_out

2

clock_crow_out_div

1

clock_crow_in_div

1

Sorry for that awkwardly long output, I couldn’t concatenate the names with the types because the names are sometimes nil… which is finally getting me to my question!

How do I access the type enum in the lua api so that I get a text description of the type?

When I see “nil” that means a group (7?) or separator (0?) correct?

I see that we can add a group with the params:add_group(name,n) function is there a way to get the text name of the groups from the lua api? Or is there a way to get the name of the group from the params?

When adding a param is there a way to specify which group it should be in?

Sorry for so many questions at once!

Thanks!
Eric

Ok I can answer this. I was just confused, the documentation in the LDoc page hosted by Norns looks like this:

I made a bad assumption about what n was, I thought it was an id or something because there wasn’t much of a description… but I guess it should be obvious that n is a number of things.

The reference docs were more clear but I’m pretty sure I looked there earlier too and I was still too dense to understand it.

It was this example code which really helped me understand that n is how many of the soon-to-be-added parameters should exist within the grouping.

3 Likes

I don’t know about dense, I think it’s more that you’re finding places the docs can be improved to be clearer!

(Following up on discord)

1 Like