mungewell / zoom-zt2

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

Reading Patches from pedal uses 'old' method #68

Closed mungewell closed 5 months ago

mungewell commented 6 months ago

As noted on #64 it seems that the code in zoomzt2.py uses the wrong/old methods. These should be updated.

    def patch_download(self, location):
        (count, psize, bsize) = self.patch_check()

        packet = bytearray(b"\x52\x00\x6e\x09\x00")

and

    def patch_download_current(self):
        packet = bytearray(b"\x52\x00\x6e\x29")

@nomadbyte says...

I guess, the GetPatch SysEx:[0x09] is for the older generation of the pedals, like G3/G5; this only allows three 7bit parameters (bankMSB, bankLSB, progID) to specify the patch number. The G5n platform uses SysEx:[0x46] which allots two 7bit-bytes for each of the patch address parameters, thus supporting more patches (more and larger banks).

Note that the output patch data from these commands actually differ, they also show different checksums.

Also the old GetEditBuffer SysEx:[0x29], when used on G5n platform returns some garbage from previous patch and has no checksum; while the new SysEx:[0x64 0x13] correctly 0-pads the trailing data, and shows checksum. The SysEx:[0x29] needs EditorMode:On, unlike SysEx:[0x64 0x13].

mungewell commented 6 months ago

The patch_check() function attempts to read the bank/patch structure from the pedals, any improvements that should be made here? https://github.com/mungewell/zoom-zt2/blob/master/zoomzt2.py#L483

Ideally, I guess the value passed to patch_download() should match the value shown in Zoom's documentation and in Guitar-Lab (even if the count actually starts at zero in midi contents).

nomadbyte commented 6 months ago

...any improvements that should be made here?

It depends on what your target specs are. Which models do you target?

Technically, you may pass whatever patch number to the patch_download(), yet the code has to translate it into bank+progid address valid for a given model. More so, that address should fit into the number of 7-bit bytes allotted for that in the Sysex command defined for the model.

P.S. Thanks for restructuring the original issue!

mungewell commented 5 months ago

@nomadbyte

I've added the 'new' download method, which appears to work OK on my G1Four

$ python3 zoomzt2.py -p 50 test.zptc
00000000: 52 00 6E 46 00 00 04 00  09 00                    R.nF......
None
00000000: 52 00 6E 45 00 00 04 00  09 00 78 05 00 50 54 43  R.nE......x..PTC
00000010: 46 78 01 00 00 00 01 00  00 00 05 00 00 00 00 10  Fx..............
00000020: 00 00 00 00 00 00 00 00  00 00 41 47 00 20 44 2D  ..........AG. D-

What is the SysEx for the 'new' upload method?

nomadbyte commented 5 months ago

...What is the SysEx for the 'new' upload method?

Same approach as before. The output of the patch download can be sent to upload the patch. That is SysEx:[0x45]. If sending to different destination patch address, the Bank and Prog fields should be set as needed in the SysEx.

The current Edit Buffer is handled similarly with SysEx:[0x29] and [0x28]

mungewell commented 5 months ago

Done. Closing.