Difference between revisions of "Sound.envelope"

From MiniScript Wiki
Jump to navigation Jump to search
(Added Sound.evelope and example script (without using init))
 
(Adds a link to the audio generated by the example script)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<c>[[Sound]].envelope</c> controls the volume over the duration of the sound.
+
<c>[[Sound]].envelope</c> controls the volume over the duration of the sound. It can be set a value or list of values between 0 and 1, 0 being silent and 1 being the maximum volume possible.
  
 
== Examples ==
 
== Examples ==
This script creates a strange sci-fi sound effect that gradually changes volume over time.
+
This script creates a strange sci-fi sound effect that gradually changes volume over time:
 +
[https://commons.wikimedia.org/wiki/File:Mini_Micro_-_Scifi.ogg Link to Audio Generated]
 
<ms>scifi = new Sound
 
<ms>scifi = new Sound
 
duration = 5
 
duration = 5
Line 13: Line 14:
  
 
scifi.play</ms>
 
scifi.play</ms>
 +
 +
See also: <c>[[Sound.init]]</c>
 +
 +
[[Category:Mini Micro]]

Latest revision as of 07:04, 28 April 2020

Sound.envelope controls the volume over the duration of the sound. It can be set a value or list of values between 0 and 1, 0 being silent and 1 being the maximum volume possible.

Examples

This script creates a strange sci-fi sound effect that gradually changes volume over time: Link to Audio Generated

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

See also: Sound.init