On Wed, 2007-09-12 at 18:17 +0200, Atte André Jensen wrote:
Ok, I could go on and do my second external (since I would be able to write this up in C in no time), but I'm wondering:
- Is there a similar wheel out there?
there probably many ways to do it. i personally think, that the abstraction way is the more preferrable one, for reasons frank has already outlined.
- Would it be not-so-tricky to do as an abstraction? Newbie-me wouldn't
know how to a) hold onto a grab-bag of notes played on one channel
i believe, that for you as a c programmer it should also doable easily within pd as well. the main culprit is probably, that you might don't know already, which objects to use and also how to use certain design patterns in pd, that you might know from other languages. i tried to make a little sketch, how this could look like in pd (see attachment). i also used the bag metaphor, that you mentioned. when you see the patch, there is the bag on one hand and (i call them) "bag methods" on the other hand: [pd add_notes], [pd remove_notes] and [pd get_notes]. by using this design pattern, you can add easily as much methods to the bag as you want.
and b) select them according to the selected mode. Which data structure would be nice to store/retrieve from in such a case (should dynamically grow/shrink)?
the problem with my approach is, that the single notes are sorted by their noteon-time (or is this a feature? i don't know), whereas with the approach frank barknecht mentioned (the one using a table to store the state of each note) notes can easily sorted by their pitch, what probaby makes it easier to create different modes for your arpeggiator.
anyway, i think this task is a good example to get in contact with the logic of pd a bit. i encourage you to go on and ask the list again, if you need specific help.
roman