Did you know ... Search Documentation:
Pack plumdrum -- prolog/humdrum.pl
PublicShow source

This module provides facilities for reading and decoding Humdrum files. It provides an extensible framework whereby new exclusive interpretation types can be added by adding clauses to the multifile predicates hum_data_hook//2, hum_interp_hook//1 and hum_duration_hook/3.

Types:


record --> ref(atom,atom,atom)
         ; comment(atom)
         ; comment(list(atom))
         ; xinterps(list(interp))
         ; interps(list(tandem))
         ; pathops(list(pathop))
         ; data(list(data))
         .

interp ---> null ; x(xinterp) ; t(list(code)) ; p(pathop).

pathop ---> null  ; term ; new
          ; split ; join ; exch
          ; init(xinterp)
          ; chx(xinterp).

spine_ed(A) == pred( path_action(A), S, S).

path_action(A) ---> term(A)
                  ; split(A,A,A)
                  ; join(A,A,A)
                  ; new(A)
                  ; init(xinterp,A)
                  ; chx(xinterp,A)
                  .
 hum_interp_hook(-I:interp)// is det[multifile]
This should be a DCG predicate that parses characters from a Humdrum token that signify an interpretation and returns a term encoding the interpretaiton. See interps.pl
 hum_data_hook(+Rep:xinterp, -D:data)// is det[multifile]
This should be a DCG predicate that parses characters from a Humdrum data token.
 hum_duration_hook(+Rep:xinterp, +D:data, -Dur:rational) is semidet[multifile]
This should compute the duration of the data term if it has one or fail otherwise.
 event_duration(+Rep:rep, +Token, -Dur:number) is semidet
Compute duration of token, fail if it has no duration.
 hum_read(+FileName, -HumdrumObject) is semidet
 hum_read(+FileName, +Encoding, -HumdrumObject) is semidet
Read a humdrum file and return a big term representing its contents. Default encoding is iso_latin_1. If you are having problems reading a Humdrum file, it might be an encoding problem - try utf8 instead. See encoding/1 for more information.
 hum_has(+Records, ?Prop, ?Val) is nondet
Searches reference records of all loaded humdrum files.
 hum_prop_desc(?RefCode, ?Description) is nondet
Enumerate all known three letter reference codes and their textual descriptions.
 apply_xinterps(+I:list(interp), +E:spine_ed(A), ?S1:list(A), ?S2:list(A))// is det
Apply list of exclusive interpretations to list of spines using give spine editor interpreter predicate.
 apply_pathops(+I:list(pathop), +E:spine_ed(A), ?S1:list(A), ?S2:list(A))// is det
Apply list of path ops to a list of spines using given spine editor.
 beats_to_secs(+T:tempo, +B:number, -S:float) is det
Convert beats to seconds given tempo in beats-per-minute.
 slice_duration(+Reps:list(xinterp), +Evs:list(data), -DT:rational, +P1:pending, -P2:pending) is det
Computes the duration of a time slice given the representation (xinterp) of each spine and the data in each spine. The last two arguments maintain a list of pending durations of notes begun in earlier slices. NB pending = list(rational).

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 hum_read(Arg1, Arg2, Arg3)
 recip_to_rational(Arg1, Arg2)