SAM Software Automatic Mouth
What is SAM?
SAM, or Software Automatic Mouth, is a fascinating Text-To-Speech (TTS) software that was originally created for the Commodore C64 in 1982 by Don't Ask Software, which is now known as SoftVoice, Inc. Today, SAM has been brought into the realm of modern technology through a vanilla JavaScript port. This port is based on a C adaptation by Stefan Macke along with refinements from contributors like Vidar Hokstad and 8BitPimp.
The core components of SAM are its Text-To-Phoneme converter, known as the reciter, and a Phoneme-To-Speech routine that provides the final vocal output. One of the main highlights of SAM's design is its focus on low memory usage and compact file size, which makes it a lightweight choice compared to alternatives like the Emscripten conversion, which is approximately 414KB in size.
For those interested in deeper insights into SAM, a wealth of information can be found in the blog posts by Artyom Skrobov on Habr, available in both the original Russian and Google-translated English versions.
Usage
Integrating SAM into a project is straightforward. By installing the module via Yarn with the command yarn add sam-js
, developers can start utilizing its features. Here's how it works in a JavaScript program:
import SamJs from 'sam-js';
let sam = new SamJs();
// Play "Hello world" over the speaker.
sam.speak('Hello world');
// Generate a wave file with "Hello world" and download it.
sam.download('Hello world');
// Get the text "Hello world" as an 8bit wave buffer array (Uint8Array).
const buf8 = sam.buf8('Hello world');
// Get the text as a 32bit wave buffer array (Float32Array).
const buf32 = sam.buf32('Hello world');
Typical Voice Characteristics
SAM offers a range of voice modulations which can be adjusted by altering speed, pitch, throat, and mouth values. Here are some examples:
- Elf: Speed 72, Pitch 64, Throat 110, Mouth 160
- Little Robot: Speed 92, Pitch 60, Throat 190, Mouth 190
- Stuffy Guy: Speed 82, Pitch 72, Throat 110, Mouth 105
- Little Old Lady: Speed 82, Pitch 32, Throat 145, Mouth 145
- Extra-Terrestrial: Speed 100, Pitch 64, Throat 150, Mouth 200
- SAM Default: Speed 72, Pitch 64, Throat 128, Mouth 128
Original Documentation and Licensing
SAM's current incarnation is a reverse-engineered version of the original commercial software published over three decades ago. The original copyright is held by SoftVoice, Inc. Despite attempts to contact the company, no updates have been made since 2009, and it's essentially considered abandonware. Consequently, the code does not fall under any specific open-source license and should be used at the user's own risk.
For those who wish to delve into the historical details, a copy of the original manual is available in the project's repository under the docs directory.
Contact
For any further inquiries or to share new findings about SAM, users are encouraged to reach out or file an issue in the project's repository.