Use earplug speakers as piezo speaker

I have a newbie question. I'm currently using an NPN transistor to drive a piezo speaker. A capacitor is connected in series between the MCU pin and the transistor's base, and a DAC is connected between this capacitor and the base to regulate the volume. The piezo emits a short beep at variable frequency (pin) and volume (adc).

I want to make another circuit (on another output pin) that connects to earplugs via a 3.5mm jack, with both the right and left channels connected to the same pin. Can I use a similar circuit, perhaps with a limiting resistor to protect the ears in case of wrong volume regulation? What I want to achieve is a similar piezo effect, but through earplugs, with adjustable volume.

With a simple research I've found that speaker is very different from a piezo, so might not work. In case, what could be a simple circuit that I can pilot with a pwm and an DAC (as reference voltage)?

Thanks

Do you mean a digital potentiometer?
Which Arduino are you using?

Please explain what you mean by "DAC". Post a link to the product page or data sheet, and a circuit diagram. Hand drawn is preferred.

The best approach is to use an audio amplifier module. Very small ones are available from hobby distributors like Adafruit and Sparkfun.

There should be a resistor.

Here is a transistor driver circit. It's shown driving a relay but it can also drive a speaker or earphone. It's not a linear amplifier. It will pass-through PWM but it "amplifies" everything to "full volume".

PWM isn't true-analog and it isn't normally used with a DAC or amplifier.

The Arduino can drive a DAC directly. You don't need a transistor in-between. But you DO need a (linear) audio amplifier to drive the earphone/speaker and to have volume control.

Right! Most DACs can't drive a speaker or headphone driectly either. The regular Arduino is rated for a maximum of 40mA from an output pin. From Ohm's Law that calculates as a minimum resistance/impedance of 120 Ohms. Piezos are very -high impedance (and capacitive) so you can connect them directly. You can't directly drive a 4-Ohm or 8-Ohm speaker. SOME headphones/earphones are 12 Ohms or more but most are not.