how it interacts with pd
[dublin] is the master object in pd and only one instance of this object is
supported. For simpler design, python objects can only send messages
to receivers and not from the outlet of the dublin instance.
The message 'stop' will stop any trail currently playing. The message
'start' will only start trails that has been registred with the python method
dublin.reg_start
There is two way to run a python script within pd. The first method is to
send the message 'console' to dublin and idle will show up. The second
one is to use the message 'file yourscript.py'. This will load the python
script from the current patch path.
The message 'bpm 120' tells dublin how to consider a black since it has always
have value of 1. (See time definition below)
the framework
The basic sequencing object in dublin is called a trail. Once the user
starts a trail, it will sync it self to the next bar. On arrival of the
next bar, 'tick' of this object will be called. This class should send
any message it has to send and afterward sync the next time it should be
called. This is the life of a trail.
It is possible to send pd message in python with the Sender class that support
float, string, and list of float and string. Array can also be accessed with the
Array class and later be interfaced like a normal python sequence;
EG: array[1] = 10
Here is a brief dublin trail that will send 0 to 99 at each bar.
class MyTrail(dublin.Trail) : num = 0 sender = dublin.Sender("sum") def tick(self, args) : self.num += 1 if self.num == 100 : self.num = 0 self.sender.send(self.num) self.next(1)Be shure to define a receiver with the name 'sum'. The 'self.next(1)' tells dublin to wait 1 bar before calling tick again. 0.5 will wait half time. To start using this wonderfull trail, start it on the console with :
>>> instance = MyTrail() >>> instance.start()