You might find ‘sndkit’ which is a ‘literate’ DSP library to have the commenting you want - at least for the DSP side. Take a look at:
https://pbat.ch/sndkit/osc/
Which is the ‘code’ for osc.
Here’s the forum entry where Paul B described sndkit:
2 Likes