sc/utilities [ Modules ]

[ Top ] [ Modules ]

NAME

 utilities

 File:             utilities.lsp

 Class Hierarchy:  none: no classes defined

 Version:          1.0.0-beta2

 Project:          slippery chicken (algorithmic composition)

 Purpose:          Various helper functions of a general nature.

 Author:           Michael Edwards: m@michael-edwards.org

 Creation date:    June 24th 2002

 $$ Last modified: 17:47:02 Thu May 17 2012 BST

 SVN ID: $Id: utilities.lsp 1982 2012-05-24 15:35:54Z medward2 $

utilities/all-members [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Find out whether the members of the list given as the second argument are
 all present in the list given as the first argument.

ARGUMENTS

 - A list in which the members of the second argument will be sought. 
 - A list whose members will be sought in the first argument.
 
 OPTIONAL ARGUMENT
 - A comparison function.

RETURN VALUE

 T or NIL.

EXAMPLE

(all-members '(1 2 3 4 5 6 7) '(1 2 3 7))

=> T

SYNOPSIS

(defun all-members (list test-list &optional (test #'equal))

utilities/almost-zero [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return T if a given decimal is within 0.000001 of 0.0.

ARGUMENTS

 - A number.

OPTIONAL ARGUMENTS

 - A number that is a user-specified difference for the comparison test. 

RETURN VALUE

 T if the number is within the tolerance difference to zero, otherwise NIL. 

EXAMPLE

(almost-zero 0.0000007)

=> T

SYNOPSIS

(defun almost-zero (num &optional (tolerance 0.000001))

utilities/amp2db [ Methods ]

[ Top ] [ utilities ] [ Methods ]

DESCRIPTION

 Convert a standard digital amplitude value (>0.0 to 1.0) to a corresponding
 decibel value.

ARGUMENTS

 - A decimal number between >0.0 and 1.0.

RETURN VALUE

 A decimal number that is a value in decibel.

EXAMPLE

(amp2db 0.3)

=> -10.457575

SYNOPSIS

(defmacro amp2db (amp)

utilities/amplitude-to-dynamic [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Convert a specified digital amplitude between 0.0 and 1.0 to a
 corresponding dynamic between niente and ffff.

ARGUMENTS

 - A decimal number between 0.0 and 1.0.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether to print a warning if the specified
   amplitude is <0.0 or >1.0. T = warn. Default = T.

RETURN VALUE

 A symbol that is a dynamic level.

EXAMPLE

(amplitude-to-dynamic 0.3)

=> PP

SYNOPSIS

(defun amplitude-to-dynamic (amp &optional (warn t))

utilities/between [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return a random number between two specified numbers. If the two numbers
 are integers, the random selection is inclusive. If they are decimal
 numbers, the result cannot be absolutely inclusive. 

ARGUMENTS

 - A first, lower, number.
 - A second, higher, number. 

 NB: The first number must always be lower than the second.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether the random seed should be fixed.
 - If fixed-random is set to T, a function must be given for <restart> to
   reset the seed (see below)

RETURN VALUE

 An integer if both numbers are integers, or a float if one or both are
 decimal numbers.

EXAMPLE

;;; Using the defaults. This will produce a different result each time.
(loop repeat 10 collect (between 1 100))

=> (43 63 26 47 28 2 99 93 66 23)

;;; Setting fixed-random to T and using zerop to reset the random when i is 0 
(loop repeat 5 
   collect (loop for i from 0 to 9 collect (between 1 100 t (zerop i))))

=> ((93 2 38 81 43 19 70 18 44 26) (93 2 38 81 43 19 70 18 44 26)
    (93 2 38 81 43 19 70 18 44 26) (93 2 38 81 43 19 70 18 44 26)
    (93 2 38 81 43 19 70 18 44 26))

SYNOPSIS

(defun between (low high &optional fixed-random restart)

utilities/combine-into-symbol [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Combine a sequence of elements of any combination of type string, number,
 or symbol into a symbol.

ARGUMENTS

 - A sequence of elements.

RETURN VALUE

 A symbol as the primary value, with the length of that symbol as a
 secondary value.

EXAMPLE

(combine-into-symbol "test" 1 'a)

=> TEST1A, 6

SYNOPSIS

(defun combine-into-symbol (&rest params)

utilities/db2amp [ Methods ]

[ Top ] [ utilities ] [ Methods ]

DESCRIPTION

 Convert a decibel value to a standard digital amplitude value (>0.0 to 1.0),
 whereby 0dB = 1.0.

ARGUMENTS

 - A number that is a value in decibel.

RETURN VALUE

 A decimal number between >0.0 and 1.0.

EXAMPLE

(db2amp -3)

=> 0.70794576

SYNOPSIS

(defmacro db2amp (db)

utilities/decimal-places [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DATE

 19-Mar-2012

DESCRIPTION

 Round the given number to the specified number of decimal places.

ARGUMENTS

 - A number.
 - An integer that is the number of decimal places to which to round the
   given number.

RETURN VALUE

 A decimal number.

EXAMPLE

(decimal-places 1.1478349092347 2)

=> 1.15

SYNOPSIS

(defun decimal-places (num places)

utilities/dynamic-to-amplitude [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Convert a symbol that is a dynamic level between niente and ffff to a
 corresponding digital amplitude value between 0.0 and 1.0.

ARGUMENTS

 - A symbol that is a dynamic level between niente and fff.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether to print a warning when the symbol specified
   is not recognized as a dynamic. T = warn. Default = T.

RETURN VALUE

 A decimal number between 0.0 and 1.0.

EXAMPLE

(dynamic-to-amplitude 'fff)

=> 0.9

SYNOPSIS

(defun dynamic-to-amplitude (dynamic &optional (warn t))

utilities/econs [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Add a specified element to the end of an existing list.

ARGUMENTS

 - A list.
 - An element to add to the end of the list.

RETURN VALUE

 A new list.

EXAMPLE

(econs '(1 2 3 4) 5)

=>  '(1 2 3 4 5)

SYNOPSIS

(defun econs (list new-back)

utilities/env-plus [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Increase all y values of a given list of break-point pairs by a specified
 amount.

ARGUMENTS

 - An envelope in the form of a list of break-point pairs.
 - A number that is the amount by which all y values of the given envelope
   are to be increased.

RETURN VALUE

 A list of break-point pairs.

EXAMPLE

(env-plus '(0 0 25 11 50 13 75 19 100 23) 7.1)

=> (0 7.1 25 18.1 50 20.1 75 26.1 100 30.1)

SYNOPSIS

(defun env-plus (env add)

utilities/env-symmetrical [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Create a new list of break-point pairs that is symmetrical to the original
 around a specified center. If no center is specified, the center value
 defaults to 0.5

ARGUMENTS

 - An envelope in the form of a list of break-point pairs.

OPTIONAL ARGUMENTS

 - A number that is the center value around which the values of the
   new list are to be symmetrical.
 - A number that is to be the minimum value for the y values returned.
 - A number that is to be the maximum value for the y values returned.

RETURN VALUE

 An envelope in the form of a list of break-point pairs.

EXAMPLE

;;; Default center is 0.5
(env-symmetrical '(0 0 25 11 50 13 75 19 100 23))

=> (0 1.0 25 -10.0 50 -12.0 75 -18.0 100 -22.0)

;; Specifying a center of 0
(env-symmetrical '(0 0 25 11 50 13 75 19 100 23) 0)

=> (0 0.0 25 -11.0 50 -13.0 75 -19.0 100 -23.0)

;;; Specifying minimum and maximum y values for the envelope returned
(env-symmetrical '(0 0 25 11 50 13 75 19 100 23) 0 -20 -7)

=> (0 -7 25 -11.0 50 -13.0 75 -19.0 100 -20)

SYNOPSIS

(defun env-symmetrical (env &optional (centre .5) 
                        (min most-negative-double-float)
                        (max most-positive-double-float))

utilities/equal-within-tolerance [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Test whether the difference between two decimal numbers falls within a
 specified tolerance.

 This test is designed to compensate for calculation discrepancies caused by
 floating-point errors (such as 2.0 vs. 1.9999997), in which the equations
 should yield equal numbers. It is intended to be used in place of = in such
 circumstances.

ARGUMENTS

 - A first number.
 - A second number.

OPTIONAL ARGUMENTS

 - A decimal value that is the maximum difference allowed between the two
   numbers that will still return T. Default = 0.000001d0.

RETURN VALUE

 T if the two tested numbers are equal within the specified tolerance,
 otherwise NIL.

EXAMPLE

;; An example of floating-point error
(loop for i from 0.0 below 1.1 by 0.1 collect i)

=> (0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.70000005 0.8000001 0.9000001 1.0000001) 

;; Using =
(loop for i from 0.0 below 1.1 by 0.1 
   for j in '(0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0)
   collect (= i j))

=> (T T T T T T T NIL NIL NIL NIL)

;; Using equal-within-tolerance
(loop for i from 0.0 below 1.1 by 0.1 
   for j in '(0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0)
   collect (equal-within-tolerance i j))

=> (T T T T T T T T T T T)

SYNOPSIS

(defun equal-within-tolerance (a b &optional (tolerance 0.000001d0))

utilities/factor [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Boolean test to check if a specified number is a multiple of a second
 specified number.

ARGUMENTS

 - A number that will be tested to see if it is a multiple of the second
   number. 
 - A second number that is the base number for the factor test.

RETURN VALUE

 T if the first number is a multiple of the second number, otherwise NIL.

EXAMPLE

(factor 14 7)

=> T

SYNOPSIS

(defun factor (num fac)

utilities/flatten [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return a list of nested lists of any depth as a flat list.

ARGUMENTS

 - A list of nested lists.

RETURN VALUE

 A flat list.

EXAMPLE

(flatten '((1 (2 3 4) (5 (6 7) (8 9 10 (11) 12)) 13) 14 15 (16 17)))

=> (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)

SYNOPSIS

(defun flatten (nested-list)

utilities/force-length [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DATE

 03-FEB-2011

DESCRIPTION

 Create a new a list of a specified new length by adding or removing items
 at regular intervals from the original list. If adding items and the list
 contains numbers, linear interpolation will be used, but only between two
 adjacent items; i.e. not with a partial increment.

 NB: The function can only create new lists that have a length between 1 and
     1 less than double the length of the original list.

ARGUMENTS

 - A flat list.
 - A number that is the new length of the new list to be derived from the
   original list. This number must be a value between 1 and 1 less than
   double the length of the original list.

RETURN VALUE

EXAMPLE

;;; Shortening a list
(force-length (loop for i from 1 to 100 collect i) 17)

=> (1 7 13 20 26 32 39 45 51 57 63 70 76 82 89 95 100)

;;; Lengthening a list
(force-length (loop for i from 1 to 100 collect i) 199)

=> (1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12
    12.5 13 13.5 14 14.5 15 15.5 16 16.5 17 17.5 18 18.5 19 19.5 20 20.5 21
    21.5 22 22.5 23 23.5 24 24.5 25 25.5 26 26.5 27 27.5 28 28.5 29 29.5 30
    30.5 31 31.5 32 32.5 33 33.5 34 34.5 35 35.5 36 36.5 37 37.5 38 38.5 39
    39.5 40 40.5 41 41.5 42 42.5 43 43.5 44 44.5 45 45.5 46 46.5 47 47.5 48
    48.5 49 49.5 50 50.5 51 51.5 52 52.5 53 53.5 54 54.5 55 55.5 56 56.5 57
    57.5 58 58.5 59 59.5 60 60.5 61 61.5 62 62.5 63 63.5 64 64.5 65 65.5 66
    66.5 67 67.5 68 68.5 69 69.5 70 70.5 71 71.5 72 72.5 73 73.5 74 74.5 75
    75.5 76 76.5 77 77.5 78 78.5 79 79.5 80 80.5 81 81.5 82 82.5 83 83.5 84
    84.5 85 85.5 86 86.5 87 87.5 88 88.5 89 89.5 90 90.5 91 91.5 92 92.5 93
    93.5 94 94.5 95 95.5 96 96.5 97 97.5 98 98.5 99 99.5 100)

SYNOPSIS

(defun force-length (list new-len)

utilities/get-harmonics [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return a list of the harmonic partial frequencies in Hertz above a
 specified fundamental frequency.

ARGUMENTS

 - A number that is the fundamental frequency in Hertz.

OPTIONAL ARGUMENTS

 keyword arguments
 - :start-at. An integer that is the number of the first harmonic partial to
   return. Default = 1.
 - :min-freq. A number that is the lowest frequency in Hertz to
   return. Default = 20.
 - :max-freq. A number that is the highest frequency in Hertz to
   return. Default = 20000.

RETURN VALUE

 A list of numbers that are the frequencies in Hertz of harmonic partials
 above the same fundamental frequency.

EXAMPLE

;;; Get the first 15 harmonic partials above a fundamental pitch of 64 Hertz,
;;; starting with partial 2, and specifying an upper cut-off of 1010 Hz.

(get-harmonics 63 :start-at 2 :max-freq 1010)

=> (126 189 252 315 378 441 504 567 630 693 756 819 882 945 1008)

SYNOPSIS

(defun get-harmonics (fundamental &key (start-at 1) (min-freq 20)
                      (max-freq 20000))

utilities/get-sublist-indices [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Get the starting position of sublists within a list as though the complete
 set of items were a flat list.

ARGUMENTS

 - A list of lists.

RETURN VALUE

 A list of integers that are the indices of the sublists.

EXAMPLE

(get-sublist-indices '((1 2) (3 4 5 6) (7 8 9) (10 11 12 13 14) (15)))

=> (0 2 6 9 14)

SYNOPSIS

(defun get-sublist-indices (list)

utilities/get-sublist-lengths [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Get the lengths of all sublists in a given list.

ARGUMENTS

 - A list of lists.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether to first remove zeros caused by empty
   sublists from the result.

RETURN VALUE

 A list of integers.

EXAMPLE

;; Straightforward usage allows zeros in the result
(get-sublist-lengths '((1 2) (3 4 5 6) (7 8 9) (10 11 12 13 14) ()))

=> (2 4 3 5 0)

;; Setting the optional argument to T removes zeros from the result

(get-sublist-lengths '((1 2) (3 4 5 6) (7 8 9) (10 11 12 13 14) ()) t)

=> (2 4 3 5)

SYNOPSIS

(defun get-sublist-lengths (list &optional (remove-zeros nil))

utilities/hailstone [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Implementation of the Collatz conjecture (see
 http://en.wikipedia.org/wiki/Collatz_conjecture )

 The Collatz conjecture suggests that by starting with a given number, and
 if it is even dividing it by two or if it is odd multiplying it by three
 and adding one, then repeating with the new result, the process will
 eventually always result in one.

ARGUMENTS

 - A number to start with.

RETURN VALUE

 A list of the results collected from each iteration starting with the
 specified number and ending with one.

EXAMPLE

(hailstone 11)

=> (11 34 17 52 26 13 40 20 10 5 16 8 4 2 1)

SYNOPSIS

(defun hailstone (n)

utilities/hz2ms [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Convert a frequency in Hertz to the equivalent number of milliseconds. 

ARGUMENTS

 - A number that is a Hertz frequency.

RETURN VALUE

 A number that is the millisecond equivalent of the specified Hertz
 frequency. 

EXAMPLE

(hz2ms 261.63)

=> 3.8221915

SYNOPSIS

(defun hz2ms (hertz)

utilities/interpolate [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Get the interpolated value at a specified point within an envelope. The
 envelope must be specified in the form of a list of break-point pairs.

ARGUMENTS

 - A number that is the point within the specified envelope for which to
   return the interpolated value.
 - A list of break-point pairs.

OPTIONAL ARGUMENTS

 keyword arguments:
 - :scaler. A number that is the factor by which to scale the values of
   the break-point pairs in the given envelope before retrieving the
   interpolated value. Default = 1.
 - :exp. A number that is the exponent to which the result should be
   raised. Default = 1.
 - :warn. T or NIL to indicate whether the method should print a warning if
   the specified point is outside of the bounds of the x-axis specified in
   the list of break-point pairs. T = warn. Default = T.

RETURN VALUE

EXAMPLE

;;; Using the defaults
(interpolate 50 '(0 0 100 1))

=> 0.5

;;; Specifying a different scaler
(interpolate 50 '(0 0 100 1) :scaler 2)

=> 1.0

;;; Specifying a different exponent by which the result is to be raised
(interpolate 50 '(0 0 100 1) :exp 2)

=> 0.25

SYNOPSIS

(defun interpolate (point env &key (scaler 1) (exp 1) (warn t))

utilities/list-to-string [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Convert a list to a string.

ARGUMENTS

 - A list.

OPTIONAL ARGUMENTS

 - A string that will serve as a separator between the elements. 
   Default = " ".
 - T or NIL to indicate whether a list value of NIL is to be returned as
   "NIL" or NIL. T = "NIL" as a string. Default = T.

RETURN VALUE

EXAMPLE

;;; Using defaults
(list-to-string '(1 2 3 4 5))

=> "1 2 3 4 5"

;;; Specifying a different separator
(list-to-string '(1 2 3 4 5) "-")

=> "1-2-3-4-5"

;;; A NIL list returns "NIL" as a string by default
(list-to-string NIL)

=> "nil"

;;; Setting the second optional argument to NIL returns a NIL list as NIL
;;; rather than as "NIL" as a string
(list-to-string NIL "" nil)

=> NIL

SYNOPSIS

(defun list-to-string (list &optional (separator " ") (nil-as-string t))

utilities/logarithmic-steps [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Create a list of progressing from the first specified argument to the
 second specified argument over the specified number of steps using an
 exponential curve rather than linear interpolation.

ARGUMENTS

 - A number that is the starting value in the resulting list.
 - A number that is the ending value in the resulting list.
 - An integer that will be the length of the resulting list - 1.

OPTIONAL ARGUMENTS

 - A number that will be used as the exponent when determining the
   exponential interpolation between values. Default = 2.

RETURN VALUE

 A list of numbers.

EXAMPLE

(logarithmic-steps 1 100 19)

=> (1.0 1.3055556 2.2222223 3.75 5.888889 8.638889 12.0 15.972222 20.555555
    25.75 31.555555 37.97222 45.0 52.63889 60.88889 69.75 79.22222 89.30556
    100.0)

SYNOPSIS

(defun logarithmic-steps (low high num-steps &optional (exponent 2))

utilities/middle [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Get the number value that is middle of two number values.

ARGUMENTS

 - A first number.
 - A second number.

RETURN VALUE

 A number.

EXAMPLE

(middle 7 92)

=> 49.5

SYNOPSIS

(defun middle (lower upper)

utilities/mins-secs-to-secs [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Derive the number of seconds from a minutes-seconds value that is indicated
 as a two-item list in the form '(minutes seconds).

ARGUMENTS

 - A two-item list of integers in the form '(minutes seconds).

RETURN VALUE

 A decimal number that is a number in seconds.

EXAMPLE

(mins-secs-to-secs '(2 1))

=> 121.0

SYNOPSIS

(defun mins-secs-to-secs (list)

utilities/move-elements [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DATE

 02-Mar-2011

DESCRIPTION

 Move the specified elements from one list (if they are present in that
 list) to another, deleting them from the first.

ARGUMENTS

 - A list of elements that are the elements to be moved.
 - A list from which the specified elements are to be moved and deleted.
 - A list to which the specified elements are to be moved.

OPTIONAL ARGUMENTS

 - A predicate by which to test that the specified elements are equal to
   elements of the source list. Default = #'eq.

RETURN VALUE

 Two values: A first list that is the source list after the items have been
 moved; a second list that is the target list after the items have been
 moved. 

EXAMPLE

(move-elements '(3 5 8) '(1 2 3 4 5 6 7 8 9) '(a b c d e))

=> (1 2 4 6 7 9), (8 5 3 A B C D E)

SYNOPSIS

(defun move-elements (what from to &optional (test #'eq))

utilities/move-to-end [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DATE

 22-May-2011

DESCRIPTION

 Move a specified element of a given list to the end of the list, returning
 the new list. 

 NB: If the element exists more than once in the given list, all but on of
     the occurrences will be removed and only one of them will be placed at
     the end.

ARGUMENTS

 - An item that is an element of the list that is the second argument.
 - A list.

RETURN VALUE

 A list.

EXAMPLE

;;; All unique items
(move-to-end 2 '(1 2 3 4 5))

=> (1 3 4 5 2)

;;; Duplicate items
(move-to-end 2 '(1 2 3 2 4 2 5))

=> (1 3 4 5 2)

SYNOPSIS

(defun move-to-end (what list &optional (test #'eql))

utilities/nconc-sublists [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Concatenate corresponding sublists of a given list. Each sublist in the
 argument should have the same length and number of sublists etc.

ARGUMENTS

 A list of lists.

RETURN VALUE

 A list of lists.

EXAMPLE

(nconc-sublists '(((1 2) (a b) (cat dog)) 
                  ((3 4) (c d) (bird fish)) 
                  ((5 6) (e f) (pig cow))))

=> ((1 2 3 4 5 6) (A B C D E F) (CAT DOG BIRD FISH PIG COW))

SYNOPSIS

(defun nconc-sublists (lists)

utilities/nearest-power-of-2 [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return the closest number to the specified value that is a power of two but
 not greater than the specified value.

ARGUMENTS

 - A number.

RETURN VALUE

 An integer that is a power of two.

EXAMPLE

(nearest-power-of-2 31)

=> 16

(nearest-power-of-2 32)

=> 32

(nearest-power-of-2 33)

=> 32

SYNOPSIS

(defun nearest-power-of-2 (num)

utilities/octave-freqs [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 A boolean test to determine whether two specified frequencies are octave
 transpositions of the same pitch class. 

ARGUMENTS

 - A first number that is a frequency in Hertz.
 - A second number that is a frequency in Hertz.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether identical frequencies ("unison") are also
   to be considered octave transpositions of the same pitch class. 
   T = unisons are also octaves. Default = T.

RETURN VALUE

 T or NIL.

EXAMPLE

(octave-freqs 261.63 2093.04)

=> T

(octave-freqs 261.63 3000.00)

=> NIL

(octave-freqs 261.63 261.63)

=> T

(octave-freqs 261.63 261.63 nil)

=> NIL

SYNOPSIS

(defun octave-freqs (freq1 freq2 &optional (unison-also t))

utilities/parse-audacity-label-file-for-loops [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

(defun parse-audacity-label-file-for-loops (label-file)

utilities/parse-wavelab-marker-file-for-loops [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

(defun parse-wavelab-marker-file-for-loops
    (marker-file &key (sampling-rate 44100) (max-length 1.0))

utilities/partial-freqs [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DATE

 13-Dec-2011

DESCRIPTION

 A Boolean test to determine whether either of two specified frequencies
 can be considered a harmonic partial of the other.

ARGUMENTS

 - A first frequency in Hertz.
 - A second frequency in Hertz.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether identical frequencies ("unison") are also to
   be considered partials of each other. T = unison are partials. 
   Default = T.

RETURN VALUE

 T if one of the frequencies has the ratio of a harmonic partial to the
 other, otherwise NIL.

EXAMPLE

(partial-freqs 300 900)

=> T

(partial-freqs 300 700)

=> NIL

(partial-freqs 300 300)

=> T

(partial-freqs 300 300 nil)

=> NIL

SYNOPSIS

(defun partial-freqs (freq1 freq2 &optional (unison-also t))

utilities/power-of-2 [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Test whether the specified number is a power of two and return the
 logarithm of the specified number to base 2.

 This method returns two values: T or NIL for the test and a decimal that is
 the logarithm of the specified number to base 2.

ARGUMENTS

 - A number.

RETURN VALUE

 Two values: T or NIL for the test and a decimal number that is the
 logarithm of the specified number to base 2.

EXAMPLE

(power-of-2 16)

=> T, 4.0

(power-of-2 17.3)

=> NIL, 4.1127

SYNOPSIS

(defun power-of-2 (float)

utilities/pts2cm [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Convert a specified number of points to a length in centimeters at a
 resolution of 72ppi

ARGUMENTS

 - A number.

RETURN VALUE

 A number.

EXAMPLE

(pts2cm 150)

=> 5.2916665

SYNOPSIS

(defun pts2cm (points)

utilities/random-amount [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return a random number from within a total range of <percent> of the given number, 
 centering around zero. Thus, if the <number> is 100, and the <percent> is 5, the 
 results will be a random number between -2.5 and +2.5.

ARGUMENTS

 A number.

OPTIONAL ARGUMENTS

 A number that will be a percent of the given number.

RETURN VALUE

 A random positive or negative number.

EXAMPLE

;;; Using the default will return numbers within a 5% span of the given number, 
;;; centering around zero. With 100 that means between -2.5 and +2.5.
(loop repeat 10 collect (random-amount 100))

=> (0.7424975 -1.4954442 -1.7126495 1.5918689 -0.43478793 -1.7916341 -1.9115914
    0.8541988 0.057197176 2.0713913)

;;; Specifying 10% of 80 will return random numbers between -4.0 and +4.0
(loop repeat 10 collect (random-amount 80 10))

=> (-0.66686153 3.0387697 3.4737322 -2.3753185 -0.8495751 -0.47580242
    -0.25743783 -1.1395472 1.3560238 -0.5958566)

SYNOPSIS

(defun random-amount (number &optional (percent 5))

utilities/random-from-list [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return a random element from a specified list of elements. 

ARGUMENTS

 - A list.

OPTIONAL ARGUMENTS

 - An integer can be passed stating the length of the list, for more
   efficient processing. NB: There is no check to ensure this number is
   indeed the length of the list. If the number is less than the length of
   the list, only elements from the first part of the list will be
   returned. If it is greater than the length of the list, the method may
   return NIL.

RETURN VALUE

 An element from the specified list.

EXAMPLE

(random-from-list '(3 5 7 11 13 17 19 23 29))

=> 13

SYNOPSIS

(defun random-from-list (list &optional list-length) ; for efficiency

utilities/randomise [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return a random decimal number close to the number specified (within a
 certain percentage of that number's value).

ARGUMENTS

 - A number.

OPTIONAL ARGUMENTS

 - A number that is a percentage value, such that any random number returned
   will be within that percentage of the original number's value. 
   Default = 5.

RETURN VALUE

 A decimal number.

EXAMPLE

(loop repeat 10 collect (randomise 100))

=> (99.413795 99.15346 98.682014 100.76199 97.74929 99.05693 100.59494 97.96452
    100.42091 100.01329)

SYNOPSIS

(defun randomise (number &optional (percent 5))

utilities/read-from-file [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Read a Lisp expression from a file. This is determined by the Lisp
 parenthetical syntax.

ARGUMENTS

 - A string that is a file name including directory path and extension. 

RETURN VALUE

 The Lisp expression contained in the file.

EXAMPLE

(read-from-file "/path/to/lisp-lorem-ipsum.txt")

=> (LOREM IPSUM DOLOR SIT AMET CONSECTETUR ADIPISCING ELIT CRAS CONSEQUAT
    CONVALLIS JUSTO VITAE CONSECTETUR MAURIS IN NIBH VEL EST TEMPUS LOBORTIS
    SUSPENDISSE POTENTI SED MAURIS MASSA ADIPISCING VITAE DIGNISSIM CONDIMENTUM
    VOLUTPAT VEL FELIS FUSCE AUGUE DUI PULVINAR ULTRICIES IMPERDIET SED
    PHARETRA EU QUAM INTEGER IN VULPUTATE VELIT ALIQUAM ERAT VOLUTPAT VIVAMUS
    SIT AMET ORCI EGET EROS CONSEQUAT TINCIDUNT NUNC ELEMENTUM ADIPISCING
    LOBORTIS MORBI AT LOREM EST EGET MATTIS ERAT DONEC AC RISUS A DUI MALESUADA
    LOBORTIS AC AT EST INTEGER AT INTERDUM TORTOR VIVAMUS HENDRERIT CONSEQUAT
    AUGUE QUISQUE ALIQUAM TELLUS NEC VESTIBULUM LOBORTIS RISUS TURPIS LUCTUS
    LIGULA IN BIBENDUM FELIS SEM PULVINAR DOLOR VIVAMUS RHONCUS NISI GRAVIDA
    PORTA VULPUTATE IPSUM LACUS PORTA RISUS A VULPUTATE MAGNA JUSTO A EST)

SYNOPSIS

(defun read-from-file (file)

utilities/reflect-list [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Order a list of numbers from least to greatest, then transpose the list so
 that if an element is the second lowest, it will be replaced by the second
 highest etc.

ARGUMENTS

 - A list or numbers.

RETURN VALUE

 A list of numbers.

EXAMPLE

(reflect-list '(1 4 3 5 9 6 2 7 8 8 9))

=> (9 6 7 5 1 4 8 3 2 2 1)

SYNOPSIS

(defun reflect-list (list)

utilities/remove-all [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Remove all of the specified elements from a list, returning a list
 containing only those elements that are not in the first argument list.

ARGUMENTS

 - A first list that is the list of items to remove.
 - A second list that is the original list.

OPTIONAL ARGUMENTS

 - A predicate for testing equality between the elements of the two lists. 
   Default = #'eq.

RETURN VALUE

 A list.

EXAMPLE

(remove-all '(3 5 8 13) '(1 2 3 4 5 6 7 8 9 10 11 12 13))

=> (1 2 4 6 7 9 10 11 12)

SYNOPSIS

(defun remove-all (rm-list list &optional (test #' eq))

utilities/remove-elements [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Remove a specified number of elements from a given list starting at a
 specified position (0-based) within the list.

ARGUMENTS

 - A list.
 - An integer that is the 0-based position within that list that will be the
   first element to be removed.
 - An integer that is the number of elements to remove.

RETURN VALUE

 A list.

EXAMPLE

(remove-elements '(1 2 3 4 5 6 7) 2 4)

=> (1 2 7)

SYNOPSIS

(defun remove-elements (list start how-many)

utilities/remove-more [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Remove all instances of a list of specified elements from an original
 list. The predicate used to test the presence of the specified elements in
 the original list must be specified by the user (such as #'eq, #'equalp,
 #'= etc.)

ARGUMENTS

 - A list.
 - A predicate with which to test the presence of the specified elements.
 - A sequence of elements to be removed from the given list.

RETURN VALUE

 A list.

EXAMPLE

(remove-more '(1 2 3 4 5 5 5 6 7 7 8) #'= 5 7 2)

=> (1 3 4 6 8)

SYNOPSIS

(defun remove-more (list test &rest remove)

utilities/repeat-env [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Create a new list by repeating the y values of a list of break-point pairs
 a specified number of times over the same total x-axis span of the original
 envelope. A quick ramp is inserted between repeats to ensure that all
 x-axis values are unique and incremental.

 If the optional argument is set to T, the method will reverse the order of
 every second repeat.

ARGUMENTS

 - An envelope in the form of a list of break-point pairs.
 - An integer that is the number of times the elements of the given envelope
   should be repeated in the new list.

OPTIONAL ARGUMENTS

 - T or NIL to indicate whether every second repetition of the original
   envelope should be returned in reverse order. 
   T = reverse. Default = NIL.

RETURN VALUE

 - A new envelope in the form of a list of break-point pairs.

EXAMPLE

(repeat-env '(0 1 50 2 100 3) 3)

=> (0.0 1 16.666666 2 33.333332 3 34.333332 1 50.0 2 66.666664 3 67.666664 1
    83.33333 2 100.0 3)

(repeat-env '(0 1 50 2 100 3) 3 t)

=> (0.0 1 16.666666 2 33.333332 3 50.0 2 66.666664 1 83.33333 2 100.0 3)

SYNOPSIS

(defun repeat-env (env num-times &optional reflected)

utilities/replace-elements [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Replace the elements in list between start and end (inclusive) with the new
 list.

ARGUMENTS

 - A list.
 - An integer that is first position of the segment of the original list to
   be replaced.
 - An integer that is the last position of the segment of the original list
   to be replaced.
 - A list that is to replace the specified segment of the original
   list. This list can be of a different length than that of the segment
   of the original specified by the start and end positions.

RETURN VALUE

 A list.

EXAMPLE

(replace-elements '(1 2 3 4 5 6 7 8 9) 3 7 '(dog cat goldfish))

=> (1 2 3 DOG CAT GOLDFISH 9)

SYNOPSIS

(defun replace-elements (list start end new)

utilities/reverse-env [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Reverse the order of y values in a list of break-point pairs.

ARGUMENTS

 - An envelope in the form of a list of break-point pairs.

RETURN VALUE

 An envelope in the form of a list of break-point pairs.

EXAMPLE

(reverse-env '(0 0 25 11 50 13 75 19 100 23))

=> (0 23 25 19 50 13 75 11 100 0)

SYNOPSIS

(defun reverse-env (env)

utilities/round-if-close [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Round a decimal number if it is within a given tolerance to the next whole
 number. 

ARGUMENTS

 - A decimal number.

OPTIONAL ARGUMENTS

 - If the given number is this amount or less than the nearest whole number,
   round the given number to the nearest whole number.

RETURN VALUE

 If the given number is within the tolerance, return the number, otherwise
 return the nearest whole number.

EXAMPLE

(round-if-close 1.999998)

=> 1.999998

(round-if-close 1.999999)

=> 2

SYNOPSIS

(defun round-if-close (num &optional (tolerance 0.000001))

utilities/scale-env [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Scale either the x-axis values, the data values, or both of a list of
 break-point pairs by specified factors.

ARGUMENTS

 - An envelope in the form of a list of break-point pairs.
 - A number that is the factor by which the y values (data segment of the
   break-point pairs) are to be scaled.

OPTIONAL ARGUMENTS

 keyword arguments:
 - :y-min. A number that is the minimum value for all y values after
   scaling.
 - :y-max. A number that is the maximum value for all y values after
   scaling.
 - :x-scaler. A number that is the factor by which to scale the x-axis
   values of the break-point pairs.
 - :x-min. A number that is the minimum value for all x values after
   scaling. NB: This optional argument can only be used if a value has been
   specified for the :x-scaler. 
 - :x-max. A number that is the maximum value for all x values after
   scaling. NB: This optional argument can only be used if a value has been
   specified for the :x-scaler.

RETURN VALUE

 An envelope in the form of a list of break-point pairs.

EXAMPLE

;;; Scaling only the y values.
(scale-env '(0 53 25 189 50 7 75 200 100 3) 0.5)

=> (0 26.5 25 94.5 50 3.5 75 100.0 100 1.5)

;;; Scaling the y values and setting a min and max for those values
(scale-env '(0 53 25 189 50 7 75 200 100 3) 0.5 :y-min 20 :y-max 100)

=> (0 26.5 25 94.5 50 20 75 100 100 20)

;;; Scaling only the x-axis values
(scale-env '(0 53 25 189 50 7 75 200 100 3) 1.0 :x-scaler 2)

=> (0 53.0 50 189.0 100 7.0 150 200.0 200 3.0)

;;; Scaling the x values and setting a min and max for those values
(scale-env '(0 53 25 189 50 7 75 200 100 3) 1.0 :x-scaler 2 :x-min 9 :x-max 90)

=> (9 53.0 50 189.0 90 7.0 90 200.0 90 3.0)

SYNOPSIS

(defun scale-env (env y-scaler &key x-scaler 
                                    (x-min most-negative-double-float)
                                    (y-min most-negative-double-float)
                                    (x-max most-positive-double-float)
                                    (y-max most-positive-double-float))

utilities/secs-to-mins-secs [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

(defun secs-to-mins-secs (seconds &key (separator ":") (same-width nil))

utilities/semitones [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return the sample-rate conversion factor required for transposing an audio
 file by a specific number of semitones. The number of semitones can be
 given as a decimal number, and may be positive or negative.

ARGUMENTS

 - A number of semitones.

OPTIONAL ARGUMENTS

 - A number that is the factor required to transpose by an octave. 
   Default = 2.0.
 - A number that is the number of semitones per octave. Default = 12. 

RETURN VALUE

 A number.

EXAMPLE

;;; Usage with default values
(semitones 3)

=> 1.1892071

;;; Specifying a different number of semitones per octave
(semitones 3 2.0 13)

=> 1.1734605

;;; Specifying a different factor for transposing by an octave 
(semitones 3 4.0)

=> 1.4142135

;;; Fractional semitones are allowed
(semitones 3.72)

=> 1.2397077

;;; Negative semitones are also allowed
(semitones -3.72)

=> 0.80664176

SYNOPSIS

(defun semitones (st &optional (octave-size 2.0) (divisions-per-octave 12))

utilities/setf-last [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Change the last element in a given list to a specified new element.

ARGUMENTS

 - A list.
 - The new last element of that list.

RETURN VALUE

 Returns the new last element.

EXAMPLE

(let ((l '(1 2 3 4 5)))
  (setf-last l 'dog)
  l)

=> (1 2 3 4 DOG)

SYNOPSIS

(defmacro setf-last (list new-last)

utilities/sort-symbol-list [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Sort a list of symbols alphabetically ascending, case-insensitive. 

ARGUMENTS

 A list of symbols.

RETURN VALUE

 The same list of symbols sorted alphabetically ascending, case-insensitive.  

EXAMPLE

(sort-symbol-list '(Lorem ipsum dolor sit amet consectetur adipiscing))

=> (ADIPISCING AMET CONSECTETUR DOLOR IPSUM LOREM SIT)

SYNOPSIS

(defun sort-symbol-list (list)

utilities/splice [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Insert the elements of a first list into a second list beginning at a
 specified index (0-based).

ARGUMENTS

 - A list that contains the elements to be inserted into the second list.
 - A list into which the elements of the first argument are to be inserted. 
 - An integer that is the index within the second list where the elements
   are to be inserted.

RETURN VALUE

 - A list.

EXAMPLE

(splice '(dog cat goldfish) '(1 2 3 4 5 6 7 8 9) 3)

=> (1 2 3 DOG CAT GOLDFISH 4 5 6 7 8 9)

SYNOPSIS

(defun splice (elements into-list where)

utilities/split-groups [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Create a list consisting of as many repetitions of a specified number as
 will fit into a given greater number, with the last item in the new list
 being the value of any remainder.

ARGUMENTS

 - A number that is to be split into repetitions of a specified smaller
   number (the second argument).
 - The number that is to be the repeating item in the new list. This number
   must be smaller than the first number.

RETURN VALUE

 A list consisting of repetitions of the specified number, with the last
 element being any possible remainder.

EXAMPLE

(split-groups 101 17)

=> (17 17 17 17 17 16)

SYNOPSIS

(defun split-groups (num divider)

utilities/split-into-sub-groups [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Create a new list consisting of sublists made from the elements of the
 original flat list, whose lengths are determined by the second argument to
 the function.

 NB: The lengths given in the second argument are not required to add up to
     the length of the original list. If their sum is less than the original
     list, the resulting list of sublists will only contain a segment of the
     original elements. If their sum is greater than the length of the
     original list, the last sublist in the new list will be shorter than
     the corresponding group value.

ARGUMENTS

 - A flat list.
 - A list of integers that are the lengths of the consecutive subgroups
   into which the original list is to be divided. 

RETURN VALUE

 A list of lists.

EXAMPLE

;; Used with a list of subgroup lengths whose sum is equal to the length of the
;; original list
(split-into-sub-groups '(1 2 3 4 5 6 7 8 9 10) '(2 2 3 2 1))

=> ((1 2) (3 4) (5 6 7) (8 9) (10))

;; Used with a list of subgroup lengths whose sum is less than the length of the
;; original list 
(split-into-sub-groups '(1 2 3 4 5 6 7 8 9 10) '(2 1))

=> ((1 2) (3))

;; Used with a list of subgroup lengths whose sum is greater than the length of
;; the original list
(split-into-sub-groups '(1 2 3 4 5 6 7 8 9 10) '(2 3 17))

=> ((1 2) (3 4 5) (6 7 8 9 10))

SYNOPSIS

(defun split-into-sub-groups (list groups)

utilities/split-into-sub-groups2 [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Create a new list of lists by splitting the original flat list into
 sublists of the specified length.

 NB: The length given as the second argument is not required to be fit
     evenly into the length of the original flat list. If the original list
     is not evenly divisible by the specified length, the resulting list of
     sublists will contain a final sublist of a different length.

ARGUMENTS

 - A flat list.
 - An integer that is the length of each of the sublists to be created.

RETURN VALUE

 A list of lists.

EXAMPLE

;; The second argument fits evenly into the length of the original list. 
(split-into-sub-groups2 '(1 2 3 4 5 6 7 8 9 10 11 12) 3)

=> ((1 2 3) (4 5 6) (7 8 9) (10 11 12))

;; The second argument does not fit evenly into the length of the original
;; list. 

(split-into-sub-groups2 '(1 2 3 4 5 6 7 8 9 10 11 12) 5)

=> ((1 2 3 4 5) (6 7 8 9 10) (11 12))

SYNOPSIS

(defun split-into-sub-groups2 (list length)

utilities/split-into-sub-groups3 [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Split a given flat list into sublists of the specified length, putting any
 remaining elements, if there are any, into the last sublist.

ARGUMENTS

 - A flat list.
 - An integer that is the length of the new sublists.

RETURN VALUE

 A list of lists.

EXAMPLE

(split-into-sub-groups3 '(1 2 3 4 5 6 7 8 9 10 11 12) 3)

=> ((1 2 3) (4 5 6) (7 8 9) (10 11 12))

(split-into-sub-groups3 '(1 2 3 4 5 6 7 8 9 10 11 12) 5)

=> ((1 2 3 4 5) (6 7 8 9 10 11 12))

SYNOPSIS

(defun split-into-sub-groups3 (list length)

utilities/srt [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Return the semitone transposition for a given sampling rate conversion
 factor.

ARGUMENTS

 - A number that is a sample-rate conversion factor.

OPTIONAL ARGUMENTS

 - A number that is the factor required for transposing one octave. 
 - A number that is the number of scale degrees in an octave.

RETURN VALUE

 A number.

EXAMPLE

;;; Using the defaults
(srt 1.73)

=> 9.4893

;;; Using a sample-rate conversion factor of 4.0 for the octave and specifying
;;; 13 divisions of the octave
(srt 1.73 4.0 13)

=> 5.14

SYNOPSIS

(let ((last8vesize 0)
      (log8ve 0.0)) ;; so we don't have to recalculate each time
  (defun srt (srt &optional (octave-size 2.0) (divisions-per-octave 12)
              ;; MDE Tue Feb  7 16:59:45 2012 -- round so we don't get tiny
              ;; fractions of semitones due to float inaccuracies?
              (round-to 0.0001))

utilities/string-replace [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Replace specified segments of a string with a new specified string.

ARGUMENTS

 - A string that is the string segment to be replaced.
 - A string that is the string with which the specified string segment is to
   be replaced.
 - The string in which the specified segment is to be sought and replaced.

RETURN VALUE

 A string.

EXAMPLE

(string-replace "flat" "\\flat" "bflat clarinet")

=> "b\\flat clarinet"

SYNOPSIS

(defun string-replace (what with string)

utilities/swap-elements [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Swap the order of each consecutive pair of elements in a list.

ARGUMENTS

 - A list.

RETURN VALUE

 A list.

EXAMPLE

(swap-elements '(1 2 3 4 5 6 7 8 9 10))

=> (2 1 4 3 6 5 8 7 10 9)

(swap-elements '(1 2 3 4 5 6 7 8 9))

=> (2 1 4 3 6 5 8 7 9)

SYNOPSIS

(defun swap-elements (list)

utilities/wavelab-to-audacity-marker-file [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

ARGUMENTS

OPTIONAL ARGUMENTS

RETURN VALUE

EXAMPLE

SYNOPSIS

(defun wavelab-to-audacity-marker-file (file &optional (sampling-rate 44100))

utilities/wrap-list [ Functions ]

[ Top ] [ utilities ] [ Functions ]

DESCRIPTION

 Shift the elements of a list to start at a specified position and wrap to
 the beginning of the list to the list's tail.

ARGUMENTS

 - A list.
 - An integer which is the 0-based position in the original list where the
   new list is to begin.

RETURN VALUE

 A list.

EXAMPLE

(wrap-list '(1 2 3 4 5 6 7 8 9) 4)

=> (5 6 7 8 9 1 2 3 4)

SYNOPSIS

(defun wrap-list (list start)