Play next song

public class Music : MonoBehaviour {

Object[] pMusic; 

void Awake () {
	pMusic = Resources.LoadAll("Music",typeof(AudioClip));
	GetComponent<AudioSource>().clip = pMusic[0] as AudioClip;
}

void Start (){
	GetComponent<AudioSource>().Play(); 
}

Im sure this is a simple question but how do write a script for playing the next song in the directory.

I have not tested this code.

AudioClip[] pMusic; 
int currentTrack;
int totalTracks;
AudioSource source;
 
void Awake()
{
     pMusic =(AudioClip[])Resources
        .LoadAll("Music", typeof(AudioClip));
     source = GetComponent<AudioSource>();
     totalTracks = pMusic.Length;
}
 
void Start()
{
   if(totalTracks > 0)
      SwitchTrack();
}
 
void Update()
{
   if(Input.GetKeyDown(KeyCode.Space))
      SwitchTrack();
}

void SwitchTrack()
{
   if(source.isPlaying)
      source.Stop();
   
   if(currentTrack >= totalTracks)
      currentTrack = 0;

   source.clip = pMusic[currentTrack++];
   source.Play();
}