How to have consistantly spaced gunshot sounds for automatic weapon.

Im calling Audiosource.PlayOneShot from a coroutine like this:

    while(isAttacking) {
        AudioSource.PlayOneShot(clip);
        //projectile code here
        yield return new WaitForSeconds(fireRate);
    }

But this only plays the sound at a frame by frame basis as i understand it so it ends up sounding weird because its not being played at a constant beat.

So how can i play the sound at a consistant rate.
Maybe some way to play sounds from a separate thread that can update much faster?
Preferably i want code to work on as many platforms as possible.

Edit: I am aware that i can make up for slow frame rate by using something like CustomFixedUpdate, but that still results in my shoot code being called only on frame updates, that’s fine for the visuals and the physics, but for the sound effects the shooting sounds weird if the timing is off.

Here what i do to make it work for me.

public void startSoundFX(AudioClip effectSong){
		if (gameConfig.isAudioFXOn) {
			GameObject effectSound = new GameObject ("EffectSound");
			effectSound.transform.SetParent (this.transform.GetChild (0));
			effectSound.AddComponent<AudioSource> ();
			effectSound.GetComponent<AudioSource> ().clip = effectSong;
			StartCoroutine (playAndDelete (effectSound));
		}
}

and here the PlayAndDelete Coroutine

IEnumerator playAndDelete(GameObject soundFX){
	soundFX.GetComponent<AudioSource> ().Play();
	yield return new WaitForSeconds (soundFX.GetComponent<AudioSource> ().clip.length);
	Destroy (soundFX);
}