jscrane / TTS

Arduino Text-to-Speech Library
194 stars 49 forks source link

Fix buffer handling issues #5

Closed AndreNeedham closed 8 years ago

AndreNeedham commented 8 years ago

The first bug was that sayText was copying a buffer of up to 112 bytes into a buffer of size 64 (g_text). Fixed it by changing g_text to 128 bytes, plus we don't need to copy the buffer, we can just let textToPhonemes fill the buffer for us.

The next bug was a line of code was checking to see if we'd written 256-16 bytes to a buffer. All buffers are 128 bytes, so I changed it to 128-16.

Note that in general this code is likely to produce no output if the input sentence is larger than about 50 to 60 characters (since the final phoneme data will end up being more than 112 characters which is the limit). There's no easy way to know until after all the processing is done. Probably worth calling that out somewhere.