-
torchflame
Hey everyone,
I'm currently writing an external that accepts a list of arbitrary length (say ``a'') and does some processing on it. In my particular case the list is comprised entirely of floats. My problem is I need the output to be a list where the length is dependent on the size of the input list. I've been looking through the list source code, but I can't figure out exactly how to create a list of any length. If I always knew the length of the input list, I could just create that many outlets, but I don't want to do that for this case. Does anyone have any pointers? -
torchflame
Okay, I think I get it. It was the class_addmethod that was mixing me up. Thank you so much!
-
torchflame
No, I'm sorry, I'm not quite getting it.
If, for example, I have*inletA = t_inlet inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("foo"), gensym("bar"));
. how would I go about assigning this to a method, sayfloatmethod
, for a float coming in?
I guess I'm asking more for a more concrete way to think about this routing, because I'm not even sure where to start with it. -
torchflame
Hi everyone,
I'm starting to branch out in my externals, and I'm starting to approach the point where I need multiple inlets. My problem is that I'm not quite sure how the code works here. For example, I know about the inlet_new() function, but I don't know how the inlets are distinguished.
For example, if I placeinlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym(""));
in the constructor, I can access these inlets in the class setup as
class_addlist(test_class, listMethod);
and
class_addanything(test_class, anythingMethod);
but I have no idea how this actually works. If I try to take in two lists by replacing the""
in the constructor with"list"
, I get a number of compiler errors.
So, I guess my question is: how does pd actually handle inlets, and how do I distinguish between multiple inlets of the same type in code?
Thanks,
Brian -
torchflame
Hi everyone,
I'm working on prototyping a few functions through externals, and every time I try to iteratively build up the C code I'm forced to quit pd, wait a few seconds, and then reopen to get pd to reload the pd_darwin file. This works, but is annoying and repetitive. Is there any way to force pd to reload the libraries its using without restarting? -
torchflame
Hi, I'm looking to create an abstraction which takes a symbol as a creation argument (i.e., [ABSTRACTION symbol]) which then selects one piece of data coming in to it. I'm using OSC, and I get in a data stream like "/a 0 /b 4 /c 5 /d 8 ...", and I'd like this abstraction to have creation arguments so that [ABSTRACTION /a] returns "0". The actual project is a bit more repetitive, so I'd like to use abstractions, but I'm having trouble actually selecting the specific data. I know that [route /a] would work, but is there a way to tell [route] what to route? I know [route $1] doesn't work, but I'm looking for something that could possibly work like that.
Thanks in advance! -
torchflame
Hi everyone!
I found this thesis from 2008 online and was reading it, when it occurred to me that the author's ideas about quasi-periodic sounds being more pleasing could be tested and mocked up in pd. Here's the outcome! Because of the thesis, this had to be licensed under Creative Commons 4.0 BY-NC-SA. Sorry!
[rosc~] takes two creation arguments, and every cycle of the sine wave it generates a random frequency in a specific range to use for the next cycle. I played with it a bit and found that a range of 2 sounded the best to me, but it does require some calibration. Sorry if I'm not too clear right now, it's really late, and the help file should clear up most confusions.
Hope someone enjoys it! -
torchflame
Hi everyone!
I was looking through the boards to try to find the answer to a problem and I found a request from two years ago for the ability to turn a decimal input into a fraction, and I thought of it as an interesting programming challenge. Here's the result!
[dec2frac] works with float inputs of up to 5 decimal places due to the limitations of the float type. If anyone's interested, I'm more than happy to share the source code, even though this is a really simple external. I hope someone gets some use out of it! -
torchflame
Hi everyone,
I'm working on two externals for a personal project, and being new to writing these I have two questions. I'm working on Mac OS 10.8 in Xcode 5, and I've worked through the standard tutorial.
First, is there some way to take a list as an inlet? In the external, would this read to an array?
Second, I have a bunch of sends in a patch that need to be manipulated in a certain way which is easy to do in C, but tough to do in pd. Is there some way to retrieve sends of a certain format (e.g., data1, data2, ... dataN) into an external?
Thanks! -
torchflame
Wow! Apparently my laptop went all weird. It seems that [route $1] does in fact work.
-
torchflame
Awesome idea!
I took it a bit further and extended it so that there's a "split point" where a number below the point will pass and if it's above that split point it will be reversed. I thought it might be cool to have! It uses [datastream], which is a different abstraction I had to make for something else, but is proving useful across the board. The zip archive attached includes both [midisplit] and [datastream]. Thanks for the inspiration! I hope you get some use out of either of these.