No way to assign macros?

I was working on a tool to randomly choose parameters from a given instrument’s modulation sets and device chains as the instrument macros, and then stumbled into this block:

renoise.song().instruments.macros.mappings.parameter
→ [read-only, renoise.DeviceParameter]

Why is this read-only? Is there any workaround?

This .parameter refers to a DeviceParameter object, not a value (like a number).

>>>print(renoise.song().selected_instrument.macros[1].mappings[1].parameter)
userdata: 0x0000000017E6BB28 (DeviceParameter object)
>>>oprint(renoise.song().selected_instrument.macros[1].mappings[1].parameter)
class: DeviceParameter
 properties:
    is_automatable
    is_automated
    is_automated_observable
    is_midi_mapped
    is_midi_mapped_observable
    name
    polarity
    show_in_mixer
    show_in_mixer_observable
    time_quantum
    value
    value_default
    value_max
    value_min
    value_observable
    value_quantum
    value_string
    value_string_observable
 methods:
    __STRICT
    record_value

So you can access the properties of this object. Does this information help you?

Thank you so much for your help, but my question was - how can I assign a macro to a particular parameter via the API, given that the .parameter field is read-only?

I think this is not possible with the current API, and in fact it would be quite complex, maybe that’s why it’s not available.

Each instrument has 8 macros, and each modulation or effect parameter can be linked to a specific macro from within Renoise. All of this taken together is quite complex. In addition, multiple unrelated parameters can be linked to the same macro!

I studied the API some time ago and saw some shortcomings in the modulation or in the keyzones, for example. But I never thought of controlling the macros from the API because of its complexity. You need to show the user somehow from their tool what parameters are assignable to macros in order to bind, and so on. As the modulation devices and effects are variable, it is even more complicated, since they can exist or not and repeat themselves.