Pd Everywhere

Public Group

active 1 day, 22 hours ago

Use the music + media patching tool Pure Data (Pd) to get creative anywhere. Starting with Android, but soon on other platforms (iOS, Processing, OpenFrameworks, Python, Java), libpd is an embeddable version of Pd that lets you run your patches inside other software and on various devices. From Pd patches on phones to creative audiovisual tools, check out what’s possible.

This group is for programmers and users alike, so we can discuss both the development aspects of these tools and also how to use them as musicians and artists.

Get it: http://github.com/libpd

Developer Peter Brinkmann’s blog: http://nettoyeur.noisepages.com/

Group Admins

  • Avatar Image

← Group Forum   Group Forum Directory

Self-remixing album made with PdDroidParty 21 posts

  • Avatar Image Jean
    4 months, 3 weeks ago

    This is partly a shameless self-plug, but also a genuine expression of gratitude for Peter Brinkmann’s work on libpd and Chris McCormick’s on PdDroidParty.

    In the last two months or so, I’ve gone from having basically no prior programming experience to creating a self-remixing album in Pd and making it available as a stand-alone app in the Android Market.  
    The album/app is called What Comes Around, and the free version is available here https://market.android.com/details?id=ms.stonebell.WhatComesAroundFree

    My Pd project is probably not very interesting (basically a loop player with some DJ tricks thrown in), but I thought you’d like to know that It’s possible for a complete novice to make use of the libpd code via PdDroidParty.

    It wasn’t exaclty a smooth ride, but I’ve left details of the steps I followed here http://puredata.hurleur.com/sujet-6140-2.html (towards the end of the page).

  • Avatar Image Peter Brinkmann
    4 months, 3 weeks ago

    You’re very welcome! It always makes my day when I hear about a cool new app based on libpd.

    I tried your app, and it crashes on my Galaxy Nexus running Android 4.0.2. I haven’t had a chance to look into this, but maybe it’s the same problem with Android 4 that I fixed the other day. I recommend that you get the latest versions of libpd and pd-for-android from GitHub and rebuild your app. Good luck!

  • Avatar Image Jean
    4 months, 3 weeks ago

    Yikes! Thanks for the heads-up Peter. I’ll follow your advice and rebuild.

  • Avatar Image Peter Brinkmann
    4 months, 3 weeks ago

    Another data point: I just tried it on a Droid X running Android 2.3.3 and it works fine.

  • Avatar Image Peter Brinkmann
    4 months, 3 weeks ago

    Yup, it’s the same floating point exception that crashed the ScenePlayer after I switched to Android 4.0.2. Upgrading libpd to the latest version from GitHub will fix it.

  • Avatar Image Jean
    4 months, 3 weeks ago

    Thanks so much for checking Peter, I’ll re-upload updated apk’s later today. A quick question while we’re speaking – one behavior I’d dearly like to fix is that my music cuts off as soon as the screen times out (hitting the home key before the screen times out prevents this). It’s possibly an issue with the current version of PdDroidParty, and I’ve made Chris aware of it. Your ScenePlayer works as expected, so I’ve been scouring your code, but simply don’t have the skills to make much sense of it. I’m pretty sure you’re not employing a WAKE-LOCK – is it a function of PdService running as a foreground service?

  • Avatar Image Chris McCormick
    4 months, 3 weeks ago

    Super cool, Jean! Glad you got it working.

    This reminds me that I need to update the documentation with info about font customisation. If you add a TTF font file to the patch directory called either ‘font.ttf’ or ‘font-antialiased.ttf’ then it will get used as the default font for all non-SVG widgets.

    Also, you can stop the words spilling out of the song name box by making the box a little wider.

    With regards to the sleep thing, I think I need to set that permission in the AndroidManifest.xml – is that correct, Peter?

    Awesome work though, I am digging the music!

    I will try to incorporate some of your notes about eclipse + Windows into the documentation.

  • Avatar Image Peter Brinkmann
    4 months, 3 weeks ago

    @Jean,
    Yes, the foreground service keeps the audio running even when the screen is turned off. When working with libpd, I prefer the foreground service approach to wake locks.

    @Chris,
    You’re right, you’ll see to request android.permission.WAKE_LOCK in the manifest if you want to use a wake lock.

  • Avatar Image Chris McCormick
    4 months, 3 weeks ago
  • Avatar Image Peter Brinkmann
    4 months, 3 weeks ago

    I’m a little concerned about that approach because it doesn’t exactly express what’s needed here. The way I understand it, we want to keep the audio thread going even if the user doesn’t interact with the device. FLAG_KEEP_SCREEN_ON will keep the screen at full brightness, and the audio will stay alive as an incidental side effect. If you just want to put your phone in your pocket and listen to music, then you probably want the screen off in order to increase the battery life. I really prefer the foreground service approach.

  • Avatar Image Chris McCormick
    4 months, 3 weeks ago

    Ok, I will try to implement the foreground service thing. I’ll take a look at how you have done that in ScenePlayer. Cheers!

  • Avatar Image Jean
    4 months, 3 weeks ago

    Chris, from what I could gather, it looked like there were two ways to call the PdService and that you had already used the version that’s supposed to call it as a foreground service. Not too sure why it’s not working then.

  • Avatar Image Peter Brinkmann
    4 months, 3 weeks ago

    That’s right, PdDroidParty already launches the Pd service with foreground privileges. Not sure why the audio thread doesn’t stay alive when the screen goes to sleep. Some unfortunate interaction with the full screen flag, perhaps?

  • Avatar Image Jean
    4 months, 3 weeks ago

    I’ve rebuilt both the free and paid versions of the app with the latest version of libpd and the updated apk’s are now available in the Android Market. Both are working in the Android 4.0.3 emulator now whereas they wouldn’t before. I’ve set my 4.0.3 emulator to the screen dimensions of the Galaxy Nexus and  it renders with a slight wedge-like glitch (visible in the Mic and Master channel strips.)
    @Peter,
    When you have time, could you please have a look whether this is a real issue on your device or an emulator artifact?
    @Chris,
    I’ve experimented with different .ttf’s, but haven’t yet found one that’s more legible than the default one at that font-size. I’ll keep looking ;^) 

  • Avatar Image Peter Brinkmann
    4 months, 3 weeks ago

    @Jean,
    Good news: No more crashes, and no artifacts either on my Galaxy Nexus.

    @Chris,
    About keeping the audio going when the screen goes to sleep, I suspect that your app quits when it has to surrender the screen to the lock. I see two solutions, either getting rid of the full screen flag, or adding FLAG_SHOW_WHEN_LOCKED.