heckmeck!

Nerd content and
cringe since 1999

Alexander Grupe
Losso/ATW

As a young childhood Amiga user, I have not only been obsessed with pixel fiddling, but also with speech synthesis. Hearing your home computer speak surely was a “Wow!” moment for me! (The very first one being the ability to control what was shown on the family TV, with the Commodore Plus/4 – magic!)

Look who’s talking

I fondly remember cooking up little “audio dramas” in AmigaBasic which let you control all the speech synthesis parameters: I would set up a robotic dark voice on the left stereo channel, a quirky high-pitched counterpart on the right, and write some funny dialogue between the two.

Twenty years later, I’ve tried to incorporate speech synthesis into my own demoscene productions every now and then:

For most of those productions, I would start off with an adaption of Tiny Speech Synth by stan_1901 and work from there. Now I’ve stumbled upon another simple synthesis approach, and I’ve built a little testbed around it:

Not sure what I will use this for (well, I have an idea), but this might have the potential for a compact 68000 assembly implementation. Instead of using a sawtooth oscillator, a filter, and three separate formant frequencies it works by approximating the spectrum’s shape with a small set of harmonic parameters:

// Pseudo-code version of speech-processor.js

let position = ...      // sine position depending on
                        // base frequency and sample rate
let harmonicsAmount = [
  0.1,                  // amount of fundamental frequency
  0.25,                 // amount of frequency * 2
  1,                    // amount of frequency * 3
  0.15,                 // amount of frequency * 4
  ...
];

// For each sample:

let value = noise() * noiseAmount;
for (i = 0; i < harmonicsAmount.length; i++) {
  value += sin(position * (i+1)) * harmonicsAmount[i];
}
value = value / (harmonicsAmount.length+1);

Of course, the phonemes this approach can produce are somewhat limited, as this was made as a toy program for students that is a bit more exciting than printing “Hello, world”. But it already produces recognizable vowel sounds, and that may be enough for… something funny. Give it a go!

previous next close