Just to clarify - this is SAM (Software Automatic Mouth), a vintage speech synthesizer from the early 1980s Commodore era, not Microsoft Sam (the SAPI 5 voice from Windows XP). These are entirely different technologies from different generations of speech synthesis.
SAM is remarkably elegant in its simplicity.
For my own project, I've been recreating the formant synthesizer described in Dennis Klatt's influential 1980 paper. I've found that WebAudio Worklets provide an excellent framework for implementing this type of acoustic modeling in the browser.