Talkie (Speech Synthesis) Library Port Needed [WORKING]

This library doesn’t compile on Photon and I’d love to incorporate it into my projects. Looks like it was ported from Arduino to Teensy last year where it uses the DAC instead of raw PWM. Any takers?

1 Like

You could try extending the cobditional compile branches wrapped in

#if defined(__arm__) && defined(CORE_TEENSY)

to also accept this

#if defined(__arm__) && (defined(CORE_TEENSY) || defined(PARTICLE))

and use SparkIntervalTimer where the original uses IntervalTimer

1 Like

I took your advice and starting chipping away at the code. It seems to be getting further along the compile process but now I’m completely stuck at this error.

lib/Talkie/src/Talkie.cpp:178:4: error: expected constructor, destructor, or type conversion before '(' token
../build/ recipe for target '../build/target/user/platform-6-mTalkie/src/Talkie.o' failed\

Nevermind, I was just missing a #define. I got it to compile. Will report back later!

1 Like

Exciting! Good luck.

Doesn’t appear to work, and oddly it only compiles at the command line (Particle Dev reports a timeout). Using the version compiled at command line, I don’t get any sound from the DAC pin.

I’ve thrown together a rough and dirty Library 2.0 version with my changes. Hopefully @ScruffR or someone can take a look and see what’s what.

1 Like

Tinkered a little more. It appears to be caught inside the while loop on line 89 of Talkie.cpp inside the say function. The while loop calls active() which in turn calls yield(); – is that supported by Particle? Not exactly sure what that’s supposed to do but I get the impression it’s supposed to keep the loop from blocking other processes (could be wrong).

1 Like

It’s working! Available on GitHub. If anyone else wants to bang on it, that’d be great. I’ll add some Photon-specific details to the docs later. Just run an example sketch and hookup the DAC pin (plus GND) to an amplifier and enjoy the sweet digital speech.


This library still only compiles using CLI or the web IDE. Particle Dev reports a timeout. I’d love if someone with a clue about these things can help solve the issue so I can properly publish the library.

I’ll give it a try later.

Would any amplifed speaker that accepts a headphone jack work to amplify the sound output via the DAC pins?

Also what was your motivation for getting the library working? Anything special?

Yes, I imagine any amplifier will do. I’m using one of these. I ported the library because I’m tinkering with replacing the guts of a Speak & Spell, and this is the vocal tech that it uses (Linear Predictive Coding).

Did you ever get this working and compiling with the Particle DEV software? Or did you just use the other tools.

Nope, I had to compile from command line.

Thanks for the feedback.

Previously with DEV I would get the same errors if I had spaces in the .ino file name or maybe even the name of the folder the files were located in. I remember removing spaces and shortening the name of the .ino file fixed allowed me to compile in DEV when I couldn’t before.

Do you think a Piezo speaker would reproduce the voice sounds also?

I believe you need a real speaker/amp, though I could be mistaken. I’ve never found a piezo example that sounds like anything other than… a piezo.

I think your right, the peizo can play sounds from 100-10,000 hz so I wasn’t sure.

I picked up a few of these for testing and was just curious if it could play the Talkie library sounds, I’ll have to give it a try.

Hey, the library to compile after adding the Spark Intervaltimer library to the mix.

It works Great!

Tested the output with a Piezo speaker and it does not work at all.


My experience with piezo’s is that they have a very narrow band of resonance in which they sound which is usually quite high in frequency relative to speech (>1 kHz).

I would try a regular audio amplifier and speaker instead.

Yep, I used a speaker amplifier chip and it sounded great.

Pretty cool feature for reading off data, the speakers and amp chips are cheap too.

1 Like