Get and play externial audio

Hello fellow Unity users, sorry about the “cluttered” question, but this is a little complicated (In my mind, that might be the problem), so bare with me. I am creating a “soundboard”, and you can add your own sounds to it. So far I, it checks if the necessary files (folder for audio clips) has been created, and creates it if it hasn’t. Once the files have been created, it gets the names of the audio files that are in it, and displays them on the screen. The main thing that I’m having trouble with (And, the main thing in general), is getting the audio into Unity, and playing it.

I think it could be achieved by creating variables at runtime, and assigning the audio clips to them, then assign that to an AudioSource. I have researched how to do this, but haven’t come across anything solid. I will post the code below that gets the audio files, and hopefully we can piece something together.

using System;
using System.IO;
using UnityEngine;
using System.Collections;
//Written By Gibson Bethke & Unity3D Community
public class Manager : MonoBehaviour {
	public GUIText GuiText;
	static public string path = "/Users/" + Environment.UserName + "/Desktop/Soundboard";
	static public string clipPath = path + "/AudioClips";

	void Start () {
		if(Directory.Exists(path) && Directory.Exists (clipPath)) {
			GrabAudio();
		}else{
			Debug.LogWarning("Directory Does Not Exist");
			Directory.CreateDirectory(path);
			Directory.CreateDirectory(clipPath);
    		print("Directory Successfully Created");
			GrabAudio ();
		}
	}

	void GrabAudio () {
		string[] clipList = Directory.GetFiles(clipPath, "*.wav");
		foreach (string f in clipList) {
			string fName = f.Substring(path.Length + 1);
			print(fName);
			GuiText.text += ("

" + fName);
}
}
}

Thanks for your support ∆ All help is appreciated

-Gibson

You should be able to use the WWW functions on local files.

http://unity3d.com/support/documentation/ScriptReference/WWW.GetAudioClip.html