How to play AudioClip in edit mode?

I want to play an audio clip in edit mode, but I'm not having any luck. I'm creating a custom inspector that works with audio files and I'd like to be able to preview the sounds in the editor.

Here's what I've tried so far. It doesn't work, but I wouldn't expect it to really since I imagine the audio listener is only working in play mode.

var cam : GameObject = GameObject.Find("GUICamera");
var clip : AudioClip = AssetDatabase.LoadAssetAtPath("Assets/Page01/Audio/FullAudio.wav", typeof(AudioClip)) as AudioClip;

var go = new GameObject("PLAY_AUDIO_TEMP");
go.transform.position = cam.transform.position;

var source : AudioSource = go.AddComponent(AudioSource) as AudioSource;
source.clip = clip;
source.volume = 1.0;
source.Play();

Are there any other scripting tools for working with audio in the editor that I've overlooked?

For playing sound in EditMode you could just create an EditorWindow or a CustomEditor. Then you also don’t have a problem with generating any additional GameObject just for holding the AudioSource.

For loading an AudioClip inside an Editor script, you have to execute this line:

(AudioClip) EditorGUIUtility.Load("Assets/AnotherDirectory/" + audioClipName + ".wav");

For playing or stopping the sound use following methods method:

public static void PlayClip(AudioClip clip) {
	Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
	Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
	MethodInfo method = audioUtilClass.GetMethod(
		"PlayClip",
		BindingFlags.Static | BindingFlags.Public,
		null,
		new System.Type[] {
		typeof(AudioClip)
	},
	null
	);
	method.Invoke(
		null,
		new object[] {
		clip
	}
	);
}

public static void StopAllClips() {
	Assembly unityEditorAssembly = typeof(AudioImporter).Assembly;
	Type audioUtilClass = unityEditorAssembly.GetType("UnityEditor.AudioUtil");
	MethodInfo method = audioUtilClass.GetMethod(
		"StopAllClips",
		BindingFlags.Static | BindingFlags.Public,
		null,
		new System.Type[]{},
		null
	);
	method.Invoke(
		null,
		new object[] {}
	);
}

Have fun!

The audio preview mode must be on in order for sound to play in the editor.

Inside the scene view, near the top, in the left/right corner, there is a little speaker icon. Click that, and your audio should work.

NOTE: The audio preview mode is only available in Unity 3.0

Unity 5.0 Mac AudioSource.Play doesn’t produce sound. Edit mode, Editor scripts. I’ve Listener on camera enabled. AudioSource GO is in reach.
Scene view toggle button is “on”. (btw AudioSound.PlayOneShoot works). I can see in Console that AudioSource.time increase…But no sound can be heard. When I recompile I can hear small glich sound. Like something start to play but not get updated. AudioSettings.dspTime is running.Why is not updated?
Anyone help please I’m out of hair soon.

I have a lot of sound assets and previewing them is a pain. Is there a way to automatically play an asset when I click on it mcdvoice?