In lieu of an abstract, here is a brief excerpt of the content:

232 Appendix SAL Commands and Functions The following lists summarize commands and functions used in this book. For details on command syntax and a complete list of functions, see the Nyquist Reference Manual. In some cases optional or keyword parameters are not mentioned here to simplify the presentation. Commands begin-end – execute a sequence of commands. define variable – declare and initialize a variable. define function – declare and define a function. display – print variable names and values. if-then-else – conditionally evaluate commands. load – evaluate the commands in a file. loop-end – iteratively evaluate commands. play – play a sound. print – print the values of expressions to the output window. return – return a value to the function calling expression. set – associate or bind a variable to the value of an expression. with – declare local variables. Functions List Functions length(list) – length of a list or string. first(list), car(list) – first element of a list. second(list) – second element of a list. third(list) – third element of a list. fourth(list) – fourth element of a list. rest(list), cdr(list) – remainder of list after the first element. nth(n, list) – get list element at position n. nthcdr(n, list) – get remainder of list starting at position n. reverse(list) – reverse the order of list. cons(head, list) – construct a list of head followed by list. list(e1, e2, …) – construct a list from elements. append(list1, list2, …) – construct a new list by concatenating lists. member(expr, list) – search for expr in list. Appendix ⋅ SAL Commands and Functions 233 assoc(expr, alist) – look up expr in an association list. intersection(list1, list2) – set intersection, treating lists as sets. union(list1, list2) – set union, treating lists as sets. set-difference(list1, list2) – set difference, treating lists as sets. subsetp(list1, list2) – is list1 a subset of list2? mapcar(function, list1) – apply function to each element of list. Math Functions (See Table 3.3.1 for a list of operators) round(x) – round x to an integer. truncate(x) – round x down to an integer. abs(x) – absolute value of x. min(x, y, …) – minimum value of inputs. max(x, y, …) – maximum value of inputs. interpolate(x, x1, y1, x2, y2) – linear interpolation. random(i) – random integer from 0 to i–1. rrandom() – random float (real) from 0 to 1. real-random(x, y) – random float (real) from x to y. Pattern Functions (See Table 5.3.1 for a list of pattern generators.) next(expr) – get the next item from a pattern object. Predicate (Test) Functions atom(x) – is x an atom? endp(x) – is x the end of a list (nil)? evenp(x) – is x even? floatp(x) – is x a float (real, floating point, flonum)? integerp(x) – is x an integer? listp(x) – is x a list? minusp(x) – is x negative? null(x) – is x nil? numberp(x) – is x a number? oddp(x) – is x odd? plusp(x) – is x positive? symbolp(x) – is x a symbol? zerop(x) – is x zero? Quoting Functions quote(s) – returns expression (or symbol) s without evaluation. keyword(s) – convert (unevaluated) symbol s to a keyword. Score Functions timed-seq(score) – render score returning a sound. Appendix • SAL Commands and Functions [18.224.73.125] Project MUSE (2024-04-25 12:33 GMT) 234 Appendix ⋅ SAL Commands and Functions score-adjacent-events(score, function) – apply function to events. score-append(score1, score2, …) – append scores. score-apply(score1, function) – apply function to each event. score-filter-length(score, cutoff) – remove notes playing past cutoff. score-get-begin(score) – get the begin time. score-get-end(score) – get the end time. score-index-of(score, function) – find first note satisfying function. score-last-index-of(score, function) – last note satisfying function. score-merge(score1, score2, …) – create score combining all notes. score-play(score) – render a score to sound and play it. score-randomize-start(score, amt) – perturb note start times. score-read-smf(filename) – read standard MIDI file into a score. score-repeat(score, n) – repeat a score n times. score-scale(score, keyword, x) – scale each keyword’s value by x. score-select(score, function) – select notes that satisfy function. score-set-begin(score, time) – set score beginning to time. score-set-end(score, time) – set score ending to time. score-sort(score) – sort events in score into time order. score-sustain(score, x) – scale each note duration by x. score-transpose(score, keyword, x) – add x to each keyword value. score-voice(score, list) – replace...

Share