Trying to give Uno R3 a "voice"

I am a new programmer, please bear with me. I don’t know “C” or anyother language except Arduino (That I am still learning)

I have an Uno R3 that has a speaker… the speaker works fine and the tone() proves that. I downloaded a sketch to give it a “voice”. The sketch is below.

when I compile it says spah must be a const. So I made spah a const, even though thats not what the original sketch says. I also had to coppy the talkie.h and talkie.cpp files to the folder the .ino is in or it would not compile. After compiling I still have no sound out of the speaker, even though the tone() will work.

I checked the talkie.cpp file and my pinMode( 7, OUTPUT) is correct and wired correct. Any suggestions as to what i am doing wrong. Thank you very much in advance.

#include “talkie.h”

Talkie voice;

/* the data that says “Ah, that’s better.” */
uint8_t spah PROGMEM = {0x2d,0xa0,0xdd,0x48,0xdb,0xc2,0xac,0xd8,0x2e,0x11,0x75,0x0f,0x72,0x12,0xd7,0xc3,0xd9,0xbc,0xf0,0xcd,0x4e,0xe1,0x7b,0x24,0x69,0x16,0x0e,0x40,0x68,0x51,0x11,0x08,0x40,0xa8,0x51,0x1e,0x30,0x80,0x6f,0x9e,0x83,0xf3,0xdd,0x83,0xc5,0x0b,0x37,0xde,0x2d,0x13,0x35,0x0f,0x5c,0xbd,0xe4,0xe9,0xe1,0x24,0x29,0x81,0x93,0x2f,0x4a,0x90,0x98,0x14,0x76,0x3d,0xf0,0xa1,0xaa,0x32,0x19,0x01,0xdc,0xaa,0x31,0x53,0x07,0x35,0x55,0x0b,0x8c,0x3c,0xe0,0xdc,0xcd,0x2d,0x12,0xca,0x81,0x2d,0xf7,0xb4,0x58,0xa8,0x01,0x2e,0xcc,0xd4,0x13,0x39,0x9f,0xd7,0x30,0x37,0x35,0xb2,0x52,0xd9,0x5d,0xc3,0xc4,0xc8,0xc9,0x54,0xf7,0x34,0x71,0x21,0x27,0x93,0x43,0xcb,0xdd,0x88,0x96,0x82,0x6d,0x29,0x67,0x25,0x66,0x4a,0xb6,0xd5,0x5d,0x44,0xa8,0x2b,0x4d,0xa8,0xf4,0x34,0x53,0x29,0x6b,0xc6,0xdc,0xd4,0x22,0x17,0xd7,0x53,0xf7,0x48,0x6f,0xac,0x38,0xa0,0x23,0xbc,0xdc,0x12,0xe9,0x85,0x70,0xb7,0xb4,0x48,0xc6,0x81,0xcd,0x2a,0x4d,0x2d,0xb7,0x14,0xe6,0xe2,0x08,0x8c,0x32,0x72,0xd1,0xd4,0x5b,0x59,0xe8,0x28,0x75,0xa5,0x4a,0x13,0xa1,0xa5,0x61,0x4d,0x3c,0x4d,0x84,0xa6,0x8e,0x3a,0x49,0x0b,0x37,0x9d,0x58,0xd6,0x69,0xc4,0x59,0x72,0x62,0x6c,0x85,0xd3,0x60,0xc9,0x81,0xd5,0x0d,0x4e,0x8c,0xc5,0x46,0xde,0x34,0xa0,0xc0,0x96,0x4a,0x14,0xd5,0xb3,0x04,0xd9,0x26,0x51,0x44,0x1f,0x32,0x70,0x05,0x47,0x15,0x65,0x08,0x0c,0x52,0x92,0x84,0xc4,0x21,0xa0,0x58,0xa8,0x5d,0x92,0x68,0x27,0x48,0xa3,0x71,0x48,0x8e,0x8d,0x12,0x6f,0xc4,0x7e};

void setup()
voice.say(spah); /* say “Ah, that’s better.” */

void loop()

Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.

The read me file on the talkie libiary says:-

Connect headphones or an audio amplifier to digital pin 3.

You can't use pin 7.

Grumpy_Mike :

I read the rules. I did not see the part about pin 3, thank you. I will try it.

I do not think I cross threaded, I may be guilty of a not researching it too well (I thought I did) and I did not use the correct tags to insert my code. I assume these were what you were talking about. So for now on if / when I have a code snippet to show I will use the insert code tool.

Sorry for breaking the rules. I am still very much a newbee and trying to get up and running on my own at home / in spare time. Thank you for being understanding. -Sam

A thought, did you install the library correctly?

Have a look here and try the examples with the output on pin 3.

Grumpy_Mike, sparx266: I got it to work! Thank you all for the help! :slight_smile:

What do you think about the sound? I remember the origional use of LPC in the BBC micro computer and I remember the quality being better than this emulation.

The sound is poor but I assume that's because I am using a $0.99 micro speakers from eBay. Tomarrow I will get a LM386 (with its own 12V supply) and a real speaker, I am sure it will be better.... BUT... this method appears to use a lot of precious resources on the board (from what little I understand and see). I assume it will be better to use a SD card with pre-recorded words and string them together as needed. That is my next step. This was good for learning and to have another tool in my tool kit :slight_smile: Thank you and everyone else for the help again!

No matter how good your circuitry, the Talkie library always sounds like the Speak & Spell game from the early 1980s... because it's the same algorithm!

Paul: still pretty awsome to a newbie like me :slight_smile: This is my first foray into this world. The more I am doing the more I am enjoying it... warts and all :slight_smile: