Speech test

First attempt at speech on Pokitto, I doubt I’ll try again.

https://os.mbed.com/users/spinal/code/speak_test/

speak_test.bin (117.5 KB)

Sounds as if the syllables are coming out backwards?

@spinal

Are you bitshifting signed values ?

 int currentSample = (snd[t].currentSound[(snd[t].soundPoint*snd[t].speed)>>8]);

This pcm data is something im struggling with a little.

in this example,

 int currentSample = snd[t].currentSound[snd[t].soundPoint];

would be fine. thats a copy+paste from my music thingy.

the pcm data is unsigned, but when I’m attempting to adjust it in any way, I end up with a horrible mess.

I also noted you do not get any kind of a pause on blank spaces

Either your sound buffer is not working the way you intended or the pointer for the current sample is moving in a way you don’t intend

@spinal

Could you explain in general terms what it is that your code is supposed to be doing?

You have a Ticker function firing at 0.0001s … thats 0.1 milliseconds.

Something is not right about your approach.

I mean it seems you’re trying to brute force around something using the wrong means.

1 Like

It’s probably unrelated to your problem but you really need to get used to using std::size_t/size_t for sizes and array indices, otherwise int is going to bite you horribly one day.

the timed function simply checks to see if the sound pointer is in a different quarter from last time, if so then update quarter of the sound buffer. I suppose the timer doesn’t need to be super fast,just fast enough to notice the change.
The data that is being used is a bunch of speech samples representing letters of the alphabet etc. each sound tracks its position the same way any other sound would, son once it’s finished, move on to the next letter.

Buffer updates should be tied to movement of pointer to another quarter, when the data has been consumed.

If you run a Ticker at that frequency, it eats up most of the cpu. This is because the Ticker is actually a pretty high level function that allows unlimited timers using arithmetic.

1 Like

This nearly works…
TalkTest.zip (111.1 KB)
from https://os.mbed.com/users/manitou/code/tts/
Although it’s designed to work directly with a speaker pin, so all it does is squeak :frowning:

Anyone know how to convert the DAC output to something we can use on Pokitto?

3 Likes

The MicroBit has a port of SAM that was pretty easy to get running on the Pokitto:

FemtoIDE project: SAM.zip (74.1 KB) SAM.bin (55.1 KB)

To use it, pull the latest PokittoLib, extract the tts folder into your own project, then:

#include <Pokitto.h>
#include <LibAudio>
#include "tts/TTS.h"

Audio::Sink<2, 8000> sink;

void init(){
    TTS::say("Hello world");
}
5 Likes

Very cool! SAM is a classic!

4 Likes