patricksebastien / libpd4unity Goto Github PK
View Code? Open in Web Editor NEWlibpd for unity 3d
libpd for unity 3d
So I got it working with Unity 5.1 32 bit version. First run, then the randomOsc.pd works just fine. But if I run the second time, then the Editor crashes immediately and I get greeted with the Bug Reporter.
I have uploaded the error.log which the Bug Reporter made, which can be found here on Gist
A programmer named Slayther is trying to help me get libpd4unity working in the 32-bit Unity 5 editor (64-bit libpd apparently doesn't work in Windows) and we've run into this error. Any ideas?
http://i64.tinypic.com/ws93k2.png
Slayther: Which is strange, because when I checked the code, it indeed can take 2 arguments
http://i67.tinypic.com/nnlf15.png
Slayther: The second error is also odd
http://i64.tinypic.com/dbtd86.png
Thanks in advance,
Elliot
Sorry I don't know if this is the right place. I just can't receive messages from PD. I receive floats, using subscribe and then adding float to a queue. But could manage to do the same with messages or list. Do you have an example? or a brief explanation? Thank you
The current libpdcsharp.dll has a missing requirement for "libpthread-2.dll", probably because MingW gcc-4.50 ships with that.
Either this dll has to be included or the built made against "pthreadGC2.dll", which seems to be shipping with gcc-4.6x and also with earlier versions.
Using an older commit of libpdcsharp.dll together with pthreadCG2.dll made it work again.
Hello,
I tried the plugin on Mac + Unity 4.5 (free) but I came across the following error when starting the 01_LibPd_Basic.unity example: EntryPointNotFoundException: libpd_safe_init
So basically it says that the libpd_safe_init
function does not exist in libpdcsharp.dylib
I found a dirty fix for this: in LibPdNativeMethods.cs (line 88) I replaced libpd_safe_init
by libpd_init
which seems to exist in the dylib wrapper.
Not sure if this can cause later issues, but right now it works fine! Is it normal that this function doesn't exist? I couldn't find this function in the libpdcs sources...
Btw, (just for the record) to get this plugin to work in Unity free on Mac OS X, you have to rename libpdcsharp.dylib
to libpdcsharp.bundle
and put it in your project root folder (not in the /Assets
folder)
Also remove or rename /Assets/Plugins/libpdcsharp.bundle
to get rid of the License error message.
So by default on windows I get a .dll not found exception, even if I copy libpdcsharp.dll to the Unity.exe program folder. By analysing the .dll with Dependency Walker I determine this is because libpthreads-2.dll is missing. The solution is to also include the libpthreads-2.dll from MinGW.
I don't know how this has worked for anyone else, but I presume it's only a problem in situations where MinGW isn't on the system environment PATH var. This is probably the default for most users so I suggest the fix.
In a curiousity I can't create a pull request with an appropriate fix because I could only get a legacy version of MinGW working, which has a different pthreads lib. But it's a simple case of including the correct dll. I'll be happy to confirm it's working if somebody else could add it.
Described in more detail here: http://www.thefuntastic.com/2014/04/the-misadventures-of-unity-and-puredata-libpd/
Hello all,
Is it possible to synthesize audio with libpd within unity, and also mix in audio synthesized by unity itself?
I have a scene with a game object called "LibPd" that has the "AudioListener" component attached, as well as the LibPdFilterRead.cs script pointed to my pd patch. If this AudioListener and script are enabled, then I don't get any sound from Unity. If I disable the LibPdFilterRead.cs script, then I get sound from Unity itself.
Something I'm doing wrong?
I have following problem: i want to process microphone audio in Pd send from Unity using the given LibPdFilterRead.cs. it is working in that way that i can receive audio from unity, but Unity is sending aparently all incoming audio back to Pd, so that there is a loop now. That way, I cant use my pitch tracker on only the incoming micophone signal but get crosstalk from my Pd Audio source. What i want is only send the microphone input to Pd, nohting else. Any Ideas?
When running the 01_LibPd_Basic scene - after stopping the scene the first time, and then after running a second consecutive time, Unity crashes (shuts down and then shows the error report window).
After the first run there is an error message at the bottom of Unity reading: 'Licence error. This plugin is only supported in Unity Pro!'.
The libpdcsharp.dll was copied to C:\Program Files (x86)\Unity\Editor.
System specs:
Similar behaviour is shown on my Android device.
The same scene crashes when run a second time on the device. This is after, for instance, when the home button is pressed to exit the app, and the app is launched again from the home screen.
Device specs:
(note: regarding the Unity troubleshooting procedure for launch crashes:
http://docs.unity3d.com/Manual/TroubleShootingAndroid.html )
Hi,
I don't get external objects to work. I place the .c files inside Assets > StreamingAssets > PDAssets folder, but the objects doesn't work on my patches.
Do i miss something? Should I place a compiled .o file instead?
I would appreciate some more information about this. I am working with Unity 5 on Mac OsX.
Thanks.
Jara.
I'm getting a compilation error for this line:
public void OnAudioFilterRead (float[] data, int channels)
{ `
if(dataPtr == IntPtr.Zero)
{
dataHandle = GCHandle.Alloc(data,GCHandleType.Pinned);
dataPtr = dataHandle.AddrOfPinnedObject();
}
if (islibpdready) {
LibPD.Process(numberOfTicks, dataPtr, dataPtr);
}
}
The error is:
Assets/LibPdFilterRead.cs(52,31): error CS1502: The best overloaded method match for `LibPDBinding.LibPD.Process(int, double_, double_)' has some invalid arguments
Assets/LibPdFilterRead.cs(52,31): error CS1503: Argument
#2' cannot convert
System.IntPtr' expression to type `double*'
I receive bang from pure data with LibPD.Bang event then I play the sound by FMOD.
The problem is I receive bang frequently, for example each 500 ms but event doesn't trigger in specific length of frame. Usually length change 1 frame less or more.
Now I want to know any solution for this problem ? For example framerate independent event.
Because there is tempo for playing each sound and just 1 frame ruins rhythm.
I need to sync sounds for playing by each separate bang.
Hi,
First, thanks for sharing this resource!
I'm trying to build the 01_LibPd_Basic
scene to 64 bits standalone windows application but my build crashes imediately after the "built with unity" screen. In the unity editor, however, everything works as expected.
========== OUTPUTING STACK TRACE ==================
RtlLookupFunctionEntry returned NULL function. Aborting stack walk.
0x0000000066237815 (libpdcsharp) g_bang_setup
0x0000000066288CE1 (libpdcsharp) pd_vmess
0x00000000662B4EB6 (libpdcsharp) x_qlist_setup
0x00000000662894F5 (libpdcsharp) conf_init
0x000000006628C343 (libpdcsharp) pd_init
0x00000000662CE3FA (libpdcsharp) libpd_init
0x0000029206B25803 (Mono JIT Code) (wrapper managed-to-native) LibPDBinding.LibPD:libpd_init ()
0x0000029206B2247F (Mono JIT Code) LibPDBinding.LibPD:ReInit ()
0x0000029206B223E4 (Mono JIT Code) (wrapper synchronized) LibPDBinding.LibPD:ReInit ()
0x0000029206B21B47 (Mono JIT Code) LibPDBinding.LibPD:.cctor ()
0x0000029206B00493 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
0x00007FF953E764CF (mono) mono_set_defaults
0x00007FF953DC8A49 (mono) mono_runtime_invoke
0x00007FF953DCC39E (mono) mono_array_new
0x00007FF953E75C09 (mono) mono_set_defaults
0x00007FF953E75E45 (mono) mono_set_defaults
0x00007FF953E75ED8 (mono) mono_set_defaults
0x00007FF953E6DFAF (mono) mono_debugger_run_finally
<Missing stacktrace information>
========== END OF STACKTRACE ===========
Here are the output_log.txt
and error.log
.
libpdcsharp.dll
using: make csharplib
.LibPD.Process
.Any hint on how to solve this issue will be highly appreciated.
Thanks again,
Tom
After making a 64bit version of libpdcsharp.dll and placing it in the Unity.exe (version 5.2) directory, I get the following error:
Failed to load 'Assets/Plugins/libpdcsharp.dll' with error 'The operation completed successfully.
', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly.
LibPDBinding.LibPD:ReInit()
LibPDBinding.LibPD:ReInit()
LibPDBinding.LibPD:.cctor() (at Assets/LibPD/LibPDNativeMethods.cs:65)
LibPdFilterRead:Awake() (at Assets/LibPdFilterRead.cs:40)
LibPdFilterRead:Awake() (at Assets/LibPdFilterRead.cs:30)
I'd appreciate any suggestions. Thanks!
If I Run in the editor with the randomOsc.pd patch and then pauses the Editor. Then the patch continues to run.
Hello, I have a fairly simple question but I just can't seem to figure it out.
I'm using the expr object in PD and want to use it in my unity project, but when I'm building the libpdcsharp library with this command: (make libpdcsharp UTIL=true EXTRA=true) it should include the expr object right? (because the expr object is in EXTRA) When I rename the csharplib.dylib tocsharplib.bundle and replace the files in my unity project, it still cannot use the expr object I used in my patch. PD vanilla works fine.
In another post, you are saying: call the externalName_setup() function and use this compiled version of libpd. I'm not sure how to do this. I hope you are willing to help! :) (working with unity 5 on mac)
fyi: I can use the rev1~ external by placing it in the pd streaming assets folder.
Unpredictable error. Haven't figured out what is causing it yet.
Hi, I made a six-month development game for my university course:
https://polimi-game-collective.itch.io/gravitone
I successfully used your library, exporting for Windows Linux and Android.
However I'd really like to add iOS support.
How difficult will it be to support that platform?
I never programmed in Objective-C but I offer my help in testing.
Maybe we can take inspiration from Kalimba's iOS code.
Have a nice day!
Hi !
With the last version of libpd4unity I encounter the following errors :
Assets/LibPdFilterRead.cs(52,31): error CS1502: The best overloaded method match for "LibPDBinding.LibPD.Process(int, double*, double*)" has some invalid arguments
Assets/LibPdFilterRead.cs(52,31): error CS1503: Argument "#2" cannot convert "System.IntPtr" expression to type "double*"
I don't have these errors with the versions before the last commits (i downloaded a version the 3rd October and it has no errors)
Does someone have an idea about these ? (I'm not familiar with pointers so I can't really know what's going on)
Thanks !
I'm working with Unity 5.5.1f1 on macOS 10.12.3. I can compile 01_LibPd_Basic as a Mac Standalone, and it works as expected (after I make changes suggested in previous bug reports).
When switching the platform to iOS, however, while the project compiles, it generates no sound, and Xcode issues the following errors to its console:
Coincidentally, no version of the libpdcsharp file exists within the Xcode project, as far as I can tell.
opening the demo project in unity 2018.1.11 on OSX 10.12
Initially got several errors to turn on Player settings / allow unsafe, after doing this, the demo scene project still gets 2 erorrs that appear to be related to 16 bit short:
Assets/LibPdFilterRead.cs(52,10): error CS1502: The best overloaded method match for `LibPDBinding.LibPD.Process(int, short[], short[])' has some invalid arguments
Assets/LibPdFilterRead.cs(52,33): error CS1503: Argument #2' cannot convert
System.IntPtr' expression to type `short[]'
Is there any way to receive data from libpd ?
Hi
I love llibpd4unity, for me it is the best unity integration so far. But i need pitch detection in my project on android. And I can not get [sigmund~] nor [fiddle~] to work. Are they not included in libpdcsharp.so? would they work if you compile it again with the EXTRA=true flag? Now i try to rewrite pitch detection using strictly vanilla objects only, as I want to convince my collegues of using Pd, but without success so far.
I would be super nice, if you try to compile again with those objects included.
best,
Jonas
Hi,
I was wondering if this version is stable to be installaed in windows 64 bits and Unity 4.6 . I just saw some comments it should be used with unsafe tag and also needs to tweek the dataPtr line, but I don't know if should use and add it to my project or wait for some update.
My old version was working fine. I just couldn't receive any message, just floats from PD. Any idea why is this happening? Wich is the correct way to send messages from PD? just a normal array?
I downloaded the libpd4unity exactly as it said
install mingw and compile libpd (https://github.com/libpd/libpd) make csharplib
copy libs/libpdcsharl.dll to Assets/Plugins
And it is working fine with the unity editor and pc(windows), but i need it to work with unity webplayer and it dosen't work ( i see the images but there is no sound)
Can any one tell me something about this? any ideas?
Thanks,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.