Lecture code files: uofi.box.com/s... Problem sets: uofi.box.com/s... Introduction to sequencing, including basic usage of Routines and value Patterns.
Hi Eli, sorry for being the only one commenting on this. But I'm really struggling with what happens at 5'19". According to the Harkins' Supercollider Tutorial, b[0] is synonymous with b.at(0). Why then does b.at(dir.folderName.asSymbol) result in an error and b[dir.folderName.asSymbol] work fine? Indeed i really can't quite work out why b[dir.folderName.asSymbol] puts something in the Event b()? Thanks!
This is actually a very good question. I've encountered this issue very occasionally, but never really stopped to think about it. This took me a few minutes to figure out. Accessing items in an Event (or some other type of Collection) isn't the problem. Both syntax styles work fine: y = (drum: 75, flute: 36, string: 9); y[\flute]; // -> 36 y.at(\flute); // -> 36 But, for whatever reason, trying to assign a new value in a Collection slot fails with the latter of these two syntax styles: y[\flute] = 50; // works y.at(\flute) = 200; // fails I don't actually know what's going on under the hood - a more seasoned SC developer could likely explain the nuance of why this happens. Reflecting on my video, however, I think I'm being sloppy. I shouldn't really be using 'at' (or its syntax shortcut) to modify items. Instead, I should almost certainly be using 'put,' which somehow "feels more correct." So, instead of: b[dir.folderName.asSymbol] = bufArray; I should be expressing this line of code as: b.put(dir.folderName.asSymbol, bufArray); Thanks for this question! I hope my answer clears things up, at least partially.
@@elifieldsteel That's really useful and completely clears up my confusion. I've repeatedly returned to this particular code and was always confounded by that jump. Using b.put makes the process far more clear to me. Thanks for taking the time to explain this... and indeed it did strike me as a bit inconsistent (though it had me thinking for hours rather than minutes!)
You've omitted a period: it is ~f.() rather than ~f(). This is a syntax shortcut for calling 'value' on a function: ~f = { 2 + 2 }; ~f.value; // -> 4 ~f.(); // same result
@@elifieldsteel Ah that's great. Yes I missed the period, though didn't miss it when trying it in different situations and could tell that it was working across my examples. So it's basically just a shortcut then for .value Thanks! P.S. any chance those problem sets might be available again soon?