mungewell / zoom-zt2

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

Suggestion for front end app: device FX memory usage #45

Closed andresitodemarco closed 1 year ago

andresitodemarco commented 1 year ago

Hi!

Just chiming in because I had a real hard time finding out the reason I couldn't install any new FX in my B1X Four pedal. Took me about an hour to figure out I was out of memory. Thing is in previous Zoom generations you'd have some ~100FX and about 25% of free memory, so you usually could store up to some 140 effects in those no problem. Now, with a "mere" 81 factory FX in it, the B1X Four is already at 99.3% memory. Too bad. So I had to get out a lot of delays & reverbs (redundant to have more than 2-3 of each) and even some bass amp/cab sims I'd never use to make room for installing a series of guitar amp/cab sims I wanted from the G1X Four model.

What I did, and namely the workaround for this, was to use ToneLib Zoom to check out memory usage. But it would be nice to have a memory usage indicator in the zoom-zt2 frontend app itself. Don't know how hard that'd be (haven't even dared review the code so far). Also the app doesn't really tell when it's running into a full memory, it just states "Effect installed".

Thanx a bunch for this app, made my B1X Four finally customizable.

mungewell commented 1 year ago

This is a great idea/comment, I meant to reply but was busy with local film festival and it slipped my mind.

I don't know how to read this information (ie how much space is available). but it's possible the value is returned from the file operations; at present we know how to list, upload and download via midi. It may be worth dumping the responses to see if any pattern/change can be seen as files are uploaded.

https://github.com/mungewell/zoom-zt2/blob/master/zoomzt2.py#L337

BTW early in dev I had incident where I uploaded multiple copies of the same file and filled memory, maybe this 'trick' could help as the responses should (logically) be the same for each copy. A difference could be a clue....

I'd be very happy to collaborate, and add features (and code improvements) to the GUI.

andresitodemarco commented 1 year ago

I don't think the free memory count is as important as having a clear error message when you're running out of memory. IME (with a B1Xfour) it always tells me effect has been installed, even when it hasn't due to insufficient memory. I'm fluent with Python, just not MIDI stuff. Let me know if there's anything I can help at, sure I'd love to. Thanks a ton for your wisdom and generosity!

mungewell commented 1 year ago

I agree, the app should give some error message when an upload fails.

It's a (sad) fact that the code currently does not assess the response(s) from the pedal... for example https://github.com/mungewell/zoom-zt2/blob/master/zoomzt2.py#L413 https://github.com/mungewell/zoom-zt2/blob/master/zoomzt2.py#L439 https://github.com/mungewell/zoom-zt2/blob/master/zoomzt2.py#L442

In many places the response is received with msg = self.inport.receive(). I imagine that if we understand the response we'd be able to confirm whether the effect was correctly uploaded.

Just printing out these msg as a hexdump may help give some understanding.

nomadbyte commented 1 year ago

The "Memory Usage" (that is the internal block storage) details on G1 FOUR seem to get fetched with Disk free:[60 29] SysEx command:

command sysex-command sysex-response
Disk free 60 29 60 04 29 00 00 08 00 X0 X1 X2 X3 X4 Y0 Y1 Y2 Y3 Y4 00 00 00 00 00

The X,Y values are 7-bit (5-byte, little-endian) encoded 4-byte unsigned integers:

var type bytesize description
X unsigned int 4 Maximum number of 1-byte blocks
Y unsigned int 4 Available number of 1-byte blocks
Memory usage = (1 - Available number of blocks / Maximum number of blocks) * 100%

Example:

G1 FOUR SysEx:[06 29]
==> [60 04 29 00 00 08 00 4e 3c 3c 01 00 3a 1e 08 00 00 00 00 00 00 00]

[4e 3c 3c 01 00]:maxBytes=3087950
[3a 1e 08 00 00]:freeBytes=134970

usagePct=(1 - 134970/3087950.)*100%=95.6%
mungewell commented 1 year ago

That's awesome!, and should be fairly easy to implement.

How do you envisage this been shown in the GUI? Can you take a screen shot and doodle on it? WX has a 'bar' widget which I used in the tuner app, this works on both Windows and Linux and could be coloured to highlight low available space.

mungewell commented 1 year ago

I've coded this up (I think) for the command line version, can you please check it works as expected.

$ python3 zoomzt2.py -a -I MDL_DOVE.ZD2
Installing effect: MDL_DOVE.ZD2
Percentage disk use: 40.77938043907646
$ python3 zoomzt2.py -a -U RVRSDL3S.ZD2
Uninstalling effect: RVRSDL3S.ZD2
Percentage disk use: 40.77938043907646
$ python3 zoomzt2.py -a -U MDL_DOVE.ZD2
Uninstalling effect: MDL_DOVE.ZD2
Percentage disk use: 40.58461661926482
andresitodemarco commented 1 year ago

I've been trying yesterday in a Windows 10 environment but I can't seem to get the rtmidi extension installed (wrong C++ build tools apparently). Didin't have that much time yesterday, I'll check ASAP using my Raspberry and come back to you. Sorry for the delay.

andresitodemarco commented 1 year ago

OK, just done it on the pi400 (after installing just construct, mido and python-rtmidi) and it seems to be working with my B1Xfour. I uninstalled the ACOSIM.ZD2 effect, checked the pedal to make sure it was removed, then installed it again and checked for it again (was installed back OK). This was the output:

$ python3 zoomzt2.py -a -U ACOSIM.ZD2
Uninstalling effect: ACOSIM.ZD2
Percentage disk use: 98.54304635761589
$ python3 zoomzt2.py -a -I ACOSIM.ZD2
Installing effect: ACOSIM.ZD2
Percentage disk use: 99.47019867549669

Still no luck in my Windows 10 machine, I can't seem to get my C++ build tools (from Visual Studio 2019) recognized by my Python installation, thus can't pip3 install python-rtmidi. Will keep at it tho'. Thanks a ton sir!

andresitodemarco commented 1 year ago

Just made it on Windows 10 too. Had a pending reboot, after that it works great too. So I'm good with build tools from Visual Studio 2019. Same output also. Thanks again!

andresitodemarco commented 1 year ago

Also tested the GUI. Shows the bar and hints the usage % when mouse is over it.

screenshot_gui

mungewell commented 1 year ago

Glad it works for others.

Closing the bug, unless there are suggestions for more improvements.

andresitodemarco commented 1 year ago

For anyone interested I have a current (as of 2022-12-07) Windows 64-bit GUI build here (standalone .exe file).