Question re: envelope for score loops

If I have a score loop (here’s a simple ex.):

{ 16 CNT
i1 [0 + $CNT*1.5] .25 0.5 9.00
i1 + . . 9.02
i1 + . . 9.04
i1 + . . 9.07
i1 + . . 9.04
i1 + . . 9.02
}

which in this ex.repeats 16x, and would like to have an envelope control the entire loop such as fading in, holding and fading out, what would be the most practical way to achieve this?

Csound for Android

Solved.

FWIW, received this answer from Daive Seidel on Listserv forum: “Off the top of my head, you might make a separate instrument to handle the output (e.g. using global a-rate variables). Have the output instrument run for the entire time, and implement the envelope there.”

Worked fine.