Hi Scott,
The way I handle multiple instances is to open new patches via C# and store the dollar zero variable in a game object.
The PdAudioSource component can be attached to a prefab and you can instantiated the prefab via C#. PdAudioSource also stores the dollar zero variable of the associated patch, so you can directly send messages to a particular instance by calling methods in PdAudioSource. However, all send and receive objects in your patches need to start with a dollar zero (e.g. [send $0-Frequency], [receive $0-isPlaying]).
For audio signals, all patches need to have appropriate [throw~ ] objects (e.g. [throw~ out5] [throw~ out6]) in order to be heard. Audio signals from all instances will go through the [catch~ ] object in pdManager.pd, which is mapped to the Unity audio mixer. Getting audio input from Unity to libpd is a little bit tricky in this case. If someone need audio input from Unity, one might modify the OnAudioFilterRead method in PdStereo.cs.
My project isn't complete and I always welcome for suggestions or comments.
Best, Wing
Hello all, This is wonderful, thank you for contributing to this thread. Glad to see that Unity + PureData is active:
@wing: I also put together a unity+pd integration example; it has a bouncing ball withs sonification done in Pd; works on Android! https://github.com/cmuartfab/libpd4unity-starter I will take a look at your work also, thank you for sharing that.
@scott: I also tried Kalimba, but i have massive latency on Android, on the order of 300-500ms. Did you have this experience?
@scott+@wing: can you give me an example or two of when you may need multiple instances of LibPd in one's unity project? Couldnt you just make a more complex Pd patch that has all the things you want happening in it?
On Mon, Oct 24, 2016 at 5:51 PM, Wing Sang Wong wilsoncomposer@gmail.com wrote:
Hi Scott,
The way I handle multiple instances is to open new patches via C# and store the dollar zero variable in a game object.
The PdAudioSource component can be attached to a prefab and you can instantiated the prefab via C#. PdAudioSource also stores the dollar zero variable of the associated patch, so you can directly send messages to a particular instance by calling methods in PdAudioSource. However, all send and receive objects in your patches need to start with a dollar zero (e.g. [send $0-Frequency], [receive $0-isPlaying]).
For audio signals, all patches need to have appropriate [throw~ ] objects (e.g. [throw~ out5] [throw~ out6]) in order to be heard. Audio signals from all instances will go through the [catch~ ] object in pdManager.pd, which is mapped to the Unity audio mixer. Getting audio input from Unity to libpd is a little bit tricky in this case. If someone need audio input from Unity, one might modify the OnAudioFilterRead method in PdStereo.cs.
My project isn't complete and I always welcome for suggestions or comments.
Best, Wing
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/ listinfo/pd-list
hi Ali - answers inline, for my part,
On Mon, Oct 24, 2016 at 3:30 PM, Ali Momeni batchku@gmail.com wrote:
Hello all, This is wonderful, thank you for contributing to this thread. Glad to see that Unity + PureData is active:
@wing: I also put together a unity+pd integration example; it has a bouncing ball withs sonification done in Pd; works on Android! https://github.com/cmuartfab/libpd4unity-starter I will take a look at your work also, thank you for sharing that.
@scott: I also tried Kalimba, but i have massive latency on Android, on the order of 300-500ms. Did you have this experience?
Android latency is often a fact of life, even by that much. one question is whether you're getting that latency playing it in the Editor. if not, that may be a libpd question that would need answering. you might also reach out to Sebastian(hagish) to ask him, though he might be no longer working with libpd since Kalmiba wasn't updated in a while. he did in fact say that Android latency was an issue in the Read Me. however you might have more luck with this fork which has a latency fix in Android. not sure how good it is, but it's been updated about a year ago:
https://github.com/marcinkaszynski/kalimba
if you are getting latency in the Editor, i'm not sure what to say. i haven't tested latency yet (midterm grading wiped my weekend out).
@scott+@wing: can you give me an example or two of when you may need multiple instances of LibPd in one's unity project? Couldnt you just make a more complex Pd patch that has all the things you want happening in it?
@ali - as i understand it, creating instances of PD/libpd has been discussed for a while as a positive step. i haven't had a need for it yet but others on this list have discussed benefits, mostly in terms of both power and resource management. there are drawbacks as well, but unfortunately i don't know the particulars. one instance is enough for me for the moment though. but i think the strength is dynamically spawning and killing resources as needed.
best, scott
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Hello all,
My answers in line below:
On Mon, Oct 24, 2016 at 6:56 PM, Scott R. Looney scottrlooney@gmail.com wrote:
Android latency is often a fact of life, even by that much. one question is whether you're getting that latency playing it in the Editor. if not, that may be a libpd question that would need answering. you might also reach out to Sebastian(hagish) to ask him, though he might be no longer working with libpd since Kalmiba wasn't updated in a while. he did in fact say that Android latency was an issue in the Read Me. however you might have more luck with this fork which has a latency fix in Android. not sure how good it is, but it's been updated about a year ago:
This is great to know; i will try that. To answer your question, I do not have this latency issue in the editor. Even more importantly, I don't have this issue when i build the same Pd patch for android, using the libpd4unity approach, as i've done here: https://github.com/cmuartfab/libpd4unity-starter https://github.com/cmuartfab/libpd4unity-starter
@ali - as i understand it, creating instances of PD/libpd has been discussed for a while as a positive step. i haven't had a need for it yet but others on this list have discussed benefits, mostly in terms of both power and resource management. there are drawbacks as well, but unfortunately i don't know the particulars. one instance is enough for me for the moment though. but i think the strength is dynamically spawning and killing resources as needed.
Good to know; thanks scott.
ali
best, scott
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Here is another question for the libpd4unity crew:
What is the right approach for mixing audio generated by PD, with audio generated by Unity? It seems that my "AudioListener" component attached to my "LibPd" game object is preventing any other Unity AudioSources to play sound.
Any experience with this?
Thank you,
Ali
On Mon, Oct 24, 2016 at 7:23 PM, Ali Momeni batchku@gmail.com wrote:
Hello all,
My answers in line below:
On Mon, Oct 24, 2016 at 6:56 PM, Scott R. Looney scottrlooney@gmail.com wrote:
Android latency is often a fact of life, even by that much. one question is whether you're getting that latency playing it in the Editor. if not, that may be a libpd question that would need answering. you might also reach out to Sebastian(hagish) to ask him, though he might be no longer working with libpd since Kalmiba wasn't updated in a while. he did in fact say that Android latency was an issue in the Read Me. however you might have more luck with this fork which has a latency fix in Android. not sure how good it is, but it's been updated about a year ago:
This is great to know; i will try that. To answer your question, I do not have this latency issue in the editor. Even more importantly, I don't have this issue when i build the same Pd patch for android, using the libpd4unity approach, as i've done here: https://github.com/cmuartfab/libpd4unity-starter https://github.com/cmuartfab/libpd4unity-starter
@ali - as i understand it, creating instances of PD/libpd has been discussed for a while as a positive step. i haven't had a need for it yet but others on this list have discussed benefits, mostly in terms of both power and resource management. there are drawbacks as well, but unfortunately i don't know the particulars. one instance is enough for me for the moment though. but i think the strength is dynamically spawning and killing resources as needed.
Good to know; thanks scott.
ali
best, scott
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Hey Ali,
The AudioListener AFAIK is the component that makes sure the OAFR callback is scheduled for any AudioSources on your gameobject. These stack up though like a filter chain, so if your last audio source component has no audio input then it'll overwrite the previous elements in the filter chain.
One solution might be to put a pass-through system in your patch. Otherwise maybe try adding them to separate children and let Unity mix them.
Cheers, Joe
On 26 October 2016 at 16:39, Ali Momeni batchku@gmail.com wrote:
Here is another question for the libpd4unity crew:
What is the right approach for mixing audio generated by PD, with audio generated by Unity? It seems that my "AudioListener" component attached to my "LibPd" game object is preventing any other Unity AudioSources to play sound.
Any experience with this?
Thank you,
Ali
On Mon, Oct 24, 2016 at 7:23 PM, Ali Momeni batchku@gmail.com wrote:
Hello all,
My answers in line below:
On Mon, Oct 24, 2016 at 6:56 PM, Scott R. Looney scottrlooney@gmail.com wrote:
Android latency is often a fact of life, even by that much. one question is whether you're getting that latency playing it in the Editor. if not, that may be a libpd question that would need answering. you might also reach out to Sebastian(hagish) to ask him, though he might be no longer working with libpd since Kalmiba wasn't updated in a while. he did in fact say that Android latency was an issue in the Read Me. however you might have more luck with this fork which has a latency fix in Android. not sure how good it is, but it's been updated about a year ago:
This is great to know; i will try that. To answer your question, I do not have this latency issue in the editor. Even more importantly, I don't have this issue when i build the same Pd patch for android, using the libpd4unity approach, as i've done here: https://github.com/cmuartfab/libpd4unity-starter https://github.com/cmuartfab/libpd4unity-starter
@ali - as i understand it, creating instances of PD/libpd has been discussed for a while as a positive step. i haven't had a need for it yet but others on this list have discussed benefits, mostly in terms of both power and resource management. there are drawbacks as well, but unfortunately i don't know the particulars. one instance is enough for me for the moment though. but i think the strength is dynamically spawning and killing resources as needed.
Good to know; thanks scott.
ali
best, scott
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/li stinfo/pd-list
Hello all,
I have started a discussion about the C# API over at Github:
https://github.com/libpd/libpd/issues/153
To be clear, the restructuring of the C# API should not remove the current thin wrapper around the C API, but will additionally offer a more idiomatic API, and should be prepared for multi-instance support, that is about to come soon(TM).
Maybe starting this weekend I will start with a stubbed version of a new API, and will put it in a new branch over at Github, and encourage you all to give feedback, C# programmer or not.
I have some ideas, but not that much time.
Thanks, Thomas
On 25.10.2016 01:23, Ali Momeni wrote:
Hello all,
My answers in line below:
On Mon, Oct 24, 2016 at 6:56 PM, Scott R. Looney <scottrlooney@gmail.com mailto:scottrlooney@gmail.com> wrote:
Android latency is often a fact of life, even by that much. one question is whether you're getting that latency playing it in the Editor. if not, that may be a libpd question that would need answering. you might also reach out to Sebastian(hagish) to ask him, though he might be no longer working with libpd since Kalmiba wasn't updated in a while. he did in fact say that Android latency was an issue in the Read Me. however you might have more luck with this fork which has a latency fix in Android. not sure how good it is, but it's been updated about a year ago: https://github.com/marcinkaszynski/kalimba <https://github.com/marcinkaszynski/kalimba>
This is great to know; i will try that. To answer your question, I do not have this latency issue in the editor. Even more importantly, I don't have this issue when i build the same Pd patch for android, using the libpd4unity approach, as i've done here: https://github.com/cmuartfab/libpd4unity-starter https://github.com/cmuartfab/libpd4unity-starter https://github.com/cmuartfab/libpd4unity-starter
@ali - as i understand it, creating instances of PD/libpd has been discussed for a while as a positive step. i haven't had a need for it yet but others on this list have discussed benefits, mostly in terms of both power and resource management. there are drawbacks as well, but unfortunately i don't know the particulars. one instance is enough for me for the moment though. but i think the strength is dynamically spawning and killing resources as needed.
Good to know; thanks scott.
ali
best, scott _______________________________________________ Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list <https://lists.puredata.info/listinfo/pd-list>
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Hi,
On 25.10.2016 22:52, Thomas Mayer wrote:
Hello all,
I have started a discussion about the C# API over at Github:
https://github.com/libpd/libpd/issues/153
To be clear, the restructuring of the C# API should not remove the current thin wrapper around the C API, but will additionally offer a more idiomatic API, and should be prepared for multi-instance support, that is about to come soon(TM).
Maybe starting this weekend I will start with a stubbed version of a new API, and will put it in a new branch over at Github, and encourage you all to give feedback, C# programmer or not.
Here is a pull request with a simple implementation:
https://github.com/libpd/libpd/pull/154/commits
This is not production ready, but it is an API to discuss about.
Thanks for discussing the architecture, Thomas