Apologies for spam; we've changed our policy by requiring approval for accounts, and deleted all existing spam and user - thanks for your help flagging content. We continue to test our forums and Vanilla software, aiming for release early in 2013. If you need to give us feedback outside the forum, contact us via http://createdigitalmusic.com/contact/ or on Facebook
Using externals with libpd
  • Hello,

    i want to use freeverb~ with libpd on android. I read the Chapter "Building Externals for Android" in the Book Making Musical Apps and the related links. I tried to compile the freeverb~.c with the Makefile next to under Mac OSX. Here is the command: make NDK_BASE=/path/to/android-ndk-r5 UNAME=ANDROID CFLAGS=-I./ Result: "ld: symbol(s) not found for architecture x86_64" I searched for any switch to set the architecture but didn't find anything. Any ideas?

    But anyway i have some problems to understand the whole process. What is the outcome of the makefile? And how does libpd know that i can use the freeverb~ patch from now? Hope, someone enlightened me.

    Greetings, KK

  • pbrinkmannpbrinkmann
    Accepted Answer

    Good news: Building and deploying externals for Android will become much easier once the new OpenSL components are official.

    Bad news: The OpenSL components are not entirely done yet, but I'm hoping to make some progress over the long weekend. Stay tuned!

  • You can have a look at my fork, mainly: https://github.com/patricksebastien/libpd/blob/master/Makefile https://github.com/patricksebastien/libpd/blob/master/libpd_wrapper/z_libpd.c https://github.com/patricksebastien/libpd/blob/master/libpd_wrapper/z_libpd.h

    After I can libpd_fiddle_tilde_setup if i want to use it in a patch, but i don't know how to release it... Any idea?

  • I'd like to use freeverb~ and other externals with libpd on Android. News about that? I'm totally noob with NDK, JNI... so, I don't know where to start... I've downloaded and installed the NDK, what next? What are the general steps to make an external work with libpd on Android?

  • Check out the end of this thread for pointers on libpd and Pd extended: http://createdigitalnoise.com/discussion/1341/can-i-use-pd-extended-with-libpd/p1

    Also, you can look at the ScenePlayer sample app in pd-for-android. That one includes some custom externals, along with makefiles that show how to build them.

  • Oh, and by the way, the OpenSL components of libpd have been official for a few weeks now, so the new, improved way of deploying externals is now in the master branch.

  • Ok, something weird is going on here.

    I downloaded the freeverb~ 1.2 source and I successfully compiled it with NDK using a modified version of the makefile from ScenePlayer. I moved libfreeverb_tilde.so from the armeabi dir to a dir on my device, and added the proper PdBase.addToSearchPath call to my code. The problem I'm facing is that, while the object seems to be correctly loaded from libpd, since on LogCat I can see pd saying "freeverb~ v1.2", it doesn't seem to work as it should. The input passing through the object looks to be just slightly amplified, but there's no reverb at all.

    This is the patch I'm using, which is working fine on my computer: http://pastebin.com/JZS3eMAM

    Any idea of what could it be?

  • When you say you moved the binary to a directory on your device, do you mean a directory on the SD card? That won't work because the SD card is mounted with noexec. Also, it's easier if you just leave the binary in the directory where the NDK put it. If you use PdService, it'll automatically set the search path. If you aren't using PdService, you can look at the code of PdService to see how to set the search path.

  • I refactored my project, so that it follow the structure of the ScenePlayer project. I've noticed that the appropriate libfreeverb_tilde.so file is automatically copied in /data/data/package.name/lib along with the other externals from libpd, at installation time. I'm also importing the externals just like in the PdService class. I don't know if it's related to this refactoring (I don't think so), but now it seems to work..... sometimes! Freeverb~ seems to be always loaded correctly because pd always prints the freeverb~ name and version and even when it doesn't reverberate the input, "something" is working in sense that data passes through the freeverb~ object. Still, sometimes it just amplifies the sound by some factor and at other times it works as expected, producing the reverberated input. One thing I noticed is that generally the first time after uninstalling and reinstalling the app (by launching it from the Run button in Eclipse) tend not to work. Just closing the app and relaunching it from Eclipse generates a correct output. It seems something related to timings or first-time initializations. My code is single-threaded, so there are no race conditions, at first sight. This is puzzling me... any clue?

  • Turned out to be my fault. I was calling the libpd setup methods in a wrong order. Now everything is working fine. :)>-

  • Glad to hear it's working. And yes, the fact that appropriate external binaries are now copied to /data/data/package.name/lib at install time is one of the great advantages of the new version of libpd.

  • Apologies if this is a completely stupid question, but when using externals with the new version of libpd, you still need to install the NDK, right?

  • To clarify the above - when compiling externals using an Android.mk file...

  • That's right.

  • Ok, I've followed almost the exact same steps as Nitrooo - and I'm getting a very similar problem... freeverb registering but not working, and then working when the app is run for a second time after install. Nitrooo, could you how you fixed the problem with regards to libpd setup?

    Here is the code of my project if anyone would have a look I would greatly appreciate it.

    https://github.com/Kapsy/FreeVerbTest1

    I got your book Peter in hopes of a solution, but now externals are handled differently I couldn't really figure out what I'm doing wrong... but so far looks like there's alot of useful info in there - thankyou!

  • Try moving your .openPatch calls after the .initAudio call.

  • Working! Thanks Nitrooo. I've committed the changes to the above GitHub in case anyone has the same issue and wants to have a look :)

  • I am using libpd under Windows, and would like to use an external for which source code does not seem to be available. Would it be possible to dynamically link to the dll, and if so, how?

    Thanks very much.