Hmm, I remember JPCSP use

    sample = sample * (envelopeValue + 0x4000) >> 15;
I tested it just now, and it seems to work fine. So maybe this one is better?