What do you use dictionaries for ?
Hello,
Theoretically dictionaries seem to be a nice addition to Max, but I really do not see any obvious use in my own patches.
So I'd be curious to know how Max users are using them in their projects.
Thank you in advance.
I use them when I think I am starting to understand max.
- takes me down a notch. It's nice. :-/
The project that I used as an excuse to get my head around dictionaries was an editor/librarian for a synth with a very complex voice architecture and midi spec.
Parsing sysex dumps into a dict for storage, editing, formatting into osc for transmission over udp, etc was a huge improvement over using, say, colls for the same tasks, and in general I've tended to stick with dicts whenever I've had to parse and manage large amounts of raw midi data in human-readable and easily maintained patches.
The ability to reference the same dict throughout a multi-level patch and pull values out of it with chained pairs of dict.iter and route objects is also very conducive to clean, comprehensible abstractions, which is always a plus imo. Further to that, I am only just getting into javascript in Max after having studiously ignored it for about a decade and I'm given to understand that I will find dicts very well integrated with js.
Just one example; I'm sure there are tons more.
"The ability to reference the same dict throughout a multi-level patch[...]"
That part is possible with coll too.
Please correct me if I'm wrong:
Dicts use hashing and therefore have a way better lookup time than colls. So, if you have large amounts of data and need to look it up fast, you should stick to dicts instead of colls.
True?
Dicts use hashing and therefore have a way better lookup time than colls.
not sure it's faster, it might well be true... though, it's undoubtedly more practical than coll in those cases
query time is a good question though
I tried to use dict about a year ago to manage a database of audio clips with associated tags. After struggling with it a bit I moved on to SQLite.
I started using Dictionaries a couple months ago after realizing Coll doesn't save in a live set.
It may take a little more work than Coll, but remember you can transfer between the 2 really easily with the push/Pull_to/from_Coll, so you could still use a Coll like you normally have but keep the dict in there to save the data and then pull it when you reload the patch. Personally I'd rather just get used to knowing dict better and leave coll behind except for simpler smaller tasks that doesn't require saving.
Where I'm really going to get some use out of it is a larger patch I'm revising for a controller, so instead of having to constantly poll the liveApi for everything, it can reference the dict instead, since it will gather all the info I need on initialization, and then it will just add/subtract any new info. This should increase the speed and cut down on a lot of processing.
I tried to use dict about a year ago to manage a database of audio clips with associated tags. After struggling with it a bit I moved on to SQLite.
welp. that's disheartening.
I've been using dictionaries for a Max for Live device that stores information gathered from the Live API, making it accessible to other devices. It stores the data in a structure very similar to the live object model, lots of sub-dictionaries. Hoping to experiment with sending the data over udp to a visual artist on a different computer too.
It's not finished yet but most of the basic functionality is there. I've attached a copy if anyone wants to have a look.
Drop it on a track, open the max for live print window, turn on the "Print" toggle button on the device then click the "Init" button.
You should see all the information the device stores printed to the max window in dictionary format i.e "::" to signify sub-dictionaries.
At the bottom of the device there's a text edit object where you can type in commands to send to the live api. For example typing "live_set tracks 0 set mute 1" and hitting enter will mute track 1.
Thank you guys for these interesting insights !
The better lookup time compared to coll is an interesting asset. So that's another buch of objects to learn using...
...and is anyone aware of any dict tutorials or other learning resources around, other than c74 documentation?
yeah, I was kind of hoping for that, too.
These are the closest I've come, and they're not exactly... the ones that help you learn how to use dict, hehe.
https://www.youtube.com/watch?v=MqUNSJS_8kY
seems like a good introduction/start; would be nice to know about other dict objects/functionality too
“The ability to reference the same dict throughout a multi-level patch[...]”
That part is possible with coll too.
Of course; didn't say that it wasn't!
seems like a good introduction/start;
I wouldn't say so, I think it's an odd angle to approach from. Don't get me wrong, I think it's fun, but I didn't learn how to use the system.
also, the tutorial may not be a great ‘introduction’ but it sure as shit gets to more interesting usage quicker than an introduction might.
Of course; but if you're still unable to use dict after watching the tutorial, then it's merely a demonstration, or paint-by-numbers.
This isn't characteristic of Sams videos, and it doesn't make it a bad video at all; It's just not really useful to me as a tutorial, hehe.