It seems there is some confusion regarding the parameters. The Chop Execute DAT might not have a bypass parameter directly accessible like this. Instead, you can use the par attribute to enable or disable scripts by modifying a parameter that controls execution, such as active.
Here’s the revised script using the active parameter:
def valueChange(channel, sampleIndex, val, prev):
# Get the operator (CHOP) this DAT is monitoring
# Get the values of the channels
feminist = chop['feminist'][0]
# Find the channel with the highest value
values = [angel, hero, feminist, rebel]
max_index = values.index(max(values))
# Define the paths or names of the Chop Execute DATs
op('chop_execute_angel'),
op('chop_execute_feminist'),
# Turn on the Chop Execute DAT with the highest value and turn off the others
for i, chop_exec_dat in enumerate(chop_exec_dats):
chop_exec_dat.par.active = (i == max_index)
- Retrieve Channel Values: This part remains unchanged, where you retrieve the values from the
osc channels.
- Find the Maximum Value: This part also remains the same, where you determine which channel has the highest value.
- Control
Chop Execute DATs: You define a list of your Chop Execute DAT operators. Then, you iterate over this list and set the active parameter of the corresponding Chop Execute DAT based on the index of the maximum value. Only the Chop Execute DAT with the highest value’s index is active, and the rest are inactive.
This should properly enable and disable the Chop Execute DATs based on the highest value among the osc channels. If the active parameter does not exist, you might need to check the exact parameter name used to control the execution of your Chop Execute DAT and replace it accordingly.