SuperCollider SAM

This might be a bit off-topic, but I’m interested in trying to emulate the SAM synthesizer in SuperCollider.

I’m assuming this should be pretty easy with formants and maybe white noise or better yet, clip noise. I have some fond (maybe not the right word) memories of SAM from the Apple II. Has anyone attempted this? Or does anyone have any resources on this?

I would imagine it should be pretty straightforward given the table data for formants, frequencies, amplitudes, etc, if not likely somewhat time consuming. String/char parsing within SCIDE really isn’t all that difficult. My assumption is that it parses words into phonemes and then synthesizes each of the phonemes with some sort of crossfade between them.

I’ve found this Java emu but I know NOTHING about Java. I’m somewhat more comfortable with C++ but I’m still pretty new at it.

If you want perfect faithfulness to the original, here is SAM decompiled into C: GitHub - vidarh/SAM: Software Automatic Mouth - Tiny Speech Synthesizer You could try to make it into a UGen using cookiecutter-supercollider-plugin.

Doing a full recreation of SAM in SuperCollider to the point of intelligibility seems very difficult and laborious. However, if all you need is some funny vowel noises, the function CombineGlottalAndFormants tells us that there are two sine wave formants and one square wave formant, all hard synced to the fundamental frequency:

(
{
    var freq, formants, phase, snd, auto;
    freq = 100;
    auto = SinOsc.ar(2).linlin(-1, 1, 1, 2);
    formants = [830 / auto, 1200 * auto, 4000 * (auto ** 0.5)];
    phase = LFSaw.ar(freq).linlin(-1, 1, 0, 1);
    snd = sin(phase * formants / freq * 2pi);
    snd[1] = snd[1] * 0.4;
    snd[2] = snd[2].sign * 0.1;
    snd = snd.sum;
    snd = snd * -10.dbamp;
    snd ! 2;
} .play(fadeTime: 0);
)

That’s pretty much the entire synthesis algorithm in SAM. Consonants are generally done with sample playback, and voiced consonants alternate between oscillators and sampled noise. You can grab some vocal formant data from here: Appendix D. Formant Values

You might also like this free and open source real-time C++ singing synthesizer I built this year, supporting three different voices:

It’s currently just an NRT command-line executable with an additional WebAssembly port, but it’s built with real-time safety in anticipation of making a SuperCollider UGen.

2 Likes