What do you use dictionaries for ?

Oct 6, 2013 at 6:04am

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.

#267208
Oct 6, 2013 at 6:14am

I use them when I think I am starting to understand max.

- takes me down a notch. It’s nice. :-/

#267210
Oct 6, 2013 at 2:00pm

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.

#267261
Oct 8, 2013 at 1:31am

“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?

#267415
Oct 8, 2013 at 3:02am

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

#267422
Oct 8, 2013 at 11:50am

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.

#267467
Oct 8, 2013 at 12:14pm

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.

#267470
Oct 8, 2013 at 12:22pm

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.

#267471
Oct 8, 2013 at 8:53pm

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.

#267517
Oct 9, 2013 at 8:44am

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…

#267567
Oct 9, 2013 at 3:36pm

…and is anyone aware of any dict tutorials or other learning resources around, other than c74 documentation?

#267635
Oct 9, 2013 at 3:47pm

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.

#267636
Oct 9, 2013 at 4:22pm

seems like a good introduction/start; would be nice to know about other dict objects/functionality too

#267640
Oct 9, 2013 at 7:29pm

“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!

#267646
Oct 9, 2013 at 11:51pm

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.

#267656
Oct 10, 2013 at 12:27am

^i agree with Wetterberg.
also, from the video, Sam spoke, “sure as shit forget about Pure Data”
what a dict-thing-to-say! ;p
(thanks to PD we’ve got PDlib which allows for awesome things on iOS and Android, and the only thing similar with Max is the pathetic ‘Mira’ which is not at all like bringing the best functions of max to iOS… but more like a rich-yuppie’s remote-control for the laptop which they’re too high-maintenance to place in their lap :p)

#267659
Oct 10, 2013 at 12:44am

^i disagree with the asswipe. Mira is great to avoid repetitive stress syndrome, or avoid being intimately involved with your computer. I use it everyday, because it allows me to hold a glass of champagne in one hand, keep a boar’s head in my lap to feast off of, and control my max patches with the other hand by mundanely tapping on a pane of glass like it’s actually expressive :D

(also, the tutorial may not be a great ‘introduction’ but it sure as shit gets to more interesting usage quicker than an introduction might. still… on the other hand, anytime i hear someone say that a max patch looks ‘sexy’, i hear something like a jedi-mind-trick in my head: “this isn’t the dork you’re looking for”…. haha, that Sam, got alot of… strangely directed passion :D)

#267660
Oct 10, 2013 at 4:58pm

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.

#267718

You must be logged in to reply to this topic.