Load an Audio File
Now let’s load an actual audio wave file. It’s important that pure data knows the size of the file and the maximum length a grain should have. The horizontal slider has values between 0 and 1 and making all the values relative to the selected file size and maximum grain length.
Select starting and ending point on the file / Modifying the envelope
To select a starting and ending point of the grain a good way is to use the line~ object that allow to read from any index to any index of the audio file. In the following figure the starting index is selected on the left side, the length in the middle and the playback time on the right side of the patch. By hitting bang on top you can play it. The f object is suppressing the bang because the order of bangs is very important for the line~ object. First comes the starting index directly, second the duration and third to play the file.
On the right part of the following patch the envelope is integrated. It receives the time length from the number box that sets the grain duration time.