// Use this for initialization void Start() { //AudioSource functions Core1 = GetComponent(typeof(AudioSource)) as AudioSource; Core1.spatialBlend = 1; // freqscale = new float[128]; // InvokeRepeating ("getAudio", 0f, audioGetRepeatRate); // Heavy Param Control Hv_coreofinal_AudioLib CoreA = GetComponent <Hv_coreofinal_AudioLib> (); MastVoiceVolA = 0.8f; //Voice Volume or Amplitude: Controls Amp at the End of the Chain OscMidiFreqA = 1 + Mathf.Round(Random.value * 120f); //Clock Loop Length. For a static, all-encompassing loop, remove Random.value * 12000f //With this in place, all cores will operate on an independent loop-length, making the piece hardly repetitive. MetroA = 4000f + Random.value * 12000f; //Attack and Decay Times: If Attack Time is less-than or equal to 150ms, set it to a random value between 1ms and 10ms. etc AtktA = Random.Range(1f, 400f); if (AtktA <= 150f) { AtktA = Random.Range(5f, 15f); } DectA = Random.Range(50f, 2000f); if (DectA <= 900f) { DectA = Random.Range(40f, 100f); } //Place within loop time objVarA = Mathf.Round(Random.value * 16); //Upper partial amplitudes? Needs clarification HV1A = (Random.value * 10f); HV2A = (Random.value * 10f); HV3A = (Random.value * 10f); HV4A = (Random.value * 10f); //Upper partial spectral structure? Needs clarification HF1A = Mathf.Sin(Random.Range(10f, 20f) * 10); HF2A = Mathf.Sin(Random.Range(10f, 20f) * 10); HF3A = Mathf.Sin(Random.Range(10f, 20f) * 10); HF4A = Mathf.Sin(Random.Range(10f, 20f) * 10); //Distortion Level DistA = 0.01f + (Random.value * 2); //Delaytimes Left and Right delayTimeLeft = (Random.value * 4000); delayTimeRight = (Random.value * 4000); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Masterclock, MetroA); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Objvar, objVarA); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Mastervoicevolume, MastVoiceVolA); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Oscfreq, OscMidiFreqA); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Atkt, AtktA); //Attack Time CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Dect, DectA); //Decay Time CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hv1, HV1A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hv2, HV2A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hv3, HV3A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hv4, HV4A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hf1, HF1A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hf2, HF2A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hf3, HF3A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Hf4, HF4A); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Distortioncrush, DistA); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Lowpassfreq, LPFA); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Delaytimeleft, delayTimeLeft); CoreA.SetFloatParameter(Hv_coreofinal_AudioLib.Parameter.Delaytimeright, delayTimeRight); //PD Send Receiver Callback CoreA.RegisterSendHook(); CoreA.FloatReceivedCallback += OnFloatMessage; float CoreScaleB = 1f; }
private void OnEnable() { _dsp = target as Hv_coreofinal_AudioLib; }