midi_note(This,D,C,T,V) :- 
          Self = midi(This), 
cast to midi
Self:event(D,C,note_on,T,V), Self:event(D,C,note_off,T,V). midi_melody(This,L) :- self(This):melody(480,1,L,64). midi_melody(_This,_,_,[],_). midi_melody(This,D,C,[X|R],V) :- Self = self(This), Self:note(D,C,X,V), midi_melody(This,D,C,R,V).
direct invocation