# AudioType

> The format type of the imported (native) data.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public enum AudioType
```

## Remarks

Use this enumeration to specify the format type of the audio file you want to play. This is mostly useful if you stream your audio from a server with [UnityWebRequestMultimedia.GetAudioClip](/engine/6000.7/script-reference/unityengine/networking/unitywebrequestmultimedia/getaudioclip.md). For example, if you want to stream a file with the .ogg file extension, use [AudioType.OGGVORBIS](/engine/6000.7/script-reference/unityengine/audiotype/oggvorbis.md).

`UnityWebRequestMultimedia.GetAudioClip(www.your-website.com/your-file.ogg, AudioType.OGGVORBIS)); `.

The format types in this enumeration are the types Unity supports natively. For other or unknown format types, use [AudioType.UNKNOWN](/engine/6000.7/script-reference/unityengine/audiotype/unknown.md), but note that Unity might not support them. If you use the wrong format, the audio might not play correctly and Unity might throw an error.

Additional Resources: [UnityWebRequestMultimedia](/engine/6000.7/script-reference/unityengine/networking/unitywebrequestmultimedia.md), [DownloadHandlerAudioClip.GetContent](/engine/6000.7/script-reference/unityengine/networking/downloadhandleraudioclip/getcontent.md).

## Examples

```csharp
// This script streams an MP3 audio file from the web. 
// First you have to change the url to a valid link to an MP3 audio file. 
// Attach this script to a GameObject. 


using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class MyBehaviour : MonoBehaviour
{
    public AudioType audioType;
    AudioSource audioSource;

    void Start()
    {
        // Add an AudioSource to your GameObject. 
        audioSource = gameObject.AddComponent<AudioSource>();
        StartCoroutine(GetAudioClip());
    }

    IEnumerator GetAudioClip()
    {
        // Replace the string with where you host your audio file. 
        string url = "https://www.your-website.com/mp3sound.mp3";

        // Stream audio, store it as an audio clip and play it. Make sure the file has an MPEG audio format. 
        using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG))
        {
            yield return www.SendWebRequest();

            if (www.result == UnityWebRequest.Result.ConnectionError)
            {
                Debug.Log(www.error);
            }
            else
            {
                AudioClip myClip = DownloadHandlerAudioClip.GetContent(www);

                audioSource.clip = myClip;  
                audioSource.Play(); 
            }
        }
    }
}
```

## Fields

| Value                                                                             | Description                                                                                                                                  |
| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [ACC](/engine/6000.7/script-reference/unityengine/audiotype/acc.md)               | The audio file you want to stream has the Advanced Audio Coding (AAC) digital audio file format. Unity doesn’t natively support this format. |
| [AIFF](/engine/6000.7/script-reference/unityengine/audiotype/aiff.md)             | The audio file you want to stream has the Audio Interchange File Format (AIFF) audio file format. Unity doesn’t support this format.         |
| [AUDIOQUEUE](/engine/6000.7/script-reference/unityengine/audiotype/audioqueue.md) | The audio file you want to stream uses Apple’s Audio Queue file format.                                                                      |
| [IT](/engine/6000.7/script-reference/unityengine/audiotype/it.md)                 | The audio file you want to stream has the Impulse Tracker (IT) audio file format.                                                            |
| [MOD](/engine/6000.7/script-reference/unityengine/audiotype/mod.md)               | The audio file you want to stream has the Protracker / Fasttracker MOD audio file format.                                                    |
| [MPEG](/engine/6000.7/script-reference/unityengine/audiotype/mpeg.md)             | The audio file you want to stream has the MPEG (MP2 or MP3) audio file format.                                                               |
| [OGGVORBIS](/engine/6000.7/script-reference/unityengine/audiotype/oggvorbis.md)   | The audio file you want to stream has the Ogg Vorbis audio file format.                                                                      |
| [S3M](/engine/6000.7/script-reference/unityengine/audiotype/s3m.md)               | The audio file you want to stream has the  ScreamTracker 3 audio file format.                                                                |
| [UNKNOWN](/engine/6000.7/script-reference/unityengine/audiotype/unknown.md)       | The audio file you want to stream has a file format that is unknown to Unity.                                                                |
| [VAG](/engine/6000.7/script-reference/unityengine/audiotype/vag.md)               | The audio file you want to stream has the VAG audio file format for PlayStation.                                                             |
| [WAV](/engine/6000.7/script-reference/unityengine/audiotype/wav.md)               | The audio file you want to stream has the Microsoft WAV audio file format.                                                                   |
| [XM](/engine/6000.7/script-reference/unityengine/audiotype/xm.md)                 | The audio file you want to stream has the FastTracker 2 XM audio file format.                                                                |
| [XMA](/engine/6000.7/script-reference/unityengine/audiotype/xma.md)               | The audio file you want to stream has the XBOX 360 XMA audio file format.                                                                    |
