s-macke / SAM

Software Automatic Mouth - Tiny Speech Synthesizer
1.21k stars 267 forks source link

Add 8-bit formant synthesis, full waveform generation #6

Closed earlephilhower closed 6 years ago

earlephilhower commented 6 years ago

I spent an hour or two playing with the render stage to improve the output and make the code a little saner.

I removed the 8-bit multtable[] (even AVRs can do hardware multiplication now, no need for this lookup), stuck in a real sine wave instead of the 16-level quantized one, and reworked the formnat synthesis to do 8-bit generation and accumulation of the 3 sources. Then I had it actually generate intermediate values instead of simply repeating single the calculated sample (i.e. no staircases anymore in generated waveform).

To my ears the output sounds a little easier to understand, and visually the waveforms are looking much nicer: image

There's little additional computation (probably it is faster on the ESP8266 where reading from multtable[] in program memory is very slow over I2C!), so it shouldn't break any modern microcontroller.