Forgot to mention the project I am working on. Here is the link:
I am working on a acoustic levitation project. And want to use it to levitate liquid droplet and hope it can show some harmonic oscillation by the voltage oscillation behavior mentioned in the main post.
A PWM signal has a fixed amplitude, while frequency and duty cycle are adjustable in code. An adjustable DC level can be achieved by a RC low pass filter, but not a level adjustable AC signal.
If you need both variable amplitude and frequency, use a DAC as built into some Arduinos or as an external module.