stupid n00bie question: Part II
Okay, I beg your pardon in advance again...... 1. Are the MAUI modules available only for miniAudicle, and not Audicle? That would mean that one can only do this on Mac. I'm a dodo using XP. 2. Can two ChucK shreds throw data at each other in the same VM, like two Python sockets? So I could read Microphone data in RMS off one shred and throw it towards a Python GUI using another shred which is using OSC? Can two shreds talk? I'll be grateful for your answers. ------- -.- 1/f ))) --. ------- ... http://www.algomantra.com
On 10/10/07, AlgoMantra
Okay, I beg your pardon in advance again......
Why? That's what the list is for! :¬) 1. Are the MAUI modules available only for miniAudicle, and not Audicle?
That would mean that one can only do this on Mac. I'm a dodo using XP.
Yeah, at least so far. 2. Can two ChucK shreds throw data at each other in the same VM, like two
Python sockets? So I could read Microphone data in RMS off one shred and throw it towards a Python GUI using another shred which is using OSC? Can two shreds talk?
Yes, you can. The easiest way to go about this is to make sure both shreds come from the same .ck file. If they do they share the name space of that file so any event or variable defined in there should be open to both. The exception is things defined inside of functions (and in this case all but one of those shreds will be sporked functions). Something defined inside of a function will only be accessible to that function. If the above is all you need I'd keep it in a single file and use a event, the first shred would analyze the sound and broadcast the event whenever something interesting happens, the second would wait for the event and send the OSC. The sections in the manual and the /examples/ dir on events contain everything you'll need. It gets slightly harder if the two shreds come from different files, if that is the case the trick is to make a public class containing a static event and have both shreds use a instance of that. This is a bit of a work-around but it does work. The one thing to mind is that non-primitive static objects in public classes have a issue with instantiation, to get around this you need to define the class, then define a event outside of it and asign this to it. Fortunately you only need to do that once and it'll be fine, there has been quite a bit of discussion about this on the list that you might want to look up (mainly on static arrays). If that's the route you take and you run into trouble get back to it and I or somebody else will talk you through it. Hope that helps, Kas.
Wow, thanks a lot again, Kas! I dub thee
Kassen the Benevolent!
I'm glad the days of RTFM are over, and... as a friend of mine suggested
the days of ATFM have begun (Ask The F=>* Mastah)
:D
On 10/10/07, Kassen
On 10/10/07, AlgoMantra
wrote: Okay, I beg your pardon in advance again......
Why? That's what the list is for! :¬)
1. Are the MAUI modules available only for miniAudicle, and not Audicle?
That would mean that one can only do this on Mac. I'm a dodo using XP.
Yeah, at least so far.
2. Can two ChucK shreds throw data at each other in the same VM, like two
Python sockets? So I could read Microphone data in RMS off one shred and throw it towards a Python GUI using another shred which is using OSC? Can two shreds talk?
Yes, you can. The easiest way to go about this is to make sure both shreds come from the same .ck file. If they do they share the name space of that file so any event or variable defined in there should be open to both. The exception is things defined inside of functions (and in this case all but one of those shreds will be sporked functions). Something defined inside of a function will only be accessible to that function.
If the above is all you need I'd keep it in a single file and use a event, the first shred would analyze the sound and broadcast the event whenever something interesting happens, the second would wait for the event and send the OSC. The sections in the manual and the /examples/ dir on events contain everything you'll need.
It gets slightly harder if the two shreds come from different files, if that is the case the trick is to make a public class containing a static event and have both shreds use a instance of that. This is a bit of a work-around but it does work. The one thing to mind is that non-primitive static objects in public classes have a issue with instantiation, to get around this you need to define the class, then define a event outside of it and asign this to it. Fortunately you only need to do that once and it'll be fine, there has been quite a bit of discussion about this on the list that you might want to look up (mainly on static arrays). If that's the route you take and you run into trouble get back to it and I or somebody else will talk you through it.
Hope that helps, Kas.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- ------- -.- 1/f ))) --. ------- ... http://www.algomantra.com
Why, thank you!
I feel simply pointing people to the manual wouldn't be so kind.
Particularly because the manual doesn't really go into the little details of
namespace issues (which this kinda is) and doesn't help at all with regard
to static stuff in public classes (which is almost pure voodoo at the
moment). There are many other subjects where they manual is wonderful but I
assume everybody realizes that searching a PDF is generally faster then
sending a mail, then waiting for the answer.
Cheers,
Kas.
On 10/10/07, AlgoMantra
Wow, thanks a lot again, Kas! I dub thee Kassen the Benevolent!
I'm glad the days of RTFM are over, and... as a friend of mine suggested the days of ATFM have begun (Ask The F=>* Mastah)
The easiest way to go about this is to make sure both shreds come from the
same .ck file. If they do they share the name space of that file so any
event or variable defined in there should be open to both. The exception is
things defined inside of functions (and in this case all but one of those
shreds will be sporked functions). Something defined inside of a function
will only be accessible to that function.
Well, I am basically putting the lines of code that track the frequency in
the same .ck file
where other lines of code send OSC messages to Python. I am still finding it
hard to
understand what you mean by multiple "shred"(s) in the same .ck file. ???
When I throw a .ck file into the VM, it starts a shred. Are you saying that
throwing
one ck file into the VM can start many shreds?
------- -.-
1/f ))) --.
------- ...
http://www.algomantra.com
On 10/10/07, Kassen
On 10/10/07, AlgoMantra
wrote: Okay, I beg your pardon in advance again......
Why? That's what the list is for! :¬)
1. Are the MAUI modules available only for miniAudicle, and not Audicle?
That would mean that one can only do this on Mac. I'm a dodo using XP.
Yeah, at least so far.
2. Can two ChucK shreds throw data at each other in the same VM, like two
Python sockets? So I could read Microphone data in RMS off one shred and throw it towards a Python GUI using another shred which is using OSC? Can two shreds talk?
Yes, you can. The easiest way to go about this is to make sure both shredscome from the same .ck file. If they do they share the name space of that file so any event or variable defined in there should be open to both. The exception is things defined inside of functions (and in this case all but one of those shreds will be sporked functions). Something defined inside of a function will only be accessible to that function.
If the above is all you need I'd keep it in a single file and use a event, the first shred would analyze the sound and broadcast the event whenever something interesting happens, the second would wait for the event and send the OSC. The sections in the manual and the /examples/ dir on events contain everything you'll need.
It gets slightly harder if the two shreds come from different files, if that is the case the trick is to make a public class containing a static event and have both shreds use a instance of that. This is a bit of a work-around but it does work. The one thing to mind is that non-primitive static objects in public classes have a issue with instantiation, to get around this you need to define the class, then define a event outside of it and asign this to it. Fortunately you only need to do that once and it'll be fine, there has been quite a bit of discussion about this on the list that you might want to look up (mainly on static arrays). If that's the route you take and you run into trouble get back to it and I or somebody else will talk you through it.
Hope that helps, Kas.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
--
On 10/17/07, AlgoMantra
When I throw a .ck file into the VM, it starts a shred. Are you saying that throwing one ck file into the VM can start many shreds?
Yes, I am! Look up "sporking" and "concurrency" in the manual. You can easily start tens of thousands of shreds from one file if your CPU can keep up. All of that will be sample-accurate. It's called "The Tao of the one file punch" ;¬) Happy sporking, Kas.
participants (2)
-
AlgoMantra
-
Kassen