Sprinting Audio Problem

Hey, I would like to ask how to add a sprinting sound to my game. I already have a system that allows me to play footsteps but I want to know how to make these sounds play at a faster rate while running?

This is my footstep Script:

var walkSounds : AudioClip[]; // fill this array with the sounds at the Inspector

var audioStepLength = 0.3;



function Start(){

    var controller : CharacterController = GetComponent(CharacterController);

    while (true) {

        if (controller.isGrounded && controller.velocity.magnitude > 0.4) {

            audio.clip = walkSounds[Random.Range(0, walkSounds.length)];

            audio.Play();

            yield WaitForSeconds(audioStepLength);

        } else {

            yield;

        }

    }

}

EDIT

Ok, I have been suggested the following script - how do I combine them?
Im spatially ‘slow’ when it comes to scripting

SUGGESTED SCRIPT

var walk:AudioClip;
var run:AudioClip;

if(walk){
  audio.clip=walk;
  audio.Play();
}else if(run){
  audio.clip=run;
  audio.Play();
}

Modifying the pitch of the audio source result in a faster tempo but also a higher pitch.

In your case, I would recommend using Audacity (free), you can easily (really easily) fast up the speed of a file and lower its pitch to make it sound ok. It tkes about a couple of trials and 5min.

Then import your new sound as usual and:

var walk:AudioClip;
var run:AudioClip;

if(Input.GetKey(KeyCode.R) && Input.GetKey(KeyCode.Akey)){
  Run();
  audio.clip=run;
  audio.Play();
}elseif(Input.GetKey(KeyCode.Akey)){
  Walk();
  audio.clip=walk;
  audio.Play();{
}else
  audio.Pause();

You could use this simple principle. Make sure the playing is looped. The runing is based on how your guy moved plus pressing r (r is checked first to save cycle). If r is not pressed, then maybe the movement is on but you are walking. Then is nothing then you are not walking the stepping stops. The complicated part compared to way 2 is that you need to manually tweak the animation speed to make the sound and steps match. Immersion would not like if you hear a step while the foot is up.

EDIT:Way2

You can use animation event easily.

The curve of your right and left foot should look like a sin wave (going up and down).
Create a single step sound (just “pac”;, no “pac-pac-pac”).Add an event when the green curve of the feet animations are at the lowest and add this:

var step:AudioClip;

function StepSound(){
AudioSource.PlayClipAtPoint(step,transform.position);
}

Attach this to the right and left feet.
Then follow the tutorial in the link http://docs.unity3d.com/Documentation/Components/animeditor-AnimationEvents.html

Do the same process for the running. The curves have a higher frequency, your running sound happens more often. You are running.