Re: [PD] Sending data from PD to another program

2007-05-16 Thread Frank Barknecht
Hallo,
Frank Barknecht hat gesagt: // Frank Barknecht wrote:

> Yep, the real solution should be a different triggering. The left part
> of the patch now does the choice by looking up an element in a list of
> choices by position. The choice is send to the right part, which looks
> up a new pair of possible choices and sends it back to the left part,
> using [list]'s cold inlet to just store the choice. 

Now the missing text-files for testing.

Ciao
-- 
 Frank Barknecht _ __footils.org_ __goto10.org__
9 1
0 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 0Zero
One
Two
Three
Four
Five
Six
Seven
Eight
Nine___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Sending data from PD to another program

2007-05-16 Thread Frank Barknecht
Hallo,
[EMAIL PROTECTED] hat gesagt: // [EMAIL PROTECTED] wrote:

> So as I was saying, the 'next possible state transition' boxes seemt to
> lag behind the current state. By placing an extra [del 10] inlet to send
> each choice twice, this upates the next possible states correctly.

Just a note: What actually should be changed with my patch is the
order, in which messages are triggered and their number. For this you
should use [trigger] or [t ...] , and not [delay]. [del] may
have a similar result in this case, but [del] should be used for
timing things, not for ordering things.

> However, it requires an initial message of '0' to [t b a] to initialize
> the rest of the state machine to the proper location on the list. Then,
> each subsequent choice can be made from the radio toggle.
> 
> This becomes problematic because I would like to use the next possible
> state transitions to display the voting choices. However, using the
> workaround of [del 10] to send the choice twice means that the display for
> the next possible state transition is actually changing twice (albiet very
> quickly). I can imagine another hack-ish workaround involving a toggle to
> allow or prevent the message being passed from the next possible state
> transition(s) to the display, but I'd rather not have to do that if it's
> not necessary.

Yep, the real solution should be a different triggering. The left part
of the patch now does the choice by looking up an element in a list of
choices by position. The choice is send to the right part, which looks
up a new pair of possible choices and sends it back to the left part,
using [list]'s cold inlet to just store the choice. 

Displaying the choices also is done in the right part of the patch.

Ciao
-- 
 Frank Barknecht _ __footils.org_ __goto10.org__


state-machine-reworked.pd
Description: application/puredata
___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Sending data from PD to another program

2007-05-15 Thread Frank Barknecht
Hallo,
Jared Kling hat gesagt: // Jared Kling wrote:
> 
> Thanks for responding. I've been playing with state-machine.pd and think 
> I'm getting a grasp of it. At every line, the choice made will send the 
> state machine to that line's choice. For example, consider the following 
> example file, with line numbers in parentheses for easier reading...
> 3 4\; (line 0)
> 2 3\; (line 1)
> 0 1\; (line 2)
> 0 0\; (line 3)
> 3 1\; (line 4)
> 
> So the initial choices would be 3 and 4. choosing 4 would send the state 
> machine to line 4, where the choices would be 3 and 1, etc.

Yes, exactly.

> So I'll need to go through and set every 'node' of the story to a line 
> in the text file, with it's options sending it to the possible voting 
> choices. Since every node has, at most, 2 choices that shouldn't be a 
> problem.
> 
> My question would then be how can I go about labeling each line? I'm 
> assuming the \; at the end of each line is a line delimiter, so I could 
> put notes to myself after that line. It also seems like I could make 
> each line set up as follows:
> (linenumber1) (choicename1) (linenumber2) (choicename2)
> so it would look like
> 12 Go_Upstairs 7 Stay_Downstairs \;
> 
> Then I could display them simply by replacing the [unpack 0 0] with 
> [unpack 0 0 0 0] and the outlets would match the numbers and titles.

Basically yes. However you would need to use [unpack 0 s 0 s] because
every second element is a symbol, not a number, and also the [pd nth]
patch would need to be adapted: You need to select the first and third
element of the choice-list, that is, send a 0 and a 2 to the right
inlet.

However I guess it would be easier to keep it as it is, and use
another textfile only for translating numbers to labels. This textfile
would load a textfile only with labels, like: 
  
  Go_Upstairs
  Stay_Downstairs
  Fall_from_a_Tree
  ...

and you would use a simular construct as in [pd get-line...] to fetch
the correct label from that textfile by line-number.

Btw: It occured to me, that the version I had posted was actually
showing the past selection, not the one that a user can choose ATM. I
attached a slight modification, so that the "possible state
transitions" now show the possible *next* states to select.

> I guess I have two final questions, both slightly tangential. First, how 
> do you get a textfile to be read in by state-machine? You're using 
> random numbers to generate a list of numbered pairs and I can't seem to 
> figure out how to actually get it to read in from text, either from 
> looking through the PD list archive and the reference material. I feel 
> like this is probably one of those simple questions that I just haven't 
> been able to find the answer to.

You use a "read filename.txt" message. Check out the help-patch for
textfile. There is also the "read filename.txt cr" message possible
which would treat a normal linebreak as a line ending, so you can omit
the ";" that normally terminates lines in [textfile].


> Second, is there a way to have the titles in each line contain spaces? 
> That is, have the lines look like something like...
> 12 "Go Upstairs" 7 "Stay Downstairs"
> 
> Conversely, is there an easy way to strip out underscores?

There is no easy way, especially not if you store "mixed" lines like: 
"12 Go_Upstairs 7 Stay_Downstairs": Because then a space would mess up
the numbe of items like this:

Index: 0  1   2 3
Line:  12 Go_Upstairs 7 Stay_Downstairs

Index: 0  1  23 45
Line:  12 Go Upstairs 7 Stay Downstairs

However if you use a second textfile for labels as I recommend above,
you could use the abstraction [list-l2s] from the [list]-abs
collection to convert the lists stored in the label-textfile (like "Go
Downstairs") to symbols containing spaces easily. 

I put an example for the conversion into attached file as well.

Ciao
-- 
 Frank Barknecht _ __footils.org_ __goto10.org__


state-machine.pd
Description: application/puredata
___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Sending data from PD to another program

2007-05-15 Thread David Powers
Yes, I would second the recommendation to use Frank's method. I'm
continuing work on extending my own solution quick and dirty solution,
but I have a rather different use scenario in mind (visual/dataflow
method for creating generative chord progressions similar to diagrams
I used to create on paper for improvisors).

~David

On 5/15/07, Frank Barknecht <[EMAIL PROTECTED]> wrote:
> Hallo,
> Jared hat gesagt: // Jared wrote:
>
> > What I'd like to also do is have the text display the voting choices.
> > That is, at node dolphin the patch would display octopus and lobster.
> >
> > Is that information accessible, or am I out of luck?
>
> If you use my [textfile] based solution, then you already have that
> information available from the line in the textfile.
>
> 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


Re: [PD] Sending data from PD to another program

2007-05-15 Thread Frank Barknecht
Hallo,
Jared hat gesagt: // Jared wrote:

> What I'd like to also do is have the text display the voting choices. 
> That is, at node dolphin the patch would display octopus and lobster.
> 
> Is that information accessible, or am I out of luck?

If you use my [textfile] based solution, then you already have that
information available from the line in the textfile.

Ciao
-- 
 Frank Barknecht _ __footils.org_ __goto10.org__

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Sending data from PD to another program

2007-05-14 Thread Jared
David,

Thanks again for your help with the multiple path voting. Your patches 
have been extremely useful. I was hoping to pick your brain on one or 
two things.

I did have a question concerning looking ahead. With your patches (node 
and tree) is there any way to see future the children of nodes? I've 
very successfully used your patch with gem's ability to display text to 
have the name of a node displayed in a gem window by passing [r master] 
to the text display patch.

What I'd like to also do is have the text display the voting choices. 
That is, at node dolphin the patch would display octopus and lobster.

Is that information accessible, or am I out of luck?

As a side note, is there any way to give nodes names with spaces? I've 
been using underscores (node_name) which works well but is a little ugly.

Thanks again for all your help,
-Jared

David Powers wrote:
> Here you go, just use the tree abstraction and create named nodes for
> every event in your story!
> 
> Note that the nodes are hard coded to send to "master", you'd want
> another "master" receiver for your GEM abstraction to select the image
> which goes with the current node.
> 
> Oh, and of course replace the PD selector patch, which sends random 0
> or 1, with your actual voting mechanism.
> 
> ~David
> 
> On 5/6/07, David Powers <[EMAIL PROTECTED]> wrote:
>> I think I will try to do a quick prototype and email it to you in
>> 15-20 minutes.
>> ~David
>>
>> On 5/6/07, Jared <[EMAIL PROTECTED]> wrote:
>> > David,
>> >
>> > Thanks for the reply. That's basically what I want to do. My concern is
>> > that there are around 80 nodes which have to be displayed in specific
>> > if-then sequences (if it's at node 12 and the vote is A, go to node 33,
>> > if the vote is B go to node 37). My understanding of PD means this 
>> isn't
>> > *impossible*, it'll just be a bit clunky. If you have any 
>> suggestions to
>> > the contrary, I'd love to hear 'em.
>> >
>> > Thanks again!
>> > -Jared
>> >
>> > David Powers wrote:
>> > > Maybe I'm misunderstanding something, but what is it you want to
>> > > display in gem exactly? If, say, you had an image for every possible
>> > > node of the story, this would be trivial to implement. You just give
>> > > each possible story node a name, and send the name as a message. Then
>> > > some abstraction you build in PD/Gem takes the name as input, and
>> > > outputs the appropriate image.
>> > >
>> > > ~David
>> > >
>> > > On 5/5/07, Jared <[EMAIL PROTECTED]> wrote:
>> > >
>> > >>
>> > >> I have very approximate version of the voting working in PD but am
>> > >> unsure how to do the visual output. What I'd like to do is have 
>> PD send
>> > >> the vote information (that is, who won) to another program, either
>> > >> something I'll write or PowerPoint or the like, to run the display.
>> > >>
>> > >> I know PD can do visual output through Gem, but in exploring Gem I
>> > >> couldn't figure out an easy way to have the branching paths work,
>> > >> whereas branching paths in PowerPoint or in a homemade program 
>> could be
>> > >> relatively easy.
>> > >
>> > >
>> > >
>> >
>> >
>>


___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Sending data from PD to another program

2007-05-07 Thread David Powers
I thought of something like your solution too, Frank, I'll have to
give it an inspection after I get off work.

As for my own solution, I decided that it could be very useful for
Markov Chain / random walk type of operations, especially when they
are more cyclical and NOT tree structures. For a smaller number of
states, say under 20, it would be really easy to prototype using the
node method where you simply chain things together. In fact, an AI
generative music machine would greatly benefit from being able to do
such a walk.

However, is there any method for making dynamic select and number of
outlets in a node, without coding an external? Or would it be simpler
to hard-code the node abstraction with more outlets and let the user
choose to use less?

Also, I decided it would be nice to have node names in some kind of
namespace for the node, where it has the form 'name.message'. The idea
is that while the name might be unique, messages might not. This would
make it easy to write linear chord structures as a chain of dataflow
objects. So I'm trying to remember, can .39 vanilla PD split a symbol
based on some delimiter, such as '.' (decimal) ? It seems like I rely
on zexy for things like this sometimes! Or do I need to give the
abstraction both a name, and a message parameter?

~David

On 5/7/07, Frank Barknecht <[EMAIL PROTECTED]> wrote:
> Hallo,
> David Powers hat gesagt: // David Powers wrote:
>
> > Here you go, just use the tree abstraction and create named nodes for
> > every event in your story!
> >
> > Note that the nodes are hard coded to send to "master", you'd want
> > another "master" receiver for your GEM abstraction to select the image
> > which goes with the current node.
> >
> > Oh, and of course replace the PD selector patch, which sends random 0
> > or 1, with your actual voting mechanism.
> >
> > ~David
> >
> > On 5/6/07, David Powers <[EMAIL PROTECTED]> wrote:
> > >I think I will try to do a quick prototype and email it to you in
> > >15-20 minutes.
> > >~David
> > >
> > >On 5/6/07, Jared <[EMAIL PROTECTED]> wrote:
> > >> David,
> > >>
> > >> Thanks for the reply. That's basically what I want to do. My concern is
> > >> that there are around 80 nodes which have to be displayed in specific
> > >> if-then sequences (if it's at node 12 and the vote is A, go to node 33,
> > >> if the vote is B go to node 37). My understanding of PD means this isn't
> > >> *impossible*, it'll just be a bit clunky. If you have any suggestions to
> > >> the contrary, I'd love to hear 'em.
>
> I attached another solution to your problem, which may be easier to
> extend to 80 nodes, because not much patching is involved, instead you
> write a textfile with a definition of your state transitions (because
> basically what you seem to long for is just that: a state machine).
>
> The idea is to write a textfile where every line represents a certain
> state of your system indicated by the line number. The content of a
> line then specifies the possible transitions.
>
> In the example patch every state has two possible follow-up states
> written as numbers. Depending on the choice of a user (0 or 1 in the
> example) a new state is selected by selecting either the first or the
> second follow-up state and making that the new active state.
>
> 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


Re: [PD] Sending data from PD to another program

2007-05-07 Thread Frank Barknecht
Hallo,
David Powers hat gesagt: // David Powers wrote:

> Here you go, just use the tree abstraction and create named nodes for
> every event in your story!
> 
> Note that the nodes are hard coded to send to "master", you'd want
> another "master" receiver for your GEM abstraction to select the image
> which goes with the current node.
> 
> Oh, and of course replace the PD selector patch, which sends random 0
> or 1, with your actual voting mechanism.
> 
> ~David
> 
> On 5/6/07, David Powers <[EMAIL PROTECTED]> wrote:
> >I think I will try to do a quick prototype and email it to you in
> >15-20 minutes.
> >~David
> >
> >On 5/6/07, Jared <[EMAIL PROTECTED]> wrote:
> >> David,
> >>
> >> Thanks for the reply. That's basically what I want to do. My concern is
> >> that there are around 80 nodes which have to be displayed in specific
> >> if-then sequences (if it's at node 12 and the vote is A, go to node 33,
> >> if the vote is B go to node 37). My understanding of PD means this isn't
> >> *impossible*, it'll just be a bit clunky. If you have any suggestions to
> >> the contrary, I'd love to hear 'em.

I attached another solution to your problem, which may be easier to
extend to 80 nodes, because not much patching is involved, instead you
write a textfile with a definition of your state transitions (because
basically what you seem to long for is just that: a state machine).

The idea is to write a textfile where every line represents a certain
state of your system indicated by the line number. The content of a
line then specifies the possible transitions. 

In the example patch every state has two possible follow-up states
written as numbers. Depending on the choice of a user (0 or 1 in the
example) a new state is selected by selecting either the first or the
second follow-up state and making that the new active state. 

Ciao
-- 
 Frank Barknecht _ __footils.org_ __goto10.org__


state-machine.pd
Description: application/puredata
___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Sending data from PD to another program

2007-05-05 Thread IOhannes m zmoelnig
Jared wrote:

> I know PD can do visual output through Gem, but in exploring Gem I
> couldn't figure out an easy way to have the branching paths work,
> whereas branching paths in PowerPoint or in a homemade program could be
> relatively easy. Likewise, through searching the email archive, most of
> the information I could find on communication between PD and other
> programs was on sending data *to* PD, rather than *from* PD. If there's
> a thread in the archive or a manual/guide explaning what I'm looking
> for, I'd be happy to read through it if someone points me in the right
> direction.
> 

well [netsend] will send the data over a _very_ simple protocol (FUDI),
which is just plain-text; so you could easily parse it in your homemade
application.

if you don't care to write the server-code, you can use the "pdreceive"
application which will get the data from [netsend] and then pipe it into
your program.

mfgasdr.
IOhannes


PS: and i do think that it is trivial to do what you want with Gem,...

___
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list