To register and login, use your Google, Twitter, Facebook, LinkedIn, or OpenID credentials.

This is allowing us to stop most spam registrations. We've deleted most of the spam accounts that got through, and we're closely watching for more.

libpd + processing + samplePlayer ...?

SpiroZSpiroZ Posts: 16
edited November 2012 in Pd Everywhere

Hi forum,
Is it possible to play a sample via some sort of sampleplayer?
I 've been trying to make one in processing and used [soundfiler] but didn't work, and then tried [s_looper] of rjdj. I' ve even added it in the given example (xyPad) but even then it didn't work out, although it plays just fine from inside pd_vanilla.
And a second simplier question : in the sendMessage(String recv, String mesg, Object...args) method, What are the args?
Sorry but there is little documentation as far as it concerns processing.


  • briomusicbriomusic Posts: 10

    If it is anything like in pd-for-ios then args is an array of the following items in the message. so "read sound.wav table1" would have String mesg. "read" and the Object args "sound.wav" and "table1" (those latter two inside an array). String recv would be whatever name you assigned to your receiver in PureData.

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    The Processing branch is still very preliminary and probably won't be documented until the implementation has stabilized. The good news, however, is that the methods in the Processing branch largely mirror those of, so you can look at the Java documentation to get an idea how to use them.

    As far as sendMessage is concerned, the parameters can be integers, floats, or strings.

    About building a sample player, that should work just fine with libpd. If it doesn't work, then that's probably due to a path problem. How do you package your samples and patches?

  • SpiroZSpiroZ Posts: 16

    Well. In the pd patch i want to have 2 sampleplayers. So there are two [s_looper]'s :

    [s_looper $0-mysample loop1.wav] & [s_looper $0-mysample loop2.wav].
    Both are connected to [dac~]. Now i want its one to take message to start from the processing code, so its one has a [r loop] object connected to its inlet.
    So its sth like:

    [r loop]

    [s_looper $0-mysample loop1.wav]


    Now i want to send [play( , [stop( , [loop 0( & [loop 1( messages form processing. and i can't figure out how.

    In some codes other than processing the syntax is pdBase.sendMessage(...);
    In processing we use the PureDataP5Jack class that extends PureDataP5Base, but there is also a class named PureData that for some reason PureDataP5Jack uses its methods.
    So, if I make :

    PureDataP5Jack pd = new PureDataP5Jack(this, 2, 2, "system", "system");
    and while in the code i send floats and bangs easily, via
    pd.sendFloat("receiver", value); & pd.sendBang("reciever"); that these are PureData Class'es methods, i can 't figure out how to send messages.
    And also messages play; and stop, have no value arguments..

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    First, please switch to the latest version of puredatap5:

    About sending messages, there are various ways to accomplish what you want to do. One way is to have messages like [play( and [loop 0( in your patch and to trigger them with a bang from Processing. Another solution is to use something like pd.sendMessage("receiver", "play") or pd.sendMessage("receiver", "loop", 0).

    About your loopers, are you sure that they can find the wav files? Do you see any log messages in Processing?

  • SpiroZSpiroZ Posts: 16

    they must have been found . The pd patch runs fine with pure data , and also there is no message from processing, although by now the only message regarding pdlib i take is the invalid access memory e 0x0e8479mplamplampla or sothing like that that the only thing i know is that this is java not finding in memory something (the 0x0 part). Anyway i don't get even that just to know sth is wrong in my patch.
    And I know i am not very good in this kind of discussions but the most common error that returns me the above message is solved by deleting tge second inlets~ from my pd patches. pdlib don't support 2 inlets~ in a subpatch? It looks strange to me...
    Anyway, i ll switch to latest version and report.
    Thanx a lot..

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    As a quick reality check, you can temporarily remove your wav files and see whether you see any error messages in Processing. Just because your patch works in Pd doesn't mean that you've correctly packaged it for libpd/Processing. Packaging Pd resources for use with libpd is one of the trickier bits to get right.

  • SpiroZSpiroZ Posts: 16

    How i can see if i have the latest version already? when i first installed libpd it was 2 months ago, with instructions found at and changed something, downloaded with GitHub, but now something seams to go wrong and i can't reinstall it, so just to check my version, maybe its the latest version..

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    Just do the usual update steps, i.e., "git pull" and "git submodule update".

  • SpiroZSpiroZ Posts: 16

    Have updated everything, trying again to make a samplePlayer either by using rj abstructions or with the classic soundfiler way, both ways i came up to this: When playing one sample, everything is fine. With two playing simultaneously, i get some clipping, with more i just don't get sound even though i know is working because i get some feedback, and there is no cpu overcharge (just staying in usual levels) and ofcourse pd abstruction works fine with all (8) the samples playing in pd vanilla.
    Any suggestion?

  • pbrinkmannpbrinkmann Posts: 686 ✭✭

    Try scaling down your output (just before dac~) by a factor of 10 or so. My guess is that the sum of your samples is outside the range from -1 to 1. On your computer, this is fairly benign, but on Android it'll cause artifacts because the samples are converted to 16-bit integers that are truncated on overflow.

  • SpiroZSpiroZ Posts: 16

    Everythings fine working just with soundfiler and controlling wav.'s with soundtouch~.
    Finally the problem was signal multiply in a [*~ ] that when a sample changed was multiplied with the last price of the previous (garbage). A multiplex~ solve that fine.
    Thanx for the support!

Sign In or Register to comment.