How to save an image matrix embedded in ableton.

Tugrul Akyuz's icon

Hi,
I want to save a picture I drew on the lcd object as embedded in the ableton file. More generally, or I want to save data inside a jit matrix to ableton file (a song), is this possible? Could pattr and patterstorage work here? I would be very happy if you could help with this.

11OLSEN's icon

If you mean recall something you did draw on a jit.lcd then you have to record all drawing commands in a dict or something that allows parameter mode.

Tugrul Akyuz's icon

Thanks for your reply , It is a good idea to save all lcd command like lineto moveto in dict for recalling, but with the device I am dealing with, one can draw and erase by using mouse (deleting is again a lineto command but by using the background colour) So I wonder if there is a possibility to save all the picture produced , let's say jit.matrix embeded to Ableton song file? Is it a good idea to save jit.matrix (200x200) to dict? or is there something else like dict that allows parameter mode?

11OLSEN's icon

I'm not a jitter expert! Can you somehow get a list out of the jit.matrix that can be used to recall it? Maybe jit.spill, jit.fill, jit.iter? I have no idea. It's worth a try to have it saved with the Liveset. But I'm afraid that is simply to much data.

Tugrul Akyuz's icon

Maybe, I have to save the image to an external file (with unique name) which will be in liveset folder and store that name to ableton liveset . Something similar to audio files that are in sample liveset directory.

11OLSEN's icon

I've put something together by reading out a jit.lcd with the "getpixel" message, saving into a dict and recall on Liveset load with "setpixel" message. The jit.lcd is 165*165 to fit into a device view. That's still 27225 lines with rgb values in the dict. Saving this dict to the Liveset takes 2-3 sec where Live GUI freezes. So automatic saving on changes in the lcd is not an option. It has to be done by the user by pressing a button. I don't know if that could fit your needs as it doesn't make use of a [jit.matrix], only [jit.lcd] and a [jit.pwindow].

It could be further optimized. For example one doesn't has to save pixels where lcd is just showing the background color. Also interessting: what if we use some compression algorhythm we could push even more data to a parameter mode dict. I mean in general not only in this lcd example.

A cool innovation from Ableton/C47 would be a kind of [savebang] right before the Set is saved by the user. The moment to push all relevant data from devices to the Liveset.

test.save_lcd_with_Set.amxd
application/octet-stream 43.88 KB


Tugrul Akyuz's icon

It's a very nice approach. ". For example one doesn't has to save pixels where lcd is just showing the background color.". Yes, with this method, the loading will be very fast.

I also tried to save image to an external file. Very fast loading though. But unfortunately, I couldn't find any clear solution about where the files must be stored and when they are deleted. The attached example saves the file to Desktop with the the name "ImgNo_x_y.png" where x is track and and y is the device number.
So I will try extend your approcah a bit ( without saving background pixel)
Thanks for help.

TugsaveImg.amxd
amxd 37.66 KB

11OLSEN's icon

A better place to save the file would be the folder where your device is stored or the user/documents folder. But in another Liveset your device will load the same file. So it is not related to the Set in any way. Was that your intention?

Tugrul Akyuz's icon

Every liveset will have its on drawn images. (specific and unique to the liveset, even to the ableton tracks) . I will use the image for an audio effect device.

11OLSEN's icon

Ok then if you choose the "save to file" - way you need to add something unique to the filenames.