mungewell / zoom-zt2

Python script to install/remove effects from the Zoom G1Four pedal
MIT License
62 stars 11 forks source link

Automatically convert patches between G3n (2 screens) and G1Four (1 screen) #40

Open mungewell opened 2 years ago

mungewell commented 2 years ago

Thought raised on #7 whether we could convert patches between different pedals, as we know that the G1Four (and friends) are limited to 1 screen - some effects a marked '1U'.

Seems that looking at the Group/ID numbers are actually unique, and different between versions of effect. For example:

$ find -name 'list_sorted.txt' -exec grep 'XtasyBlue' {} \;
0x04000051 : XtasyBlue (v1.00), 0xe0a478ef77b59a5c7d759ab5b15fe424, ./G1X FOUR/unzipped/XTSBLU1U.ZD2
0x04000051 : XtasyBlue (v1.00), 0xe0a478ef77b59a5c7d759ab5b15fe424, ./G1 FOUR/unzipped/XTSBLU1U.ZD2
0x04000050 : XtasyBlue (v1.20), 0x44f27b730d32054d5ec3142284a58b7f, ./G3n/unzipped/XTACYBLU.ZD2
0x04000050 : XtasyBlue (v1.20), 0x44f27b730d32054d5ec3142284a58b7f, ./G5n/unzipped/XTACYBLU.ZD2
0x04000051 : XtasyBlue (v1.00), 0xe0a478ef77b59a5c7d759ab5b15fe424, ./H8/unzipped/XTSBLU1U.ZD2
0x04000050 : XtasyBlue (v1.20), 0x44f27b730d32054d5ec3142284a58b7f, ./G3Xn/unzipped/XTACYBLU.ZD2

The question is whether the effects accept the same parameter values. Looking at XtasyBlue...

$ python3 ../decode_effect.py -x temp.xml "./G1 FOUR/unzipped/XTSBLU1U.ZD2"; cat temp.xml
{  
    "Parameters":[  
        {  
           "name":"Bass",
           "explanation":"Adjusts volume of low frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"MID",
           "explanation":"Adjusts volume of middle frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"Treble",
           "explanation":"Adjusts volume of high frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"PRSNC",
           "explanation":"Adjusts volume of super-high frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"STRCT",
           "explanation":"Selects the type and gain of the tone.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"Gain",
           "explanation":"Adjusts the gain.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"VOL",
           "explanation":"Adjusts the volume.",
           "blackback":false,
           "pedal":false
        }
    ]
}
$ python3 ../decode_effect.py -x temp.xml "./G3n/unzipped/XTACYBLU.ZD2"; cat temp.xml
{  
    "Parameters":[  
        {  
           "name":"Bass",
           "explanation":"Adjusts volume of low frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"MID",
           "explanation":"Adjusts volume of middle frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"Treble",
           "explanation":"Adjusts volume of high frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"PRSNC",
           "explanation":"Adjusts volume of super-high frequencies.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"STRCT",
           "explanation":"Selects the type and gain of the tone.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"Gain",
           "explanation":"Adjusts the gain.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"VOL",
           "explanation":"Adjusts the volume.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"SOLO",
           "explanation":"Sets the volume when the control switch is on.",
           "blackback":true,
           "pedal":false
        }
    ]
}

Huh, there's an extra parameter on this one... but maybe it would still work.

mungewell commented 2 years ago

BlackBack is different on this one...

0x03800010 : Bass DRV (v1.10), 0x824a89a5e53564ca179bec668b31f6cd, ./B3n/unzipped/BASSDRV.ZD2
        {  
           "name":"MID-F",
           "explanation":"Adjusts the center frequency of the mid-range.",
           "blackback":true,
           "pedal":false
        },
        {  
           "name":"MID",
           "explanation":"Adjusts the volume of middle frequencies.",
           "blackback":true,
           "pedal":false
        }
0x03800011 : Bass DRV (v1.00), 0xc961eaf21a582448918ba17b520fac69, ./B1 FOUR/unzipped/BA_DRV1U.ZD2
        {  
           "name":"MID-F",
           "explanation":"Adjusts the center frequency of the mid-range.",
           "blackback":false,
           "pedal":false
        },
        {  
           "name":"MID",
           "explanation":"Adjusts the volume of middle frequencies.",
           "blackback":false,
           "pedal":false
        }
mungewell commented 2 years ago

Made an educated guess on which effects might have 1 and 2 screen versions, and then manually worked through diff'ing the XMLs of those effects. screens.txt

This lets us automatically change a patch (ie from G1Four to G3n):

$ python3 decode_preset.py -2 -o temp.ztpc  patch_11.zptc 
Converting to 2 screen: 0x04000019 -> 0x04000018

$ grep 0x04000018 zoom_fx/master.txt 
0x04000018 : MS 1959 (v1.10), 0x493812d1d4d23264385e1d5d9076178c

$ python3 decode_preset.py -s temp.ztpc | grep Effect  
Effect 1: 0x0B000020
Effect 2: 0x04000018
Effect 3: 0x01000040
Effect 4: 0x05000018
Effect 5: 0x08000030
mungewell commented 2 years ago

Getting close to a solution, there is a 2nd ID spec'ed in the each FX bitfield.

$ python3 decode_preset.py -s g3n_xtasy.zptc | grep Eff
Effect 1: 0x01000040
Effect 2: 0x03000040
Effect 3: 0x04000050
Effect 4: 0x00000001
Effect 5: 0x05000050
$ python3 decode_preset.py -d g3n_xtasy.zptc | grep id 
    ids = ListContainer: 
                        id = 16777280
                        id = 50331712
                        id = 67108944
                        id = 1
                        id = 83886160

Confirming that we can adapt, upload and download. Does confirm that other areas of the zptc file is changed automatically by the pedal (ie. target changes from 0x02 = G3n, to 0x20=G1(X?) Four).

Note: file needs to be padded to 760bytes for G1Four to accept it. Other pedals may need different size.

$ python3 zoomzt2.py -P 50 patch_11.zptc
$ python3 decode_preset.py -1 -o test.zptc -p 760 g3n_xtasy.zptc 
Converting Effect 3 : 0x04000050 -> 0x04000051
$ python3 zoomzt2.py -P 50 test.zptc
$ python3 zoomzt2.py -p 50 test2.zptc

adapt.zip

mungewell commented 2 years ago
$ amidi -p hw:2,0,0 -S 'F0 52 00 6e 64 02 00 09 00 F7' -r temp.bin -t 2

1023 bytes read

$ python3 decode_screens.py temp.bin
---
Effect: ZNR (On)
DETCT : EFXIN
Depth : 100
THRSH : 30
Decay : 0
---
Effect: GoldDrive (On)
Gain : 69
Bass : 50
Treble : 56
VOL : 43
---
Effect: XtasyBlue (On)
Bass : 69
MID : 42
Treble : 83
PRSNC : 72
STRCT : HI
Gain : 42
VOL : 53
---
Effect: BGN4x12 (On)
MIC : OFF
D57:D421 : 50
Hi : 50
Lo : 50
---
Effect: Bypass (Off)
 : 
 : 
 : 
 :
mungewell commented 2 years ago
$ python3 zoomzt2.py -p 50 test2.zptc

$ python3 decode_preset.py -s test2.zptc
Name: BGN Djent 
Effect 1: 0x01000040
   Enabled: True
   Param 1: 1
   Param 2: 100
   Param 3: 30
   Param 4: 0
   Param 5: 0
   Param 6: 0
   Param 7: 0
   Param 8: 0
Effect 2: 0x03000040
   Enabled: True
   Param 1: 69
   Param 2: 50
   Param 3: 56
   Param 4: 43
   Param 5: 0
   Param 6: 0
   Param 7: 0
   Param 8: 0
Effect 3: 0x04000051
   Enabled: True
   Param 1: 69
   Param 2: 42
   Param 3: 83
   Param 4: 72
   Param 5: 1
   Param 6: 42
   Param 7: 53
   Param 8: 2
Effect 4: 0x05000050
   Enabled: True
   Param 1: 0
   Param 2: 50
   Param 3: 50
   Param 4: 50
   Param 5: 0
   Param 6: 0
   Param 7: 0
   Param 8: 0
Effect 5: 0x00000000
   Enabled: True
   Param 1: 0
   Param 2: 0
   Param 3: 0
   Param 4: 0
   Param 5: 0
   Param 6: 0
   Param 7: 0
   Param 8: 0
Roseweave commented 1 year ago

Any progress on this?