Sound.envelope

From MiniScript Wiki
Revision as of 03:58, 28 April 2020 by SpatialPlays (talk | contribs) (Added Sound.evelope and example script (without using init))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sound.envelope controls the volume over the duration of the sound.

Examples

This script creates a strange sci-fi sound effect that gradually changes volume over time.

scifi = new Sound
duration = 5
freqList = [ noteFreq(72), noteFreq(72), noteFreq(72), noteFreq(84), noteFreq(84), noteFreq(84), noteFreq(80), noteFreq(80), noteFreq(80), noteFreq(80), noteFreq(79), noteFreq(79), noteFreq(77) ]
envelopeList = [ 0.0, 0.5, 0.25, 0.75, 1.0, 0.8, 0.75, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2 ]

scifi.init duration, freqList, null, Sound.sineWave

scifi.envelope = envelopeList

scifi.play