This is the music-spelling Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Tue Jul 15 06:03:25 2025 GMT+0.
The main system appears first, followed by any subsystem dependency.
music-spelling
Automatic pitch and rhythm spelling.
Nuno Trocado
Apache 2.0
0.1
alexandria
(system).
parse-float
(system).
cl-ppcre
(system).
package.lisp
(file).
pitch-spelling.lisp
(file).
rhythm-spelling.lisp
(file).
text-notation.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
music-spelling/music-spelling.asd
music-spelling/package.lisp
music-spelling/pitch-spelling.lisp
music-spelling/rhythm-spelling.lisp
music-spelling/text-notation.lisp
music-spelling/music-spelling.asd
music-spelling
(system).
music-spelling/pitch-spelling.lisp
package.lisp
(file).
music-spelling
(system).
*chord-penalties*
(special variable).
*default-parsimony*
(special variable).
*default-penalties*
(special variable).
*natural-parsimony*
(special variable).
accidental
(reader method).
(setf accidental)
(writer method).
letter
(reader method).
(setf letter)
(writer method).
make-parsimony
(function).
make-parsimony-ht-from-notes
(function).
make-penalties
(function).
note
(class).
octave
(reader method).
(setf octave)
(writer method).
pitch-spell
(function).
pitch-spell-chords
(function).
print-object
(method).
rest-p
(function).
%pitch-spell
(function).
abs-interval-in-semitones
(function).
augmented-interval-p
(function).
common-enharmonics-p
(function).
count-accidentals
(function).
count-augmented-intervals
(function).
count-diminished-intervals
(function).
count-double-accidentals
(function).
count-penalties
(function).
diminished-interval-p
(function).
distance-from-major-or-perfect
(function).
funny-interval-p
(function).
interval-in-semitones
(function).
interval-number
(function).
interval-quality
(function).
letter-value
(function).
major-or-perfect-interval-size
(function).
make-chord-penalties
(function).
make-default-penalties
(function).
make-natural-parsimony
(function).
map-product
(function).
note->midi-note-number
(function).
parsimony
(function).
pitch-letter
(type).
pitch-letter-p
(function).
possible-spellings
(function).
score-spelling
(function).
music-spelling/rhythm-spelling.lisp
pitch-spelling.lisp
(file).
music-spelling
(system).
metric-subdivision
(function).
min-subdivision-quantize
(function).
rhythm-spell
(function).
crosses-bars-p
(function).
crosses-beats-p
(function).
dots
(function).
ends-a-beat-p
(function).
int-frac
(function).
post-half-bar
(function).
rest-of-bar
(function).
rest-of-beat
(function).
ties
(function).
music-spelling/text-notation.lisp
rhythm-spelling.lisp
(file).
music-spelling
(system).
*default-octave*
(special variable).
parse-text
(function).
*input-regex*
(special variable).
char-pitch->value
(function).
find-default-octave
(function).
input
(reader method).
malformed-input-error
(condition).
parse-to-note
(function).
text-accidental->value
(function).
text-octave->value
(function).
Packages are listed by definition order.
music-spelling
common-lisp
.
*chord-penalties*
(special variable).
*default-octave*
(special variable).
*default-parsimony*
(special variable).
*default-penalties*
(special variable).
*natural-parsimony*
(special variable).
accidental
(generic reader).
(setf accidental)
(generic writer).
letter
(generic reader).
(setf letter)
(generic writer).
make-parsimony
(function).
make-parsimony-ht-from-notes
(function).
make-penalties
(function).
metric-subdivision
(function).
min-subdivision-quantize
(function).
note
(class).
octave
(generic reader).
(setf octave)
(generic writer).
parse-text
(function).
pitch-spell
(function).
pitch-spell-chords
(function).
rest-p
(function).
rhythm-spell
(function).
%pitch-spell
(function).
*input-regex*
(special variable).
abs-interval-in-semitones
(function).
augmented-interval-p
(function).
char-pitch->value
(function).
common-enharmonics-p
(function).
count-accidentals
(function).
count-augmented-intervals
(function).
count-diminished-intervals
(function).
count-double-accidentals
(function).
count-penalties
(function).
crosses-bars-p
(function).
crosses-beats-p
(function).
diminished-interval-p
(function).
distance-from-major-or-perfect
(function).
dots
(function).
ends-a-beat-p
(function).
find-default-octave
(function).
funny-interval-p
(function).
input
(generic reader).
int-frac
(function).
interval-in-semitones
(function).
interval-number
(function).
interval-quality
(function).
letter-value
(function).
major-or-perfect-interval-size
(function).
make-chord-penalties
(function).
make-default-penalties
(function).
make-natural-parsimony
(function).
malformed-input-error
(condition).
map-product
(function).
note->midi-note-number
(function).
parse-to-note
(function).
parsimony
(function).
pitch-letter
(type).
pitch-letter-p
(function).
possible-spellings
(function).
post-half-bar
(function).
rest-of-bar
(function).
rest-of-beat
(function).
score-spelling
(function).
text-accidental->value
(function).
text-octave->value
(function).
ties
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Penalties used when spelling chords.
Make a parsimony hash table from LETTER-ACCIDENTAL-PAIRS, each a cons of a ‘pitch-letter’ char and on of :natural, :flat, :sharp, :double-flat or :double-sharp.
Returns a parsimony hash table produced from the accidentals in the list of ‘note’ objects NOTES.
Returns a hash table with the following cumulative penalties used in pitch scoring:
ACCIDENTALS: note is sharp or flat;
AUGMENTED: augmented interval between two consecutive notes;
DIMINISHED: diminished interval between two consecutive notes;
DIRECTION: ascending with flats or descending with sharps;
DOUBLE-ACCIDENTALS: note is double sharp or double flat;
E#-Fb-B#-Cb: specific penalty for these spellings;
OTHER-INTERVALS: intervals between two consecutive notes other than major, minor, perfect, augmented or diminished (e.g. doubly augmented interval);
PARSIMONY: occurrence of an accidental different from previous used ones (or pre-defined on a given parsimony table).
Unsupplied values are taken from DEFAULT.
Penalty values are summed when scoring each spelling try. A lower score is better.
Parse INPUT text into a list of midi note values and a list of durations as fractions/multiples
of a beat, or, with RETURN-NOTES, return a list of note objects.
The syntax is as follows:
- Notes are separated by spaces.
- Each note starts with a pitch letter (a-g), or r for a rest.
- Add s for sharp, b for flat (eg, cs is C-sharp, bb is B-flat).
- Add one or more quotes (’) to indicate octaves above middle C, commas (,) indicate octaves
below middle C. For example: c’ is the C above middle C (C5, as it is also usually called)
ab,, is the A-flat two octaves below middle C (A3).
- Add the rhythmic value in number of beats. Examples: c1 is a quarter-note C; d.5 is an
eighth-note D (.5=half a beat); e1.75 is a double-dotted
quarter-note E, or a quarter-note tied to a dotted eight-note… (the exact notation is set
by the computer); fs4 is a whole-note F-sharp.
- One more thing about octaves: they are all relative to the first note. If you type
g,,1 a1 b1 c1’ the first three notes are two octaves below middle-C, and the last one one
octave below (G3 A3 B3 C4).
- One more thing about rhythms: If you don’t indicate a rhythmic value, the preceding one is
assumed. So you could write the last example like this: g,,1 a b c’.
Some more examples of valid phrases:
f1 r.5 f’1 d’.5 e’1 (Moose The Mooche)
r.5 g g g eb2 r.5 f f f d2 (Beethoven’s fifth)
d2 a f d cs d1 e f2.5 g.5 f e d1 (Bach’s Art of the Fugue)
cs’.5 e gs b as1.5 gs.5 fs ds b,1 (Coltrane’s solo on Giant Steps)
d.5 e f g e1 c.5 d1.5 (The Lick)
Spell notes in MIDI-NOTE-NUMBERS, a list of midi note values, Returning a list of ‘note’ objects.
For longer sequences, computing the n-fold cartesian product of all spelling possibilites becomes dramatically time-intensive. Therefore, the sequence is split in blocks of SPLIT elements, which are calculated separately. However, maintaining previous choices of accidentals across blocks is preferred (divergences receive the ’parsimony’ penalty). PENALTIES is a hash table with the penalties for various situations, summed when scoring spelling tries (see ‘make-penalties’). PARSIMONY is a hash table with the chars for the letters from ’a’ to ’g’ as keys and their preferred initial spelling (:natural, :sharp, :flat, etc.) as values.
Example:
(pitch-spell ’(48 50 52 53 55 57 59 60 61 64 65 68 69))
–> (#<NOTE C3> #<NOTE D3> #<NOTE E3> #<NOTE F3> #<NOTE G3> #<NOTE A3> #<NOTE B3>
#<NOTE C4> #<NOTE C#4> #<NOTE E4> #<NOTE F4> #<NOTE Ab4> #<NOTE A4>)
Spell chords in CHORD-SEQ, a list of chords, where each chord is a list of midi note values, returning a similarly structured list with the values replaced by ‘note’ objects.
PENALTIES is a hash table with the penalty values for various situations, summed when scoring spelling tries (see ‘make-penalties’). PARSIMONY is a hash table with the chars for the letters from ’a’ to ’g’ as keys and their preferred initial spelling (:natural, :sharp, :flat, etc.) as values.
Example:
(pitch-spell-chords ’((60 64 67) (61 65 68) (62 66 69)))
–> ((#<NOTE C4> #<NOTE E4> #<NOTE G4>) (#<NOTE Db4> #<NOTE F4> #<NOTE Ab4>)
(#<NOTE D4> #<NOTE F#4> #<NOTE A4>))
One of c, d, e, f, g, a or b
music-spelling::pitch-letter
#\c
:letter
Accidentals are :natural, :double-flat, :flat, :sharp, :double-sharp
keyword
:natural
:accidental
The octave. Middle C is on the fourth octave.
integer
4
:octave
Parse the char PITCH, returning 0 for C, 2 for D, upto 11 for B.
Non-collecting version of the function in Alexandria.
Make a note object from args in text notation.
Parse the string ACCIDENTAL, returning the value to add or substract to the midi note.
Parse the string OCTAVE, counting quotes and commas to return the corresponding base number in midi notes.
malformed-input-error
)) ¶error
.
Jump to: | %
(
A C D E F G I L M N O P R S T |
---|
Jump to: | %
(
A C D E F G I L M N O P R S T |
---|
Jump to: | *
A I L O S |
---|
Jump to: | *
A I L O S |
---|
Jump to: | C F M N P R S T |
---|
Jump to: | C F M N P R S T |
---|