Hi, I’m trying to write something that creates an array of data from a multislider (for example) then writes it as a “preset” in a separate file, perhaps a CSV with one line per “preset”.
Is there an idiomatic SuperCollider way to do this? I don’t want to reinvent the wheel or stumble into an antipattern. Hints as to useful classes, libraries or quarks would be appreciated. Thanks!
Hi! I assume you have the values stored in a collection somewhere? I’m not sure if anyone has anything better, but I use the_collection.cs to get a compile string for the collection, then I write that to a file. To load, I load from that file’s string a la "/my/cool/file".load() which will give me that collection again, and then I reapply the slider values.
If you don’t care too much about it being human readable, just use writeArchive and readArchive:
a = Array.fill(400, {rrand(0,2200)});
a.writeArchive("/Users/spluta1/Documents/SC/test");
b = Object.readArchive("/Users/spluta1/Documents/SC/test");
b.postln;
Excellent - this sounds like precisely what I need, and I don’t have to reinvent the wheel. Thank you so much!
I would have never thought to look at something called JITLibExtensions, expecting it to save control values. There’s a bit of a discoverability problem with Quarks. When I browse Quarks in the IDE there’s no info on what they do, sometimes not even if you click through to visit the repository.
I’m a learner like you, and I compleatly agree, it would be nice to find a way to highlight what is already available.
I discover the Ndefpreset thing, just because a friend of mine told me…
It’s a pity! It would be nice, now that everyone has moved here and the mailing-list has been “archived”, to make a thread dedicated to the content and functionality of the various Quarks.
VarGui from miSCellaneous_lib quark has save and load functionality, see Ex. 6 of the helpfile “VarGui shortcut builds”. For a quick intro to VarGui see “Tour 1” of “Introduction to miSCellaneous”.
I’d like to see a meta-search-engine that indexes the builtin help files, the Quarks by keyword, sccode.org, and probably some other stuff I can’t think of at the moment. Oh yes, this forum!
See, this turned out to be an embarrassment of riches, all hidden behind obscure Quark names like miSCellaneous_lib and JITLibExtensions. Thank you, this one looks especially well suited to my needs.