Viewed 382 times

I'm working on a patch that plays samples from a piano, which works in xcode to build an piano app for ipad. I'm trying to add an adsr to create sustain, but I can't seem to get it working. Could someone point me in the right direction? Thanks!


1 answers given for "Sustain in Pure Data for libpd with xcode"

The ADSR is just an evelope which you are using to multiply the sound output with. However it is meant to be on a temporal axis together with the trigger of the sound. When I look at your patch I notice another thing: Why are you reloading the samples into the arrays every time you trigger them? The arrays should be filled on startup of the app, like this:

[read -resize c1.wav c1Array(

Later, when you actually just want to play back, you do

[r c1]
[t b]
[tabplay~ c1Array]

and at one central point in your patch you can have


(add the main voulme there). Notice there are no connections between the three parts!