Generate an arbitrary function by DAC

have a look at sawtooth-ramp-wave-generator-using-arduino-uno for some example code using an ESP32
also using a DDS module - generating-good-signal-with-60-khz-not-possible