40 kHz Ultrasonic Shaker

There's a big difference in power needed to get a cup of espresso to shake at 40 kHz, and to get a sound pulse to travel through the air.
For that reason alone it will not work.
Another reason: you need a very different type of transducer shake an object than to produce sound waves in air.