If you just want to generate a 40KHz tunable duty cycle pulse, use a chip that supports hardware PWM.
Though PBP doesnt allow you to set a PWM greater than 32767 ( using HPWM ), you can manually set the required registers ( without needing assembler ) and get it to fire off at a perfect 40KHz PWM ( 4MHz, 8MHz oscillators work perfectly for the arithmetic ).
Feed this into a set of OPAMps running as differential comparators, with the transducer across their outputs and bobs yr uncle.
If you need more power, then use the PWM to drive a transistor/mosfet on the supply to the transducer.
Andrew