# 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:

[loadbang]
|
|
[soundfiler]


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

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


and at one central point in your patch you can have

[catch~]
|
[dac~]


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