Another newbie question... I'm trying to figure out how to make an array of arrays, or at least I think I am. What I'd like to do is to sample sounds from adc~ into a table or array (and I remain a bit confiused over whether they're the same thing, and the necessary relation of the visual array diagram to them), and them append each of them into an array of those, from which I can pick them out and play them as needed or randomly.
Part of this seems to require creating templates, but from going through all the docs that I can find and playing around with them, I remain unclear on the whole template thing. I have a feeling that the documentation is assuming some paradigm that I haven't gotten yet.
Any clues?
hi hope, i can help u again, array and table is similar, table does never (?) store the data, an array can do. there are several ways to load data into an array. use the soundfiler-object to read a file. or use the objects "tabwrite~" and "tabsend~" to stream into an array. (tabwrite~ fills the filles the whole array with samples, tabsend~ only sends one vector of samples (64 default) but continuously... as soon as there is data in an array, you can also read out the data from any position in any speed, time or direction you want. to "play" a table either use "tabplay~" or "tabread4~" in connection with "phasor~" or "line~" the output of phasor has to be multiplicated with the size (number) of the array and then be connected to the inlet of tabread~ (phasor outputs values from 0 to 1, the frequency of the phasor adjusts the tempo, in which the arraydata is read, use low frequencies) the line~ object can be fed with a message like "0, 44100 1000" (=go to zero, komma, go to the value 44100 in 1000 milliseconds). marius.
----- Original Message ----- From: "Joseph Zitt" jzitt@metatronpress.com To: "Pure Data" pd-list@iem.kug.ac.at Sent: Sunday, December 23, 2001 5:46 AM Subject: [PD] Arrays of arrays?
Another newbie question... I'm trying to figure out how to make an array of arrays, or at least I think I am. What I'd like to do is to sample sounds from adc~ into a table or array (and I remain a bit confiused over whether they're the same thing, and the necessary relation of the visual array diagram to them), and them append each of them into an array of those, from which I can pick them out and play them as needed or randomly.
Part of this seems to require creating templates, but from going through all the docs that I can find and playing around with them, I remain unclear on the whole template thing. I have a feeling that the documentation is assuming some paradigm that I haven't gotten yet.
Any clues?
-- |> ~The only thing that is not art is inattention~ --- Marcel Duchamp <| | jzitt@metatronpress.com http://www.metatronpress.com/jzitt | | Latest CDs: Collaborations/ All Souls http://www.mp3.com/josephzitt | | Comma: Voices of New Music Silence: the John Cage Discussion List |
table is just a handy object for making an array appear in a subpatch, rather than cluttering up your main window.
if you want to store anything other than a float in an array, you need to use templates. making an array of arrays definitely falls into this category. but, apparently miller is making some big changes to this part of pd (constantly?).
but even then, i'm not sure if you would be able to easily write to a template-like array (which is i think is a very different animal to a "normal" array).
how many different arrays do you need? if it's a manageable upper limit, you might be able to just build the arrays statically (because without the template stuff, this is really the way that pd has to work - atleast without selfmod hacks). switching between them could be tricky tho (i'm not sure if tabread4~ can take a "set" argument to change the source table).
On Sat, 22 Dec 2001 22:46:16 -0600 Joseph Zitt jzitt@metatronpress.com wrote:
Another newbie question... I'm trying to figure out how to make an array of arrays, or at least I think I am. What I'd like to do is to sample sounds from adc~ into a table or array (and I remain a bit confiused over whether they're the same thing, and the necessary relation of the visual array diagram to them), and them append each of them into an array of those, from which I can pick them out and play them as needed or randomly.
Part of this seems to require creating templates, but from going through all the docs that I can find and playing around with them, I remain unclear on the whole template thing. I have a feeling that the documentation is assuming some paradigm that I haven't gotten yet.
Any clues?
-- |> ~The only thing that is not art is inattention~ --- Marcel Duchamp <| | jzitt@metatronpress.com http://www.metatronpress.com/jzitt | | Latest CDs: Collaborations/ All Souls http://www.mp3.com/josephzitt | | Comma: Voices of New Music Silence: the John Cage Discussion List |
On Sun, Dec 23, 2001 at 12:47:33PM +0100, pix wrote:
table is just a handy object for making an array appear in a subpatch, rather than cluttering up your main window.
Ah, OK. I would probably want to use that, then, since I'm not particularly interested, in this case. in seeing visual representations of the arrays.
if you want to store anything other than a float in an array, you need to use templates. making an array of arrays definitely falls into this category. but, apparently miller is making some big changes to this part of pd (constantly?).
Hmm, ok.
but even then, i'm not sure if you would be able to easily write to a template-like array (which is i think is a very different animal to a "normal" array).
how many different arrays do you need? if it's a manageable upper limit, you might be able to just build the arrays statically (because without the template stuff, this is really the way that pd has to work - atleast without selfmod hacks). switching between them could be tricky tho (i'm not sure if tabread4~ can take a "set" argument to change the source table).
Hmm, I don't know the upper limit. What I want to do is this: I will be doing a vocal improvisation. At any time (determined by random) the system will either listen to and record what I'm doing at that moment (with the length of the sample also randomly determined) or play back something it has already sampled. So I'm figuring that it will record the samples, then append them into an array/table of the recorded samples, from which the system could then pick out samples randomly and play them as needed.
Thanks for the information.
Joseph Zitt hat gesagt: // Joseph Zitt wrote:
Another newbie question... I'm trying to figure out how to make an array of arrays, or at least I think I am. What I'd like to do is to sample sounds from adc~ into a table or array (and I remain a bit confiused over whether they're the same thing, and the necessary relation of the visual array diagram to them), and them append each of them into an array of those, from which I can pick them out and play them as needed or randomly.
(table and array are basically the same except that tables live in their own object windows and that you can give them $-names which is nice in subpatches. All array documentation is valid for tables, too)
You could make an index table that indexes the sample-tables you would like to play, and then "tabread" through this table. I attached an example patch, that works like this. Then you can either random play through this sequence or play through the sequence in order with a simple counter. The nice thing about this is that tables can easily be saved to textfiles if you send them "save to.txt" messages and you can reload them with "read" messages. See also the help patch "42.PART6.analog.sequencer.pd".
Part of this seems to require creating templates, but from going through all the docs that I can find and playing around with them, I remain unclear on the whole template thing. I have a feeling that the documentation is assuming some paradigm that I haven't gotten yet.
Me neither, unfortunatly. Maybe I'll dive into this in the christmas holidays...
__ __
Frank Barknecht ____ ______ ____ __ trip\ \ / /wire ______
/ __// __ /__/ __// // __ \ / / __ \ ___\
/ / / ____/ / / / // ____// /\ \ ___\____ \
/_/ /_____/ /_/ /_//_____// / \ \_____\_____
/_/ _\
OK, this is getting clearer...
I'm curious about the "table" objects such as
#X obj 285 138 table 2-samp;
that appear to float alone on the screen, though they are drawn with an inlet and an outlet. In digging around, I don't see help or documentation on the object, and I don't see what the inlet and outlet are for.
Ideally, I would hope that they could take an input value and create a table on the fly, with something like "table $1-table". I'd also like to see what they send as output, but nothing that I've tried attaching to the output (number, symbol, or print objects)has revealed what it's sending.
I'm also occasionally getting on the console screen "Consistency check failed: tabwrite_tilde_tick". Any idea what this is and if I should worry?
Joseph Zitt hat gesagt: // Joseph Zitt wrote:
OK, this is getting clearer...
I'm curious about the "table" objects such as
#X obj 285 138 table 2-samp;
that appear to float alone on the screen, though they are drawn with an inlet and an outlet. In digging around, I don't see help or documentation on the object, and I don't see what the inlet and outlet are for.
It may be a bit misleading, that I put the "table"s under the soundfiler stuff. You don't need to connect anything to a table, like you can't connect anything directly to an array, that has no inlets. The soundfiler objects write into the array given to them in a "read -resize file.wav arrayname" message. No strings necessary. But you can connect messages to a table, like shown in my patch with the table "which_samp". Here I send just some numbers, that are put as y-values into the table. Or you could send a "resize 10" message to change the table's size to 10 values.
Ideally, I would hope that they could take an input value and create a table on the fly, with something like "table $1-table". I'd also like to see what they send as output, but nothing that I've tried attaching to the output (number, symbol, or print objects)has revealed what it's sending.
"table $1-table" would just name the table's array depending on the arguments in a calling patch.
And don't bother, many people may have looked for the output's functionality, but: in pd-0.35 table has a help-patch, that reveals: The outlet of a table does nothing and is to be removed in further versions of PD ;)
I'm also occasionally getting on the console screen "Consistency check failed: tabwrite_tilde_tick". Any idea what this is and if I should worry?
That's strange, I've never seen this.
__ __
Frank Barknecht ____ ______ ____ __ trip\ \ / /wire ______
/ __// __ /__/ __// // __ \ / / __ \ ___\
/ / / ____/ / / / // ____// /\ \ ___\____ \
/_/ /_____/ /_/ /_//_____// / \ \_____\_____
/_/ _\
On Mon, Dec 24, 2001 at 09:57:39AM +0100, Frank Barknecht wrote:
Ideally, I would hope that they could take an input value and create a table on the fly, with something like "table $1-table". I'd also like to see what they send as output, but nothing that I've tried attaching to the output (number, symbol, or print objects)has revealed what it's sending.
"table $1-table" would just name the table's array depending on the arguments in a calling patch.
Hmm. So what I'm wondering is this: could we put the table object in a chain, so that, for example, I could bang a counter, send the outlet of the counter into the inlet of a "table $1-table" object, and thus create new tables (1-table, 2-table, 3-table, etc) on demand as needed?
And don't bother, many people may have looked for the output's functionality, but: in pd-0.35 table has a help-patch, that reveals: The outlet of a table does nothing and is to be removed in further versions of PD ;)
Ah, OK, I won't worry about that part then :-)
Joseph Zitt hat gesagt: // Joseph Zitt wrote:
On Mon, Dec 24, 2001 at 09:57:39AM +0100, Frank Barknecht wrote:
"table $1-table" would just name the table's array depending on the arguments in a calling patch.
Hmm. So what I'm wondering is this: could we put the table object in a chain, so that, for example, I could bang a counter, send the outlet of the counter into the inlet of a "table $1-table" object, and thus create new tables (1-table, 2-table, 3-table, etc) on demand as needed?
For creating table's on demand you will have to resort to the self-modifing patches stuff, that you can find on the pd-wiki-page AFAIK.
But I think you misunderstood what a [table $1-table] does. It is best seen with an example patch, and so I attached one ;) It has a patch "mytable.pd" that only has one pbject called [table $1-name]. The patch "test-mytable.pd" calls [mytable] two times with different arguments: "testtable" and "1". Those arguments are then used by [table $1-name] to name the table array to "testtable-name" rsp. "1-name". You can see this if you click-open the subpatches and then the [table $1-name] object: Both have different names.
Tables are nice for modularizing your PD-code: You can create subpatches for tables that you can put more than one time into you patches without name clashes.
The table inlet is only good for messages, that set the table's array values, give it borders or change the name.
__ __
Frank Barknecht ____ ______ ____ __ trip\ \ / /wire ______
/ __// __ /__/ __// // __ \ / / __ \ ___\
/ / / ____/ / / / // ____// /\ \ ___\____ \
/_/ /_____/ /_/ /_//_____// / \ \_____\_____
/_/ _\
On Tue, Dec 25, 2001 at 08:25:50PM +0100, Frank Barknecht wrote:
But I think you misunderstood what a [table $1-table] does. It is best seen with an example patch, and so I attached one ;) It has a patch "mytable.pd" that only has one pbject called [table $1-name]. The patch "test-mytable.pd" calls [mytable] two times with different arguments: "testtable" and "1". Those arguments are then used by [table $1-name] to name the table array to "testtable-name" rsp. "1-name". You can see this if you click-open the subpatches and then the [table $1-name] object: Both have different names.
Tables are nice for modularizing your PD-code: You can create subpatches for tables that you can put more than one time into you patches without name clashes.
The table inlet is only good for messages, that set the table's array values, give it borders or change the name.
OK, so if I understand this, we can't create tables on the fly, since the table object only tells us about tables that are created when the patch is first opened. (Although I'm curious about the use of the "$0-table" in the test help patch at http://iem.kug.ac.at/mailinglists/pd-list/2001-09/att-0129/01-table.pd )
So maybe I should create a patch (or sub-patch) that contains, say, 100 table objects named 1-table through 100-table right at the start, then use them as I need them, passing the numbers 1-100 into what ever references them as needed. For the current purpose, I think reusing them after I run out shouldn't be a problem.
Joseph Zitt hat gesagt: // Joseph Zitt wrote:
OK, so if I understand this, we can't create tables on the fly, since the table object only tells us about tables that are created when the patch is first opened. (Although I'm curious about the use of the "$0-table" in the test help patch at http://iem.kug.ac.at/mailinglists/pd-list/2001-09/att-0129/01-table.pd )
$0 is a special variable that gets an unique name in every subpatch, but you can't say in advance, what name this will be. You use $0 in a table if you want to make the table local to a subpatch.
__ __
Frank Barknecht ____ ______ ____ __ trip\ \ / /wire ______
/ __// __ /__/ __// // __ \ / / __ \ ___\
/ / / ____/ / / / // ____// /\ \ ___\____ \
/_/ /_____/ /_/ /_//_____// / \ \_____\_____
/_/ _\
On Wed, Dec 26, 2001 at 11:10:04AM +0100, Frank Barknecht wrote:
Joseph Zitt hat gesagt: // Joseph Zitt wrote:
OK, so if I understand this, we can't create tables on the fly, since the table object only tells us about tables that are created when the patch is first opened. (Although I'm curious about the use of the "$0-table" in the test help patch at http://iem.kug.ac.at/mailinglists/pd-list/2001-09/att-0129/01-table.pd )
$0 is a special variable that gets an unique name in every subpatch, but you can't say in advance, what name this will be. You use $0 in a table if you want to make the table local to a subpatch.
Ah, right. I should have remembered that.
So maybe I should create a patch (or sub-patch) that contains, say, 100 table objects named 1-table through 100-table right at the start, then use them as I need them, passing the numbers 1-100 into what ever references them as needed. For the current purpose, I think reusing them after I run out shouldn't be a problem.
Hi. Just a couple of points that I wanted to interject on this discussion.
Make a subpatch with $0-mytable. Then make 100 copies of it. Use global send and recieves to communicate with all the objects... have them broadcast their id-values [int $0] to a centralized collection.... if you want to get more fancy, give 'busy' and 'free' state for each object... this enables dynamic-reuse.
Think of a multi-dimensional table like a multi-channel raw audio file... its really just a 1D table with the samples interleaved or blocked into chunks. i.e. a table of length 10,000 could be 100 tables of length 100.
andy
On Wed, Dec 26, 2001 at 01:16:17PM -0800, Andrew (Andy) W. Schmeder wrote:
- Try a 'society of objects' model;
Make a subpatch with $0-mytable. Then make 100 copies of it. Use global send and recieves to communicate with all the objects... have them broadcast their id-values [int $0] to a centralized collection.... if you want to get more fancy, give 'busy' and 'free' state for each object... this enables dynamic-reuse.
I don't quite understand this, but I've come up with something that works, creating a subpatch that declares 100 tables (thanks to a quick and dirty Perl script to build the PD file), which I can then get at via, for example, sending a "set $1-bozotable" message to tabwrite~ and then writing to it.
Which leads me to another question: I'd like to be able to record or play a table, then, when that's done, take another action. I'm not seeing a way to tell if a tabplay~ or tabwrite~ has finished. Is there someway that it tells that it's done, or some way to know how long to wait?
Joseph Zitt hat gesagt: // Joseph Zitt wrote:
On Wed, Dec 26, 2001 at 01:16:17PM -0800, Andrew (Andy) W. Schmeder wrote:
Which leads me to another question: I'd like to be able to record or play a table, then, when that's done, take another action. I'm not seeing a way to tell if a tabplay~ or tabwrite~ has finished. Is there someway that it tells that it's done, or some way to know how long to wait?
When a tabplay~ has stopped, the right outlet sends a bang. I used this in my array_of_array.pd patch.
But tabwrite~ doesn't stop until you explicitly stop it yourself. Which leads to the problem, that it even records after the array is full. These data is lost, then.
__ __
Frank Barknecht ____ ______ ____ __ trip\ \ / /wire ______
/ __// __ /__/ __// // __ \ / / __ \ ___\
/ / / ____/ / / / // ____// /\ \ ___\____ \
/_/ /_____/ /_/ /_//_____// / \ \_____\_____
/_/ _\
hi,
tabwrite~ does stop (and redraws the array) when it reaches end of array. Btw. if you happen to know an array size, you may arm a delay in order to get a bang after recording is done. Or, even if an array was resized to an unknown size, you may start a dummy tabplay~ in sync with a tabwrite~. Direct bangout from tabwrite~ would be nicer, though (and it needs 3 lines of code)...
Krzysztof
Frank Barknecht wrote: ...
But tabwrite~ doesn't stop until you explicitly stop it yourself. Which leads to the problem, that it even records after the array is full. These data is lost, then.
On Thu, Dec 27, 2001 at 01:37:01PM +0100, Krzysztof Czaja wrote:
tabwrite~ does stop (and redraws the array) when it reaches end of array. Btw. if you happen to know an array size, you may arm a delay in order to get a bang after recording is done. Or, even if an array was resized to an unknown size, you may start a dummy tabplay~ in sync with a tabwrite~.
Ah, this is useful. And, as it happens, in this patch I'm resizing the array just before recordingit, so I'll know the size.
hi,
this may happen if an array itself was renamed, but tabwrite~ was not
set' to a new name. The immediate consequence is that tabwrite~ still records to a renamed array, but fails to redraw it. This failure is treated as an internal bug. Whether this is the
right'
behaviour, I do not know, but there is a real bug lurking here anyway,
which I will report in a separate post.
You may play with `check-array.pd' attachment, which reliably fails to pass tabwrite~ consistency checks...
Krzysztof
Joseph Zitt wrote: ...
I'm also occasionally getting on the console screen "Consistency check failed: tabwrite_tilde_tick". Any idea what this is and if I should worry?
#N canvas 207 232 521 362 12; #X msg 34 28 bang ; pd dsp 1 ; mew rename grrr...; #X msg 85 138 bang; #X obj 34 234 tabwrite~ mew; #X graph graph1 0 -1 99 1 261 312 461 172; #X array mew 100 float 0; #X pop; #X connect 0 0 2 0; #X connect 1 0 2 0;