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
help - seeking advice from those who know pdlib
  • Hello !

    I am not very experienced in PD / pdlib neither am I in Android development, I'm just a coder who's OK in the Java programming language. I intend to build an Android app using libpd for one of the app's features - a screen with a piano-roll type of sequencer that plays the notes using a simple sine wave.

    I don't come to ask for elaborate solutions but for some light ahead of my path - what kind of development roadmap do I have ahead? How should I implement my idea?

    The idea is simple:

    1 - a sequencer like in this picture: http://tangram.dnsalias.net/lmms/0.3.1/tutorial-1stsong/variation-2.png

    2 - the sequencer plays a single Sine wave

    3 - to have the ability to change the synth's ADSR parameters at any time

    4 - if I click the piano keys on the left I hear the note's sound

    5 - to be able to export the composition to MIDI


    As you can see, the synth requirement is extremely basic. Creating a simple sine wave synth in PD with editable ADSR is something I already know how to do!

    But to make it work with such sequencer, I have no idea. What will I need from PD /pdlib and how should I integrate it with a UI ? Can the sequencer logic be made in PD?


    Should I:

    • create a pd patch that's a simple Sinusoid synth with adjustable ADSR parameters

    • create another PD patch that's a sequencer, that would work with the previous patch to emit sounds?

    • make a patch that's the combination of both above ?

    • should I use PD just for the sound synthesis and use just java code for the sequencing ? Would this be even reliable ?

    • does MIDI need to have any role in this? I only want to export MIDI files with the composition, nothing more.


    Thanks for reading this far! Again, I'm just asking for advice on the kind of development roadmap I have ahead, so any tiny tip that guides me will be greatly appreciated!

    Thank you

  • berengerberenger
    Accepted Answer

    What I chose to do (as I am working on a sequencer) is to create a clock in pd and send back the value of the step to the client code, according to the position we are at the client code sends orders to play notes. I'm not sure it's the right one, because I noticed that the tempo wasn't kept very precisely, but I'm not sure where it's coming from atm (it is certainly a mistake I made on my own :) )

    For the midi format it's a whole other issue. Pd doesn't have a vanilla object to read and write midi files, that means that you'll have to use an external to do this. If you now how to do this in java in your client code, you should keep your sequencer in java, and write your midi files in java.

    But that's only my opinion, maybe someone as a better solution.

    cheers

  • sporsmaal.teglegsporsmaal.tegleg
    Accepted Answer

    when i did this i did everything in pd, that way the timing stays fairly accurate. then just send values to the sequencer and such from java. i did it the other way round at first like berenger, but the delay between the java, native and the pd patch sent the tempo all over the place and made it unuseable.

  • Thanks for the replies guys! You guys suggest a different development path each and I'm wondering through which I'm going to.

    Thus the question arises:

    • Shall I store the composition only in the Java client, listen to [metro] events in Java and upon receiving them, tell PD to play notes when applicable. (I suppose as berenger said?)

    That's a pd -> java -> pd communication just to play notes (doesn't seem so reliable but I might try it if I don't find another way)

    • Or shall I send, somehow, the composition to PD, so when the Java client instructs the [metro] to run, PD will comfortably run and play the composition stored within itself? While the Java client, upon receiving the [metro] events, just updates the GUI ? (I suppose as sporsmaal.tegleg said ?)

    That's a pd -> pd communication to play notes, (which seems way more reliable)


    The requirement for a proper sequencer is to play at least a 1-track Polyphonic composition, with individual velocity values - like a single MIDI track.

    The arrays / tables seem to be far too limited to house a complete polyphonic composition with individual velocity values - if there was anything like multi-dimensional arrays it would be great.

    So the final question is, how to store a polyphonic composition in PD vanilla? Is this even possible ?

  • i have monophonic sequencers in pd but store the notes for different patterns in java. when a particular pattern is selected by the user the array is sent from java to the pd sequencer. the only thing coming back from pd to java is the 'song position' to update the gui. hope that helps