Skip to content

Commit

Permalink
Tools to analyse JSON in bash files.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Aug 17, 2023
1 parent 38ea4c4 commit f7fca1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions architecture/max-msp/rnbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ def add_midi_control(
Args:
item (dict): The dictionary containing information about the UI item.
sub_patch (Patcher): The subpatcher object to which MIDI control will be added.
codebox (Box): The codebox~ object in the subpatcher.
param (Optional[Box]): The param object for the input UI items.
set_param (Optional[Box]): The 'set' param object for the input UI items.
change (Optional[Box]): The change object for bargraph UI items.
codebox (Box): The codebox~ object in the subpatcher.
Returns:
bool: True if MIDI control type is supported and added successfully, possible logs an error and return False otherwise.
Expand Down Expand Up @@ -291,7 +291,7 @@ def add_midi_control(
midi_args = " ".join(midi_info[1:])

# Scaling for MIDI input and output messages
# Pitchwheel case using @bendmode 1 (-8192, 8192) mode
# Pitchwheel case using @bendmode 2 (-8192, 8192) mode
if midi_type == "pitchwheel":
scaling_in = f"scale -8192 8192 {item['min']} {item['max']}"
scaling_out = f"scale {item['min']} {item['max']} -8192 8192"
Expand Down
10 changes: 10 additions & 0 deletions tools/faust2appls/usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ option() {
echo "Options:"
fi
}

# Check if a DSP has MIDI control, looking for the [midi:on] option in the JSON file
hasMidi() {
cat $1 | jq -r '.meta[] | select(.options?) | .options | contains("[midi:on]")'
}

# Get the number of voices of a polyphonic DSP, looking for the [nvoices:<num>] option in the JSON file
getNvoices() {
cat $1 | jq -r '.meta[] | select(.options?) | .options | capture("\\[nvoices:(?<nvoices>\\d+)\\]") | .nvoices'
}

0 comments on commit f7fca1a

Please sign in to comment.