sampling from audio file - envelope for preventing clipping?

Rachel 's icon

Hello

I'm looking for a way to avoid clipping when I sample clips (quite rapidly) from a sound file.
I've looked for solutions with play~ from a buffer, and with sfplay~ from sflist~
But it seems:
line~ only affects attack
adsr~ is for signals not audio (or is there a way of using it for an audio file?)

Ideally this envelop could follow the size of the sample (as is possible with adsr). However, at this stage I would be happy with anything in which I could create a fixed envelope - and make sure samples were at the same length.

Thanks in advance for your wisdom!

Holland Hopson's icon

See the 'list input' tab of the line~ help file for how to create multi-segment line~s.
adsr~ can work if you calculate the total duration of the sample vs the time taken by the attack, decay and release.
function is a good alternative, also. You can use the domain message to adjust the length of the envelope to your needs

Rachel 's icon

Thanks very much for these suggestions Holland!