1/* 2 * Prolog part of standard MIDI file reading library 3 * Samer Abdallah (2009) 4*/ 5 6:- module(plsmf, 7 [ smf_read/2 8 , smf_description/2 9 , smf_duration/2 10 , smf_events/2 11 , smf_events_between/4 12 , is_smf/1 13 ]).
20:- use_foreign_library(foreign(plsmf)).
smf_event ---> smf( nonneg, byte)
; smf( nonneg, byte, byte)
; smf( nonneg, byte, byte, byte)
.
64/*
65 MIDI derived event types:
66
67 midi(O,T,msg(A,B,C)) :- midi_send(O,A,B,C,T).
68 midi(O,T,noteon(Ch,NN,V)) :- midi_send(O,144+Ch,NN,V,T).
69 midi(O,T,noteoff(Ch,NN)) :- midi_send(O,128+Ch,NN,0,T).
70 midi(O,T,prog(Ch,Prog)) :- midi_send(O,192+Ch,Prog,Prog,T).
71 midi(O,T,prog(Ch,Prog,Bank)) :-
72 MSB is Bank // 128,
73 LSB is Bank mod 128,
74 midi_send(O,176+Ch,0,MSB,T),
75 midi_send(O,176+Ch,32,LSB,T),
76 midi(O,T,prog(Ch,Prog)).
77*/
Standard MIDI file reading