mxdublin

generic programmable event sequencer for pure-data/max

Working with examples

This project can look like a programmer only tool but theses examples will give a glimpse on how to work with sequences. Please note that the examples covered here do not share GroupProperties among them. Because of this, they will not show up in the Tracker view.

How to change the global tempo

Yes, this one is a basic task, basic code. Keep in mind that changing the tempo will stop all trails. If you want to desync a trail with a specific time signature, you are better off using EvList.stretch()

DublinSystem.setTempo(120)

How to generate random timestamps

This is usefull if you want to put types of events randomly. There alot of ways of doing this, but here is an easy one.

# this function returns generated timestamps in a array. # prob : probability that the note will be played # fact : the smallest time slice (in quarter note) # size : number of quarter note to fill def rndtm(prob=0.5, frac=1, size=8) : ret = [] for i in DublinHelper.range(0, size, frac) : if DublinHelper.rnd() + prob > 1 : ret.append(i) return l = EvList() l.addf(rndtm(0.5), EvSender("! @sender bassdrum")) l.addf(rndtm(0.2), EvSender("! @sender snare")) l.addf(rndtm(0.7, 0.5), EvSender("! @sender hihat")) l.factoryTrail("randomBeat", project)

How de-sync a beat from another one

This is a common use in electric music where a beat plays slightly offset of another one. This can be used by using the EvList.stretch to change the timebase of a event list.

l = EvList() # we put the de-sync beat in another list l2 = EvList() l.add("0:1:2:3:4:5:6:7", EvSender("! @sender bassdrum")) l2.add("0:2:4:6", EvSender("! @sender snare")) # stretch slighty by 95% l2.stretch(0.95 * 480) l.factoryTrail("bassdrum", project) l2.factoryTrail("snare", project)

How to remove a specific type of event within a list

You have builded a list but you don't like what you send to the sender 'hihat'. To remove it, your best friend is QueryItem. This object can used to filter type of event within a list. EvList.remove() will remove all items that match the query while it counter part filter will remove all items that didn't match the query.

l = EvList() l.add("0:1:2:3:4:5:6:7", EvSender("! @sender bassdrum")) l.add("0:2:4:6", EvSender("! @sender snare")) l.add("0:2:5:4:6:7:7.5", EvSender("! @sender hihat")) l.factoryTrail("dontLikeIt") # .... time passes # remove all items that send a bang to the hihat l.remove(QueryItem(EvSender("! @sender hihat")))

How to generate sprouts

Sprouts are events that are played continuously in a very short time; they are to much used in electronic music in general.

l = EvList() l.add(DublinHelper.range(0,3,0.125), EvSender("! @sender tick")) l.add(DublinHelper.range(3,8,0.175), EvSender("! @sender tick")) l.add(DublinHelper.range(0,8,0.25), EvSender("! @sender tock")) l.factoryTrail("cheapIdm", project)

How to get in python the EvList object from a previously saved session

If you saved a mxdublin session with a TrailEvList, all the items in this list will be saved into this session. Once it is loaded, you won't be able to access this object with the named you used in python before because python local variables are not saved into the session. Here is a way to get the event list from a trail that has been loaded from a session.

mylist = project.getTrail("mytrail").getList()