Muiltiple Audio Sources Pitch

I have a small bullet time effect I want to apply on various occasions in the game. The problem is it is not affecting the pitch of the audio in the scene as well. So I am trying this:

Time.timeScale = 0.1;
    	var sources = FindObjectsOfType(AudioSource);
    		for (var source : AudioSource in sources){
    			source.audio.pitch = 0.1;
    			}

And of course nothing happens. Where should I look?

If you want to match the audio pitch to the current timeScale, attach this small script to any prefab or object containing an AudioSource - it copies timeScale to the local audio.pitch each Update:

function Update(){
  audio.pitch = Time.timeScale;   // update audio.pitch each frame
}

Ok I got it working as required but this is far from a good way to do so

var normal: boolean;
var slowing:boolean;
var getAll:boolean;
var entering:boolean;
static var pitchVal:float;
var sources:AudioSource[];

function Start () {
	normal = false;
	slowing=false;
	getAll = false;
	entering = false;
	pitchVal = 1;
}

function Update () {
	if(Input.GetKeyDown(KeyCode.M)){
		Debug.Log("Slowing");
		slowing = !slowing;
		getAll =!getAll;
		entering = !entering;
	}
	if(Input.GetKeyDown(KeyCode.N)){
		Debug.Log("Slowing");
		normal = !normal;
		getAll =!getAll;
	}
	if(entering){
		if(slowing){			
				if(getAll){
					sources = FindObjectsOfType(AudioSource) as AudioSource[];
					getAll=!getAll;
					}
				if(pitchVal>0.1){
					pitchVal -= Time.deltaTime*0.5;
					if(pitchVal<0.1)
						slowing= !slowing;
				}
				
				for (var source : AudioSource in sources)
		             source.audio.pitch = pitchVal;
			}
			else if(normal){	
				if(getAll){
					sources = FindObjectsOfType(AudioSource) as AudioSource[];
					getAll =!getAll;
				}
				if(pitchVal<1){
					pitchVal += Time.deltaTime*0.5;
					if(pitchVal>=1){
						normal = !normal;
						entering = !entering;
				} 
				for (var source : AudioSource in sources)
		             source.audio.pitch = pitchVal;  
			} 
     	}
     	sources = FindObjectsOfType(AudioSource) as AudioSource[];
		for (var source : AudioSource in sources)
             source.audio.pitch = pitchVal;
	}
}

The main problem is that this FindObjectsOfType is called each frame when entering the sound alteration and that is pretty bad.

Now I have tried another solution with the pitch as static var and using

audio.pitch = Script.pitchVal;

on each object including the newly created.
But to my surprise, even though the right pitch value shows in the inspector of each newly created object, it is not applied. This is the script which is way shorter and more efficient.

var normal: boolean;
var slowing:boolean;
static var pitchVal:float;

function Start () {
	normal = false;
	slowing=false;
	pitchVal = 1;
}

function Update () {
	if(Input.GetKeyDown(KeyCode.M)){
		slowing = !slowing;
	}
	if(Input.GetKeyDown(KeyCode.N)){
		normal = !normal;
	}
	if(slowing){			
		if(pitchVal>0.1){
			pitchVal -= Time.deltaTime*0.5;
			if(pitchVal<0.1)
				slowing= !slowing;
		}
	}
	else if(normal){	
		if(pitchVal<1){
			pitchVal += Time.deltaTime*0.5;
			if(pitchVal>=1)
				normal = !normal;			 
		} 
     }
}

And in any object with sound:
function Update(){
audio.pitch= Script.pitchVal;
}

So there should be something that I am missing to make this one work but I can’t see it.

Maybe you will.