Difference between revisions of "Sound.fadeOut"

From MiniScript Wiki
Jump to navigation Jump to search
(Adds Sound.fadeOut, examples of usage, as well as links to other relevant pages.)
 
m
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
<c>[[Sound]].fadeOut</c> controls how much sound should fade out at the end in seconds.
+
<c>[[Sound]].fadeOut</c> controls how much a sound should fade out at the end in seconds.  If no value is given, a value of 0.01 is used.
  
 
== Examples ==
 
== Examples ==
This script produces a comedic falling sound followed by a boom at the end.
+
This script produces a comedic falling sound followed by a boom at the end:
 +
[https://commons.wikimedia.org/wiki/File:Mini_Micro_-_Long_Fall.ogg Link to Generated Audio]
 
<ms>slide = new Sound
 
<ms>slide = new Sound
 
boom = new Sound
 
boom = new Sound

Latest revision as of 20:52, 1 August 2020

Sound.fadeOut controls how much a sound should fade out at the end in seconds. If no value is given, a value of 0.01 is used.

Examples

This script produces a comedic falling sound followed by a boom at the end: Link to Generated Audio

slide = new Sound
boom = new Sound

slideDuration = 5
boomDuration = 1

slideFreq = [ noteFreq(84), noteFreq(48) ]
boomFreq = 0.5

slide.init slideDuration, slideFreq, 1, Sound.sineWave
boom.init boomDuration, boomFreq, 1, Sound.noiseWave

slide.fadeOut = 4
boom.fadeOut = 1

slide.play

wait slideDuration

boom.play

See also: Sound.fadeIn; Sound.envelope