And also, can an array be a valid ds entry (i.e. [struct ds array fft aray sigblock])? That would be awesome, if it was efficient and quick!
~Kyle
On 9/12/06, Kyle Klipowicz kyleklip@gmail.com wrote:
From what I understand, a "scalar" in DS lingo is really a multi-variable, which is turned into a multidimensional array using the pointer as an index. Is this even half-right?
What I don't understand is why there is a completely different atom, pointer, to index the datastructures. Why not just use an integer? Is it faster?
~Kyle
On 9/12/06, David Powers cyborgk@gmail.com wrote:
Okay, I did try to go through most of your tutorial, but for some reason the post below seems much clearer. Just what I needed, thanks.
Hopefully I can make more sense of things from here.
~David
On 9/12/06, Frank Barknecht fbar@footils.org wrote:
Hallo, David Powers hat gesagt: // David Powers wrote:
I'm sure that's true, but I'm I had problems understanding the existing data structure tutorials. Just the definition of the term "scalar" confused me, for starters. It's not even entirely clear, from the tutorials, that structures might be useful, if you don't care about the graphic part. For some reason, the struct in C makes much more sense. Probably it's just some new terminology that I don't recognize.
hm, did you read this: http://puredata.info/community/projects/convention04/lectures/tk-barknecht/t...
It's trying to explain all this stuff in very small steps, and reportedly people seem to get along with it quite well. There also is a pdf on puredata.info, but I don't have URL availabl atm. Check the archives.
Regarding the sequencer-example: I admit it's not documented, but it's kind of too advanced anyways if you didn't yet do or understand the basics tutorial.
But to give a broad overview: In your array-based approach you have different arrays for different needs: One to store time stamps, another to store note value etc.
timestamp [table ts]: t0 t1 t2 ... tn notes [table note]: n0 n1 n2 ... nn ...
A data structure in Pd is similar to this, but it's like one column of all these tables crammed into one single "thing":
[struct ds float ts float note]
ts note | |
ds 0: t0 n0 ... ds 1: t1 n1 ... ds 2: t2 n2 ... ... ds n: tn nn ...
You then use the [set] and [get] objects to access or change these fields:
1028 | 60 pointer | | | [set ds ts note]
pointer | [get ds ts note] | | | 60 1028
The "pointer" in the graphic above is used to select a data structure instance to work on with get or set. You may think of the pointer as equivalent to the number you would use to index all the tables from your table-based approach:
[struct ds float ts float note] <=> [table ts], [table note] pointer <=> [f]: index from 0, 1, 2, ... ,n get <=> tabread set <=> tabwrite "next" <=> increment index: [+ 1] "traverse pd-data" <=> reset index to 0 and "set table" message for tabwrite/-read
Whereas with tables you have lots of tables to store data, with data structures, you have one definition (struct ...) and then one or more subpatches to hold the actual data.
So data structures can be seen as an extension of [table]. In fact, they even share part of their implementation AFAIK. A [table] in Pd is just a special kind of data structure that's predefined.
Ciao
Frank Barknecht _ ______footils.org_ __goto10.org__
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
--
http://theradioproject.com http://perhapsidid.blogspot.com
(((())))(()()((((((((()())))()(((((((())()()())()))) (())))))(()))))))))))))(((((((((((()()))))))))((()))) ))(((((((((((())))())))))))))))))))__________ _____())))))(((((((((((((()))))))))))_______ ((((((())))))))))))((((((((000)))oOOOOOO