The g2-cli tool handles all USB communication with the G2 hardware. All G2 responses go to stdout as JSON; all commands are sent via stdin.
Connection
Command
Arguments
Description
connect
Connect to G2
disconnect
Close connection
startup
Full startup (init + device + all slots + names)
device
Show device info
list-devices
List USB devices (debug)
Patches & Performances
Command
Arguments
Description
get-patch
<slot>
Get patch from slot as JSON
get-patch-file
<slot> [file]
Save patch as .pch2 file (official text header, sections, trailing CRC)
get-perf-file
[file]
Save current performance as .prf2 file (official text header, sections, trailing CRC)
upload-patch
<slot> <filepath>
Upload .pch2 to slot
upload-perf
<filepath>
Upload .prf2 performance
select-patch
<slot> <bank> <loc>
Load bank patch into slot (bank 1–32, loc 1–127)
select-perf
<bank> <loc>
Load bank performance
store-patch
<slot> <bank> <loc>
Store slot’s patch to bank location (slot 0-3, use slot 4 for performances)
clear-patch
<patch\|performance> <bank> <loc>
Clear a single bank location
clear-bank
<patch\|performance> <bank>
Clear all entries in a bank (locations 1–128)
reload-names
Re-fetch patch/performance name list from G2: emits a names_progress event per bank (daemon only), then the complete names event.
list
[type] [bank <n>]
List patches/performances (optionally filter by type or bank)
get-perf-settings
Get current performance settings
set-perf-mode
<patch\|performance> [shift]
Switch between patch and performance mode. With shift it acts as SHIFT+PERF: patch→performance creates a new performance (“New Performance”) from the current slot patches (key/active kept); performance→patch keeps the performance’s patches in the slots
set-perf-name
<name>
Set performance name (may be empty)
set-patch-name
<slot> <name>
Set patch name (may be empty)
set-patch-description
<slot> <hexdata>
Set patch description (hex-encoded)
set-synth-settings
<json>
Set all synth settings from JSON
Slots
Command
Arguments
Description
slot
<A\|B\|C\|D>
Change active slot
variation
<1–10> [slot]
Select variation for slot. 10 (index 9) is the Patch Mutator audition variation
set-slot-enabled
<slot> <0\|1>
Enable/disable a slot
set-slot-key
<slot> <0\|1>
Assign/unassign keyboard to slot
set-slot-hold
<slot> <0\|1>
Set slot hold mode
set-slot-range
<slot> <lower> <upper>
Set note range for slot (0–127)
set-range-enable
<0\|1>
Enable/disable slot range
Voice
Command
Arguments
Description
voice-mode
<slot> <0–3>
Set voice mode (0=poly 1=mono 2=legato 3=slgt)
voice-count
<slot> <1–32>
Set voice count
Controller & Bank
Command
Arguments
Description
send-controller-snapshot
Send all assigned MIDI Controller values to MIDI OUT
dump-patch
<slot>
Dump patch from slot as MIDI SYSEX (A-D)
get-bank
<type> <bank> <folder> [<name>]
Get bank from device: saves each occupied location as a .pch2/.prf2 plus a .pchList index (type: patch
performance, bank: 1-32 or 1-8)
send-bank
<type> <source-type> <source-path> <bank>
Send bank to device — OVERWRITES the target bank, clearing any location with no matching source entry (type: patch
Set the labels of all labelled params of a module (replaces the module’s whole list; always pass every label param, the block size is fixed per module type)
copy-variation
<slot> <from> <to>
Copy all parameter values from one variation to another (0-based indices)
Persistent: watch events + accept JSON commands on stdin
seq
"<cmd1>" "<cmd2>" ...
Run multiple commands sequentially
debug
<on\|off>
Enable/disable debug timing output (emits JSON debug events to stdout)
Daemon Mode
The daemon maintains a persistent connection: it streams watch events to stdout and accepts JSON commands on stdin.
Recommended: tmux launcher
cd cli
./g2tmux.sh
Opens a split-pane tmux session — left pane: daemon output; right pane: command shell with autocomplete.
slot A # switch focus to slot A
get-patch A # read patch from slot A
variation 4 B # select variation 4 on slot B
verbose off # suppress LED/volume updates
set-perf-mode patch # switch to patch mode
set-perf-mode performance shift# SHIFT+PERF: new performance from the slot patches
stop # kill daemon
start # restart daemon
Type command name + TAB to autocomplete. Arguments also autocomplete: get-patch <TAB> → A B C D.
Manual daemon mode
# Terminal 1 — start daemon reading from a named pipemkfifo /tmp/g2-cmd
./build/bin/g2-cli daemon < /tmp/g2-cmd
# Terminal 2 — keep the pipe open and send commandsexec 3>/tmp/g2-cmd
echo'{"id":1,"cmd":"slot","args":["B"]}'>&3
echo'{"id":2,"cmd":"variation","args":["4","B"]}'>&3
echo'{"id":3,"cmd":"device"}'>&3
echo'{"id":5,"cmd":"verbose","args":["off"]}'>&3
exec 3>&- # close when done (causes daemon to exit cleanly)