audio synthesizer in unity?

hey I’m trying to make a organ that makes a kind of rainbow with colors when you play.
by mapping 12 notes and 12 colors to 12 keys.
so far i have the color working and an audioclip that plays, but i’d like it to keep playing the note if the key is held down.
i could do this with a perfect loop of the note but then it loses all emotion kind of.
i’d like the crescendo to stay and loop the audio clip somewhere in the middle so that I keep the fade in and out when the key is pressed or released.
anyway of doing this?

this is my current code:

using UnityEngine;
using System.Collections;

public class PUZZLE : MonoBehaviour {
	public KeyCode key1;
	public AudioClip note1;
	public Color defaultColor = Color.white;
	public Color newColor = Color.red;
	public float speed;
	
	void Start(){
		Mesh mesh = GetComponent<MeshFilter>().mesh;
		Color[] colors = new Color[mesh.vertices.Length];
		int i = 0;
		while (i < mesh.vertices.Length) {
			colors *= defaultColor;*
  •  	i++;*
    
  •  }*
    
  •  mesh.colors = colors;*
    
  • }*

  • void Update () {*

  •  Mesh mesh = GetComponent<MeshFilter>().mesh;*
    
  •  Color[] colors = mesh.colors;*
    
  •  int i = 0;*
    
  •  while (i < mesh.vertices.Length) {*
    
  •  	if(Input.GetKey(key1)){*
    
  •  		audio.PlayOneShot(note1);*
    

colors = Color.Lerp(colors_, newColor, speed * Time.deltaTime);
* } else {
colors = Color.Lerp(colors, defaultColor, speed * Time.deltaTime);
}
i++;
}
mesh.colors = colors;
}
}*_

You don’t have such level of control in Unity - at least up to now. You can try something like this keyboard piano posted in another question.