toneAC v1.2 - Twice the volume, higher quality, higher frequency, etc.

MasterTom:
I found the following line in your code "uint8_t _tAC_volume[] = { 200, 100, 67, 50, 40, 33, 29, 22, 11, 2 }; // Duty for linear volume control.". What is the meaning of this? Can I adapt this to realize my task?

Maybe it is possible to change it to something like: toneAC(freq, pulse_length,...) ?

The _tAC_volume array modifies the duty cycle depending on the volume you set. It's not linear because linear doesn't provide an accurate sound output level. It needs to be more logarithmic to make it sound correct.

If you want more linear steps, you could simply modify the _tAC_volume array to something linear that works for your task. Not sure how well this would work, as toneAC is designed for audio output. I would say when using toneAC for other tasks you should always use full volume as the volume is a hack that just happens to work for speakers.

Tim