Class UnityEngineExtensions
Inheritance
UnityEngineExtensions
Assembly: Glitch9.IO.dll
Syntax
public static class UnityEngineExtensions
Methods
|
Edit this page
View Source
FadeTo(AudioSource, float, float)
Declaration
public static IEnumerator FadeTo(this AudioSource audioSource, float targetVolume, float duration)
Parameters
| Type |
Name |
Description |
| AudioSource |
audioSource |
|
| float |
targetVolume |
|
| float |
duration |
|
Returns
|
Edit this page
View Source
ToAudioBuffer(AudioClip, SampleRate?)
Declaration
public static float[] ToAudioBuffer(this AudioClip clip, SampleRate? sampleRate = null)
Parameters
| Type |
Name |
Description |
| AudioClip |
clip |
|
| SampleRate? |
sampleRate |
|
Returns
|
Edit this page
View Source
ToAudioClip(AudioBuffer, string)
Declaration
public static AudioClip ToAudioClip(this AudioBuffer audioData, string name = "AudioClip")
Parameters
Returns
| Type |
Description |
| AudioClip |
|
|
Edit this page
View Source
Trim(AudioClip, float, float, string)
Declaration
public static AudioClip Trim(this AudioClip clip, float start, float end, string clipName = null)
Parameters
Returns
| Type |
Description |
| AudioClip |
|
|
Edit this page
View Source
TrimSilence(AudioClip, float, string)
Removes silence from the beginning and end of an audio clip based on a minimum amplitude threshold.
Declaration
public static AudioClip TrimSilence(this AudioClip clip, float threshold = 0.01, string clipName = null)
Parameters
| Type |
Name |
Description |
| AudioClip |
clip |
The source AudioClip to trim.
|
| float |
threshold |
The amplitude threshold below which audio is considered silence.
Recommended values:
- 0.001f: Very sensitive ??retains even the smallest sounds at the start/end.
- 0.005f ~ 0.01f: Normal ??good for general speech, TTS, or dialogue trimming.
- 0.02f ~ 0.05f: Aggressive ??trims aggressively, useful for noisy input or fast processing.
|
| string |
clipName |
|
Returns
| Type |
Description |
| AudioClip |
A new AudioClip with silence trimmed from the start and end.
|