Well, in order to be totally authentic, you'd need to implement an SM-510 emulator, and write your own player. In that case you're looking at quite a bit of work, obviously. It's not impossible, though MAME has some SM-510 emulation code, and it's even BSD licensed, yay!
https://github.com/mamedev/mame/blob/ma … 10/sm510.h
And there is an SM-5 series assembler, written in Java:
https://web.archive.org/web/20160112051 … arpasm.zip
as well as an emulator, from the same guy, though I'm not sure how useful it is or if it even does sound:
https://web.archive.org/web/20160112051 … tchman.zip
The problem is that the SM-510 is slow af, so you're not going to get really advanced stuff out of it. However if I understand correctly it actually has 4 bit output so maybe that's enough to mix two voices.
I have yet to find a full instruction set of that thing, though. However, appearantly it's similar to the TMS-1100... hmmm... also no idea what this "melody module" thing is all about.
The other, slightly less authentic route would be to implement a generic piezo emulator, and write a player for that. As neither PFM nor pulse interleaving will work on an actual piezo, I'd go for a Squeeker-type player. See here for a technical discussion. Basically you generate pulse waves with reasonably low duties (say, 10-25 %) and OR them together for the final output.
In any case, please keep me up to date about this project, and let me know if I can help in any way.