./../../src/sc-scale.lsp

qq(
)
slippery chicken

## sc-scale/get-scale [ Methods ]

[ Top ] [ sc-scale ] [ Methods ]

FUNCTION

     get-scale: uses the <steps> slot to create a scale starting on the given
     note and extending up to MIDI note 127.  The scale will only repeat at
     octaves if such is the structure of the notes passed at initialisation.
     This is usually only called automatically at initialisation etc.

ARGUMENTS

     - the sc-scale object
     - the note to begin the scale on (as a symbol e.g. 'c0) and to store
       in the tonic slot.

RETURN VALUE

     a list of the pitch objects in the scale; these are also stored in the
     scale-pitches slot.

SYNOPSIS

    (defmethod get-scale ((scsc sc-scale) start-note)

## sc-scale/make-sc-scale [ Functions ]

[ Top ] [ sc-scale ] [ Functions ]

FUNCTION

     make-sc-scale: returns an sc-scale object starting on the given <tonic> and
     using the interval structure given in notes.  NB The notes aren't
     necessarily used, rather their interval structure is simply mapped onto the
     starting-note and repeated upwards until we've reached MIDI note 127.
     NB The scale will only repeat at octaves if that is the interval structure
     of <notes>

ARGUMENTS

     - the starting note, as a pitch symbol (e.g. 'c0)
     - a pitch symbol list that provides the interval structure for the scale

RETURN VALUE

     an sc-scale object

EXAMPLE

    ;;; A non-octave repeating scale:
    ;;; (make-sc-scale 'c0 '(d e gs as d ef g a bf cs d ef gf))

SYNOPSIS

    (defun make-sc-scale (tonic notes)

## sc-scale/sc-scale-degree [ Methods ]

[ Top ] [ sc-scale ] [ Methods ]

FUNCTION

     sc-scale-degree: find a given note and return the degree in a given octave.
     Strictly speaking, we're searching for a particular pitch class e.g. given
     'Ds1, find the degree of the first D# in, say, octave 6.

ARGUMENTS

     - the sc-scale instance
     - the pitch whose class we're looking for
     - the octave to search
     - (optional default nil) whether to return the position in the scale list
       instead of the degree (T or NIL)

RETURN VALUE

     integer: the degree, counting from 1, of the found note.

EXAMPLE

    ;;; DATE 14.8.2010

SYNOPSIS

    (defmethod sc-scale-degree ((scsc sc-scale) pitch octave &optional return-nth)

## sc-scale/sc-scale-note [ Methods ]

[ Top ] [ sc-scale ] [ Methods ]

FUNCTION

     sc-scale-note: Get the pitch object (or if <nth> is t, the position in the
     list of scale notes across the complete range) for the note with <degree>
     (1-based) in <octave>.  As there's no concept of a tonic repeating at
     octaves, degree 1 in the given octave is simply the first note >= the C in
     this octave.
     NB If you pass <tonic> this will change the instance's tonic and
     re-calculate scale-pitches accordingly before getting the pitch.

ARGUMENTS

     - the sc-scale object
     - the degree (1-based) of the scale, counting from the first note of the
       scale above or on the C in the given octave.  This can of course be
       negative.
     - the octave we want the pitch from (middle C = octave 4)
     - (key :tonic default nil): the new starting note for the scale (usually
       the lowest note the scale should start on).
     - (key :nth default nil): return the position of the requested degree in
       the whole scale list, instead of the pitch object.

RETURN VALUE

     either the pitch object or its position in the scale list.

EXAMPLE

    ;;; (let ((s (make-sc-scale 'c0 '(d e gs as d ef g a bf cs d ef gf)))
    ;;;       (pat '(-1 2 4  3 6 -2 -1 2 6  7 3 6 2)))
    ;;;   (loop for p in pat collect
    ;;;        (data (sc-scale-note s p 4))))
    ;;;  --> (A3 EF4 F4 E4 BF4 F3 A3 EF4 BF4 D5 E4 BF4 EF4)

SYNOPSIS

    (defmethod sc-scale-note ((scsc sc-scale) degree octave &key tonic nth)

## sclist/sc-scale [ Classes ]

[ Top ] [ sclist ] [ Classes ]

NAME

     sc-scale

     File:             sc-scale.lsp

     Class Hierarchy:  named-object -> linked-named-object -> sclist -> sc-scale

     Version:          1.0

     Project:          slippery chicken (algorithmic composition)

     Purpose:          Implementation of a scale object that can initialize its
                       complete pitch list from the interval structure of a
                       given list of notes.  Given the scale, it's a synch to
                       generate note sequences based on note offset patterns
                       e.g.
                       (let ((s (make-sc-scale 'c0 '(d e gs as d ef g a bf
                                               cs d ef gf)))
                             (pat '(-1 2 4  3 6 -2 -1 2 6  7 3 6 2)))
                         (loop for p in pat collect
                              (data (sc-scale-note s p 4))))
                       -> (A3 EF4 F4 E4 BF4 F3 A3 EF4 BF4 D5 E4 BF4 EF4)

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

     Creation date:    August 3rd 2010 Edinburgh

     $$ Last modified: 18:57:32 Fri Dec  9 2011 ICT

     SVN ID: $Id: sc-scale.lsp 501 2011-12-13 21:48:56Z reed@seanreed.ie $