Can sampleplayer have an amplitude envelope

Hi - I'm working on a sound based game that requires continuous, pitch controllable sound and using sampleplayer to do this via the rate control BUT it has no amplitude envelope capability (without doing something kludgey)
Could you add such a thing please :smiley:


Will channel:setVolumeMod() with sound.envelope work? I've been panning sampleplayers with channel:setPanMod() to good effect. The sound is added to a channel with addSource and then the channel can be controlled all kinds of ways beyond what the sample alone can do.

(I found some bugs that are being fixed—but they may apply only to synths? Anyway: find workarounds here in the meantime if needed.)

1 Like

A channel volume mod might do what you need, just note the bugs and workarounds Morgan posted above. Or would a sample-based synth work here? For changing the pitch I don't think there's any way to use playNote() without having it restart the sample (maybe it should continue without restart if you have the legato flag set and the note starts before the previous ends? also I need to add portamento..), but you could use an LFO with depth set to zero as a frequency modulator and change the value with setCenter().

1 Like

Thanks gang - I'll try these