Class AudioUtils
Utility class that contains methods for audio related operations
Inherited Members
Namespace: Doozy.Runtime.Soundy
Assembly: cs.temp.dll.dll
Syntax
public static class AudioUtils
Methods
DecibelToLinear(Single)
Converts decibels to linear (returns a value between 0f and 1f). Check http://www.sengpielaudio.com/calculator-FactorRatioLevelDecibel.htm for details
Declaration
public static float DecibelToLinear(float dB)
Parameters
Type | Name | Description |
---|---|---|
Single | dB | Decibel value (should be between -80f and 0f) |
Returns
Type | Description |
---|---|
Single |
GetAudioClipDurationPretty(AudioClip)
Gets the duration of an audio clip as a string in the format: HH:MM:SS
Declaration
public static string GetAudioClipDurationPretty(AudioClip audioClip)
Parameters
Type | Name | Description |
---|---|---|
AudioClip | audioClip | Target audio clip |
Returns
Type | Description |
---|---|
String | Audio clip duration as a string in the format: HH:MM:SS |
GetTimePretty(Single, Boolean)
Gets the time as a string in the format: HH:MM:SS If the time is negative, it returns "--:--"
Declaration
public static string GetTimePretty(float time, bool includeMilliseconds = false)
Parameters
Type | Name | Description |
---|---|---|
Single | time | Target time |
Boolean | includeMilliseconds | Should the milliseconds be included in the result |
Returns
Type | Description |
---|---|
String | Time as a string in the format: HH:MM:SS |
LinearToDecibel(Single)
Converts linear to decibels (returns a value between -80f and 0f). Check http://www.sengpielaudio.com/calculator-FactorRatioLevelDecibel.htm for details
Declaration
public static float LinearToDecibel(float linear)
Parameters
Type | Name | Description |
---|---|---|
Single | linear | Linear value (should be between 0 and 1) |
Returns
Type | Description |
---|---|
Single |
PitchToSemitones(Single)
Converts a pitch value to a semitone value
Declaration
public static float PitchToSemitones(float pitch)
Parameters
Type | Name | Description |
---|---|---|
Single | pitch | Pitch value |
Returns
Type | Description |
---|---|
Single |
SemitonesToPitch(Single)
Converts semitones value to a pitch value (returns a value between 0f and 4f)
Declaration
public static float SemitonesToPitch(float semitones)
Parameters
Type | Name | Description |
---|---|---|
Single | semitones | Semitone value |
Returns
Type | Description |
---|---|
Single |