Direct sound coding???

Hello,
I have an interesting question. I know that AudioSource.SetOutputData() and AudioClip.SetData() is capable of processing ‘sample data’ to the speaker, but what if I would like to DIRECTLY produce a sound wave to the speaker as my program runs (where computer code can directly produce the needed sound to the speaker), something like…

Speaker.output = Mathf.Cos(Time.time * 100);

producing a pitch?.. and

Speaker.output = Mathf.Cos(Time.time * 200);

producing a pitch an octave higher?

Thank you

Is there a way to directly send ‘values’ to a speaker (without ‘sampling’ anything), using something similar to the code above?

https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAudioFilterRead.html
replace the function with your generator there