public float WaveValue(int timeIndex) { var value = 0f; foreach (var note in this._currentNotes) { value += AudioMath.WaveValue( this._waveFunction, null, timeIndex - (int)(note.StartTime * AudioMath.SampleRate), note.Frequency, this.GetNoteVolume(timeIndex, note)); } return(value); }
private float WaveValue(int timeIndex) { var value = 0f; for (var i = 0; i < this._instruments.Length; i++) { var instrument = this._instruments[i]; value += AudioMath.WaveValue( instrument.WaveFunction, null, timeIndex, AudioMath.GetFrequency(this.TargetStep + instrument.StepOffset), this.Volume * instrument.Volume * AudioMath.StandardVolume * (1 + .5f * Mathf.Sin(timeIndex * .00002f / (i + 1)))); } return(value); }
private void Update() { // TODO: Bend; this._frequency = AudioMath.GetFrequency(this.TargetStep); }
public void PlayNote(int step, float volume = 1f) { this._currentNotes.Add(new Note(Time.time + 1, AudioMath.GetFrequency(step), volume)); }