20140513 - PWM Speech using an UNO
So after playing around with the SID library, I thought what about speech? Well turns out, I’m not the only one to think of it, the the libraries were a little hard to find, because the one that everyone talks about is very out dated, and doesn’t work with any of the Arduino 1+ IDEs.
Even the one I finally found had a couple of small errors in it, but fixed almost all of the bugs from the original library.
It can be found here: https://github.com/jscrane/TTS
One thing that I had to fix was an error in the english.h file found in the TTS directory. The SoundData variable needs to be declared as a const, it was an easy fix. I did leave a message on github for the author of the library.
This library is based on what Clive Webster did, and was ported by Gabriel Petrut. And Stephen Crane modified it more so you can change what PWM pin it uses (a very nice feature to be sure). So anyways, it’s a pretty simple library, set which pin you want to use.
the other commands as far as I can tell are.
setPitch, and sayText
It uses Timer1 to generate the PWM, and you need an amplified speaker with a good filter - mine works, but the filter probably could be better.
Video will be posted shortly, but this sounds very much like my SpeechJet/Robovoice chip (which was/is also using PWM to generate the speech.) The Robovoice chip is a PIC microcontroller, and has all the phonemes pre-programmed on it. The arduino uses the english.h file for it’s phonemes, and I think there maybe an error or two in a couple of the phonemes, but I can’t say for sure.
Anyways, video is coming.
May 11, 2014 - SID Arduino Library
Today while looking for some interesting projects, I stumbled upon.
https://code.google.com/p/sid-arduino-lib/ It looks like it might be abandoned project, but there is enough there to get going.
So this is really simple to hook up, PIN 9 to one side of a speaker, and ground to the other side of the speaker. I used one of my little speakers out of a old Dell computer so it was amplified, and needed to be connected to 3v, no big deal.
Figuring out some of how the sketches worked was a slightly different problem, but after I figured out one song, it was fairly easy to create others. The library can handle up to three “Channels” or “voices” thou I haven’t figured out if each channel can have a different waveform, like the C-64 could. And getting some of the timing issues right were a little weird. In fact the timing really kind of had the opposite effect as what was expected. And what I found out was that there is a type of sustain and decade on the waveforms, and that ended up being the trick to get some music working, I would need to hit a note, wait (delay) and then tell it to or force it to play freq 0.00 which can’t be heard, thou on one of the songs I did I did get some clicks, not a big deal.
So I have a video coming, but it might not get done this week. Overall thou, this was one of those quick and fun projects, that didn’t really need anything other then a board and speaker to work.