WAV utility for recording and audio playback functions in Unity.
More...
|
static AudioClip | ToAudioClip (string filePath, string name="wav") |
| Load PCM format *.wav audio file and convert to AudioClip. More...
|
|
static AudioClip | ToAudioClip (System.IO.Stream stream, string name="wav") |
| Load PCM format *.wav audio stream and convert to AudioClip. More...
|
|
static AudioClip | ToAudioClip (byte[] fileBytes, string name="wav") |
| Load PCM format byte-array and convert to AudioClip. More...
|
|
static byte[] | FromAudioClip (AudioClip audioClip) |
| Convert an AudioClip to a byte-array. More...
|
|
static byte[] | FromAudioClip (AudioClip audioClip, string filepath, bool saveAsFile=true) |
| Convert an AudioClip to a byte-array and save it to a file. More...
|
|
static ushort | BitDepth (AudioClip audioClip) |
| Calculates the bit depth of an AudioClip. More...
|
|
WAV utility for recording and audio playback functions in Unity.
- Use "ToAudioClip" method for loading wav file / bytes. Loads .wav (PCM uncompressed) files at 8,16,24 and 32 bits and converts data to Unity's AudioClip.
- Use "FromAudioClip" method for saving wav file / bytes. Converts an AudioClip's float data into wav byte array at 16 bit.
Partially based on: https://github.com/deadlyfingers/UnityWav
◆ BitDepth()
static ushort Crosstales.Common.Audio.WavMaster.BitDepth |
( |
AudioClip |
audioClip | ) |
|
|
static |
Calculates the bit depth of an AudioClip.
- Parameters
-
- Returns
- The bit depth. Should be 8 or 16 or 32 bit.
◆ FromAudioClip() [1/2]
static byte [] Crosstales.Common.Audio.WavMaster.FromAudioClip |
( |
AudioClip |
audioClip | ) |
|
|
static |
Convert an AudioClip to a byte-array.
- Parameters
-
audioClip | AudioClip to convert |
- Returns
- AudioClip as byte-array.
◆ FromAudioClip() [2/2]
static byte [] Crosstales.Common.Audio.WavMaster.FromAudioClip |
( |
AudioClip |
audioClip, |
|
|
string |
filepath, |
|
|
bool |
saveAsFile = true |
|
) |
| |
|
static |
Convert an AudioClip to a byte-array and save it to a file.
- Parameters
-
audioClip | AudioClip to save |
filepath | File path |
saveAsFile | Save the file (optional, default: true) |
- Returns
- AudioClip as byte-array.
◆ ToAudioClip() [1/3]
static AudioClip Crosstales.Common.Audio.WavMaster.ToAudioClip |
( |
byte[] |
fileBytes, |
|
|
string |
name = "wav" |
|
) |
| |
|
static |
Load PCM format byte-array and convert to AudioClip.
- Parameters
-
fileBytes | Byte array with the PCM data |
name | Name of the AudioClip (optional, default: wav) |
- Returns
- AudioClip from the byte-array.
◆ ToAudioClip() [2/3]
static AudioClip Crosstales.Common.Audio.WavMaster.ToAudioClip |
( |
string |
filePath, |
|
|
string |
name = "wav" |
|
) |
| |
|
static |
Load PCM format *.wav audio file and convert to AudioClip.
- Parameters
-
filePath | Local file path to .wav file |
name | Name of the AudioClip (optional, default: wav) |
- Returns
- AudioClip from the byte-array.
◆ ToAudioClip() [3/3]
static AudioClip Crosstales.Common.Audio.WavMaster.ToAudioClip |
( |
System.IO.Stream |
stream, |
|
|
string |
name = "wav" |
|
) |
| |
|
static |
Load PCM format *.wav audio stream and convert to AudioClip.
- Parameters
-
stream | Local file path to .wav file |
name | Name of the AudioClip (optional, default: wav) |
- Returns
- AudioClip from the byte-array.
The documentation for this class was generated from the following file:
- C:/Users/slaub/Unity/assets/DJPro/DJPro/Assets/Plugins/crosstales/Common/Extras/Audio/Scripts/WavMaster.cs