Histórico
2.9. Estrutura de Dados

Comparando versão 1 com a versão 12

Versão: 1 Versão: 12 (atual)
vitoriamario - Mon 07 of May, 2007 [16:21 UTC] rodrigo - Mon 02 of Jul, 2007 [15:43 UTC]
conteúdo, diagramação Página destravada

@@ -Linhas: 1-6 mudou para +Linhas: 1-7 @@
- -=Manual PD - Capítulo 2 - teoria de fundionamento (continuação)=-
+ -=Manual do PD - Capítulo 2: teoria de funcionamento (continuação)=-
- 2.9. Data structures
(Note: this section is adapted from an article submitted to ICMC 2002.)
+ {maketoc}
!!
2.9. Estrutura de Dados
(Nota: Esta seção foi adaptada de um artigo enviado ao ICMC 2002.)

The original idea in developing Pd was to make a real-time computer music performance environment like Max, but somehow to include also a facility for making computer music scores with user-specifiable graphical representations. This idea has important precedents in Eric Lindemann's Animal and Bill Buxton's SSSP. An even earlier class of precedents lies in the rich variety of paper scores for electronic music before it became practical to offer a computer-based score editor. In this context, scores by Stockhausen ( Kontakte and Studie II) and Yuasa (Toward the Midnight Sun) come most prominently to mind, but also Xenakis's Mycenae-alpha, which, although it was realized using a computer, was scored on paper and only afterward laboriously transcribed into the computer.

@@ -Linhas: 16-20 mudou para +Linhas: 17-22 @@
Here is the template associated with the graphical objects shown above:
- template for graphical score
+ {img src="img/wiki_up/fig9.2.jpg" align=center}
Templates consist of a data structure definition (the "struct" object) and zero or more drawing instructions ("filledpolygon" and "plot"). The "struct" object gives the template the name, "template-toplevel." The data structure is defined to contain three floating point numbers named "x", "y", and "voiceno," and two arrays, one named "pitch" whose elements belong to another template named "template-pitch," and similarly for the array "amp."

@@ -Linhas: 24-32 mudou para +Linhas: 26-35 @@

After the "struct" object in the template shown above, the remaining three objects are drawing instructions , first for a rectangle ("filledpolygon"), and then for two arrays. The various graphical attributes that are specified for drawing instructions may be numerical constants or data structure field names; in the latter case the value varies depending on the data. For instance, the second creation argument to "plot" is the color. The first "plot" plots the "amp" field and the color is given as 0, or black. The second one plots "pitch" using the color "voiceno". In this way the color of the second trace is attached to the "voiceno" slot in the data structure, so that color will vary according to its "voiceno" slot.
- 2.9.1. Traversal
+
!!!
2.9.1. Traversal

Pd objects are provided to traverse lists and arrays, and to address elements of data structures for getting and setting. Here is a patch showing how these facilities could be used, for example, to sequence the graphical score shown above:
- traversal example patch
+ {img src="img/wiki_up/fig9.3.jpg" align=center}

Pd has no built-in sequencer, nor even any notion that "x" values should be used as a time axis. (However, a "sort" function is provided, which reorders a list from left to right, on the assumption that users might often want to use Pd data collections as x-ordered sequences.) Recording sequences of events into lists, and/or playing the lists back as sequences, are functionalities that the user is expected to supply on top of Pd's offerings, which, it is hoped, would allow those functionalities within a much larger range of possibilities, to include random re-orderings of events, score following, self-modifying scores, reactive improvisation, and perhaps much more.

@@ -Linhas: 45-49 mudou para +Linhas: 48-53 @@

More general patches can easily be constructed which access heterogeneous lists of objects (having different templates). In this way, an arbitrarily rich personal "score language" can be developed and sequenced.
- 2.9.2. Accessing and changing data
+
!!!
2.9.2. Accessing and changing data

In general, accessing or changing data is done via "pointers" to "scalars". Numbers and symbols within scalars are accessed using the "get" object and changed, in the same way, using "set". Since lists and arrays are composed of scalars, every actual number or symbol in a data heap will be a number or symbol element of some scalar. To access them, it suffices to have objects to chase down elements of lists and arrays (given either a global name or a pointer to the containing scalar).

@@ -Linhas: 54-58 mudou para +Linhas: 58-63 @@

The "getsize" and "setsize" objects are provided to access or change the number of elements in the array. For lists, an "append" object appends a new scalar for a given template to a list, after the element pointed to. (To insert a scalar at the beginning of a list, the pointer can be set to the "head" of the list, a formal location before the first list item.) Deletion is less flexible; the only operation is to delete an entire list. (There's no reason not to provide finer-grain deletion mechanisms except that it's not clear how to protect against stale pointers efficiently, except by voiding the entire collection of pointers into a list.)
- 2.9.3. Editing
+
!!!
2.9.3. Editing

The graphical score shown above can be edited by dragging breakpoints, or by adding and deleting them, using mouse clicks. Also, entire objects or collections of them may be copied, pasted, and dragged around the screen. Alternatively, there is an editable (or computer generate-able or parse-able) text representation for the data, which may be seen or changed in a dialog window or read and written to external text files.

@@ -Linhas: 63-67 mudou para +Linhas: 68-73 @@

It can happen that two "struct" objects compete to define the same data structure, or that the user reads in data from a file which expects a different version of the structure, or alternatively, that the "struct" object for existing data objects disappears. For this reason, Pd maintains a private representation of the last active version of a "struct" until all similarly named "structs," as well as all data using that "struct", have disappeared. If the user introduces a new version of the "struct" and only later deletes the "current" one, the data is only conformed to the new version once the old one is deleted. In this way we avoid getting into situations where data is left hanging without its structure definition, or where data ends up belonging to two or more structures of the same name. The worst that can happen is that data may lose their drawing instructions, in which case Pd supplies a simple default shape.
- 2.9.4. Limitations
+
!!!
2.9.4. Limitations

When examples get more complicated and/or dense than the one shown here, it becomes difficult to see and select specific features of a data collection; more work is needed to facilitate this. There should be some facility for turning drawing instructions on and off, or perhaps for switching between versions of a template, depending on the user's desired view. There should also be a callback facility in the template for when an object is edited with the mouse, so that the user can bind actions to mouse clicks.

@@ -Linhas: 69-71 mudou para +Linhas: 75-79 @@
More generally, the collection of traversal objects that Pd provides is adequate to support a variety of modes of data collection and use, such as analysis and sequencing. But the patches required to traverse the data collections are not always simple. It would be desirable to find a more straightforward mechanism than that provided by the "pointer", "get" and "set" objects.
- The "data" facility, although part of the original plan for Pd, has only recently been implemented in its current form, and as (hopefully) the user base grows there will surely be occasions for many further extensions of the data handling primitives and the graphical presentation and editing functions.
+ The "data" facility, although part of the original plan for Pd, has only recently been implemented in its current form, and as (hopefully) the user base grows there will surely be occasions for many further extensions of the data handling primitives and the graphical presentation and editing functions.

voltar para ((MANUAL DO PD))

Histórico

Legenda: v - view, s - source, c - compare, d - diff

Data Usuári@ IpComentário Versão Ação
15:43:23 de 02/07/07 rodrigo200.140.205.37Página destravada 12
atual
 v  s
15:43:23 de 02/07/07 rodrigo200.140.205.37Página travada 11  v  s  c  d  
15:43:23 de 02/07/07 rodrigo200.140.205.37Página destravada 10  v  s  c  d  
15:43:23 de 02/07/07 rodrigo200.140.205.37PÃgina travada 9  v  s  c  d  
15:43:23 de 02/07/07 vitoriamario200.140.205.37traduçao 8  v  s  c  d  
18:36:22 de 07/05/07 vitoriamario200.103.145.82  7  v  s  c  d  
17:05:48 de 07/05/07 vitoriamario200.103.145.82  6  v  s  c  d  
16:31:07 de 07/05/07 vitoriamario200.103.145.82  5  v  s  c  d  
16:30:29 de 07/05/07 vitoriamario200.103.145.82  4  v  s  c  d  
16:24:51 de 07/05/07 vitoriamario200.103.145.82  3  v  s  c  d  
16:23:22 de 07/05/07 vitoriamario200.103.145.82  2  v  s  c  d  
16:21:25 de 07/05/07 vitoriamario200.103.145.82conteúdo, diagramação 1  v  s  c  d