/* Code to consider suggesting formatting "guidelines". Note that in all following examples, the first example is taken from existing ATK code, and following variations suggest "improvements" (or not!). */
/* Obj.new() or Obj() */
AbstractGridLines { | |
var <>spec; | |
*new { arg spec; | |
^super.newCopyArgs(spec.asSpec).prCheckWarp; | |
} | |
asGrid { ^this } |
// Examples demonstrate alignment based on fs = 48kHz. | |
// SinOsc: the second cycle should begin exactly at | |
// time t = period (centered in the plot). | |
// The last sample should NOT fall on 2*period, | |
// rather within one sample duration before. | |
// Plot/grid extents should still show requested duration. | |
( | |
var period = 0.0005, dur = period * 2; | |
f = { SinOsc.ar(period.reciprocal) }; |
( | |
~getQuat = {|alpha, ang_x, ang_y, ang_z| | |
var rot = sin(alpha/2); | |
var q = Quaternion( | |
cos(alpha/2), | |
rot * cos(ang_x), | |
rot * cos(ang_y), | |
rot * cos(ang_z) | |
); | |
q |
( | |
~win = Window(); | |
~win.layout_(HLayout()); | |
~palettes = IdentityDictionary(know: true); | |
[ | |
\light, | |
// \midlight, // undefinted, see above | |
// \middark, // undefinted, see above | |
\dark, | |
// \shadow,// undefinted, see above |
# (this isn't actually a valid shell script, just instructions for reference) | |
# To supplement the instructions in Assignment #1, Section 3.6, Native audio plugins. | |
# After downloading the "NativePluginCode.zip" from MyCourses, | |
# unpack the provided source code into: /Your/Unity/Project/Folder | |
# i.e., the *contents* of NativePluginCode (not the folder itself) | |
# should be placed in /Your/Unity/Project/Folder. If you've already | |
# started editing the project, e.g. made a "Move.cs" script, there | |
# is likely already "Assets" folder, so move the contents from the | |
# unpacked /Assets folder to the already-existing /Assets folder. |
( | |
// Find *root* of *num* within *eps* precision | |
// https://en.wikipedia.org/wiki/Nth_root_algorithm | |
// eps is precision of converging answer | |
~rootOf = { | num, root, eps = 0.001, initFac = 2, post=true | | |
var cnt = 0; | |
var exp = 0; | |
var two_exp = 1; | |
var guess; | |
var rt_recip = root.reciprocal; |
// notice the endpoint drifts when shrinking window width | |
p = (1, 2 .. 1000).plot.plotMode_(\linear).domainSpecs_([1, 1000, \exp].asSpec).refresh; | |
p.domain_((1, 2 .. 1000)/2).refresh; | |
// note it's a bit hard to see without gridlines working properly! (this PR fixes that too) | |
// illustration of the original problem: | |
( | |
var xs, ys, rs = 0, plt2; | |
// Plotter defaults to a domain of 0 to size-1. | |
// Here we sample, in non-uniform intervals, |
/* Code to consider suggesting formatting "guidelines". Note that in all following examples, the first example is taken from existing ATK code, and following variations suggest "improvements" (or not!). */
/* Obj.new() or Obj() */
HoaMatrix : AtkMatrix { | |
var <directions; | |
// call by subclass, only | |
*newFromFile { |filePathOrName, searchExtensions = true, order = (AtkHoa.defaultOrder)| | |
^super.new('fromFile', order).initFromFile(filePathOrName, searchExtensions) | |
} | |
initDirections { |argDirections| |
HoaMatrix : AtkMatrix { | |
var <directions; | |
// call by subclass, only | |
*newFromFile { |filePathOrName, searchExtensions = true, order = (AtkHoa.defaultOrder)| | |
^super.new('fromFile', order).initFromFile(filePathOrName, searchExtensions) | |
} | |
initDirections { |argDirections| |