To register and login, use your Google, Twitter, Facebook, LinkedIn, or OpenID credentials.

This is allowing us to stop most spam registrations. We've deleted most of the spam accounts that got through, and we're closely watching for more.

Designing Pd "switches" for libpd

anthropomoanthropomo Posts: 10
edited December 2012 in Pd Everywhere

Based on extensive googling, it seems conditional logic is a point of difficulty for many new Pd users who are more accustomed to text-based programming. I fall into this category.

Essentially I want to be able to tell my patch to run through a particular object or not. The best solution I have so far requires more objects than seem necessary. The ugliest part is that this solution requires me to track the state on the Android end.

Ideally I would be able to send one of two messages, essentially true or false (1 or 2, or one bang string or another, whatever). Right now there is only one message for both on and off. Anyway, here is a picture of my current switch:

Any suggestions appreciated.

P.S., I am aware of moses and spigot, but I can't seem to get my head around how to apply them here.


  • choonschoons Posts: 52

    I don't think you should consider keeping track of state on the Android side a problem. I prefer to do it that way actually since I can take advantage of state variables in classes to keep everything more organized. You should definitely get comfortable with moses and spigot as they are indispensible. Also, I make great use of [sel 1] or [sel 0] (select object) for binary switching. If input matches you get bang on left, if not it sends the input to the right which you can also make bang with [t b]. It's good to use when doing greater/less/equals evaluations as those output 1 or 0 for true or false.

  • reakinatorreakinator Posts: 301

    There's a few ways to do this, yours is close. I think you just want one toggle and one [!= 0] object and you'll get a switch. Once you get it working, it's nice to wrap things up like this into an abstraction and save it in your library. Pd Vanilla has a minimalist philosophy, and since you can build a switch from smaller chunks, it's not included as an internal object. Pd-Extended contains alot of this stuff already wrapped up for you.

    By the way, the pd-list is probably the best place to ask questions related to the pd language itself - you'll most likely get someone to send you a sample patch of the way they choose to do what you need.


  • Thanks for the tips. I was only aware of and they don't seem very into beginner questions there.

  • hanshans Posts: 112

    Don't let the trolls scare you away, newbie questions are welcome in both the forum and the pd-list ( :-D

  • Hey, thanks, hans! I see you everywhere Pd is discussed! I got up the courage and worked something out between the suggestions here and there.

Sign In or Register to comment.