- Home /
AudioClip.Create fade in and out
Hello,
The documentation refers that this example script (http://docs.unity3d.com/Documentation/ScriptReference/AudioClip.Create.html) plays this tone for one second, but where can I configure it? I believe that has something to do with data[]. Do I have to populate data[] with something to get more than one second - with SetData()?
Besides I want to play the tone with fade in and fade out. Where exactly can I write de volume code? On OnAudioRead?
I'm sorry if the questions seem basic, but I'm coming from Blender's Audaspace and that API has builtin functions for all of this.
Thanks.
Answer by joaomesq · Jun 29, 2013 at 10:40 PM
Hello,
I figured out how you set duration. You set it by multiplying the lenghtSamples by the number of desired seconds.
As for fade in and out, changing the audio source volume returns stack overflow, so probably the entire sine wave has to be constrained to an envelope. Still trying to figure that out.