-
EasyMac
I'm working on a subpatch that receives messages in a simple script syntax to be interpreted as actions to execute. I'm using [route] a lot to guide the logic tree word by word from beginning of each "sentence" (list message) received. [route] checks the first item of an input list against its creation arguments (sort of like [select]) for a match. If the first item in the list matches one of [route]'s creation arguments, the first item is removed and the rest of the list is output through a corresponding [route] outlet. This works great for my purposes, but sometimes it would be nice to remove the first item from the list regardless of its value. Some words in each sentence are unnecessary, or don't contain any new or important information because the syntax of the script is designed for ease of use and natural-sounding "sentences".
I've tried a few approaches to removing the first element.
For example, this technique works just fine if you know the number of remaining terms, but the syntax is flexible, so the logic tree won't always know :
[r SentenceSoFar] (I'm not using this send/receive scheme, it's here for clarity)
\
[ $2 $3 $4 $5 $6 $7 <
/I can use [prepend] to add an element as the first in a list, but it obviously won't remove an element.
It seems like this a pretty simple thing to want to do, and there might be an object for it (I'm using Pd-extended, by the way) or perhaps just a simple trick I'm missing...
-
EasyMac
So, in a message, a spacebar character " " is used to separate different items in a list. Such as,
[item1 item2 item3 item4 item5 <Is there any way to send a single item in a message with a space character in it?
Such as,
[item one <I would assume this could be accomplished with something like,
[item <
|
[append (something) ]
|
[append one ]I know file names in a web browser (and other places) use a certain number preceded by a "%" to denote a space but I don't know what this number is, or if it works in Pd.
Anybody else have a solution for this?
I would think it's pretty necessary for navigating folder structures on any modern machine. -
EasyMac
So I want my patch to be able to adapt when I add virtual MIDI devices with the program MIDIpipe while the patch is already running.
Is there a some message I can send to some object in pd to force it to update its list of MIDI devices?
EDIT: I'm using the latest Pd-extended on MacOSX Leopard (Intel)
-
EasyMac
I'm using PD and Jack on OSX.
Is there any way I can use some sort of PD external to control the Patching/Routing of my jack server? I'm using PD to send OSC signals to control SooperLooper, a looping system that runs on jack, and I'd like to be able to use PD to control which of my DAC inputs go to each loop. I've only got two inputs, but I loop them separately and it would be nice to be able to have setups like... four loops from input one and two loops from input two switching to two loops from input one and six loops from input two without having to have ten total loops, all routed ahead of time, with several loops taking up audio processing power without actually being in use at any given time.
Can I send commands to jack (perhaps OSC?) from within PD like "route system input one to SooperLooper input 4" with some sort of object?
Does anyone else think it would be useful to control audio routing within PD?
-
EasyMac
So, I'm working on an interface that will translate gamepad inputs to certain MIDI controls that will control the routing and properties of an audio effects chain in Logic, including loop plugins within logic.
My main patch receives the input and sends it to one of many different subpatches that each deal with the same input in different ways.
For example, if subpatch 1 is active and button 1 is pressed, I want to send MIDI message 1 1 1 to logic, which converts that message in the logic environment to the correct message to, say, start recording loop one. If I want another button on another subpatch to perform the same function (loop one record-on), I would want the same message to be sent to Logic (1 1 1) from a different point in the chain.
Now, to make passing these MIDI messages within my patches easier, I have the digits shifted and parts summed so that MIDI message 1 1 1 would be passed within the patch as 0010101 and 127 5 8 would be passed as 1270508.
I expect to be cranking out more subpatches every week for possible input sets, all leading back to the same output to logic for the same message ("loop one record-on" will be 1 1 1 for every subpatch), and to make writing subpatches more intuitive, I'd like to do some sort of analogous function to #DEFINE in C, such as:
#DEFINE lp1RecOn 0010101
and my subpatches could use the name instead of the number. This also would make it easier to change my MIDI message processing scheme later. If I decide that some other function needs to be 1 1 1, and I change the "loop one record-on" function to use 1 5 4, I would only need to change the definition of the constant in one central reference file (an the routing in logic) instead of crawling through all of my patches, changing every instance of it in them.Is there any way to #DEFINE constants in Pd?
(Or do something funcitonally equivalent?) -
EasyMac
I converted an old USB game controller into a footswitch board with switches I bought from a local hardware store. I basically took the circuitry that converts button presses to USB info and tapped it over to a box with the footpresses that act as buttons. Pd gets the keypresses from USB and executes certain effect actions based on which footswitches I hit and in what order.
-
EasyMac
Yeah I've been using something similar to that route trick for some state polling through global variables.
_
|
[ s someglobalstate-ask ][ r someglobalstate-tell ]
|
[ route $0 ]
|
.
.And in some other section of the patch...
[r someglobalstate-ask]
| \
[bang]
| \
_\
| \
[ pack f f ]
|
__ -
-
-
EasyMac
Sweet.
I'm using shell to invoke jack_lsp, jack_connect, and jack_disconnect.Works like a charm.
-
EasyMac
Well, this is a good idea, and will probably will be what I do if all else fails, but it still leaves me the problem that when SooperLooper creates/adds loops, it registers/unregisters them with Jack, and when an input or output is unregistered from jack it loses its routing, and doesn't regain it when the same input or output is registered again, so if I plan to add/remove loops, I would have to manually do the routing each time (which wouldn't be a problem if PD could send Jack messages to make it route properly).
This solution also adds to the number of signals coming in and out of Jack, which will affect processing time needs, and in a live looping situation, I'm trying to get away with the bare minimum of latency buffering.
-
EasyMac
Yeah, thanks for all the suggestions guys.
I ended up working a hybrid of them, and I think it works efficiently and is abstracted enough to where I can change things later without reworking the entire solution (which is just the flexibility I need)I'm also using pack / unpack instead of the digit shifting thing now. I didn't even know about pack until hardoff mentioned it in his solution. Along with route, it's a great solution.
I'm just now starting to think in terms of pd and understand how powerful it can be.
Thanks, guys.