Petri Nets and Midi Sound in Prolog?



Dear All,

Is there some Prolog source code for
the following around:
1) Petri Nets
2) Midi Sound

Item 1) could be implented in various
ways, would be interested in an implementation
based on the threads of a multi-threaded
Prolog system. So each colored token that
wanders through the net would be a thread.

Item 2) probably needs a foreign function
interface and some native methods. Would
be interested in an implementation that
calls the Java sound API, but other example
would be also of interested.

Bye

P.S.: Background: Stepped of the following
noisy thing:
http://www.youtube.com/watch?v=VbFwJB-YF_k

The GUI interface is not prio, but threads
and midi interaction. Guess in a first try
the petri net and thus the threads script
could come fixed in a Prolog text.
.