Page 1 of 2

Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 2:47 am
by blueznl
After fooling around with different TTS programs I still can't find what I'm looking for, so I'm considering writing my own. Think of a simplified Balabolka, simply monitoring the clipboard.

Now I've tried the different TTS examples I could find on the forum but none seemed to work. Note: I don't want to use external libraries if possible, to reduce dependencies.

I see two routes:

- using the (free) build in Windows voices, those are probably accessible over SAPI 5, and / or...
- using Amazon's Polly (or Azure or Google whatever) which isn't free

I finally managed to get Amazon Polly to work from the command line (all the descriptions on Amazon's own pages don't match the actual web interfaces, pffff... they need to update a bit) but I have no clue yet how to access it from PureBasic.

Did anyone ever execute some experiments in this direction?

I'm only looking for text to speech, no need to go in the other direction.

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 2:51 am
by BarryG

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 3:33 am
by blueznl
> Note: I don't want to use external libraries if possible, to reduce dependencies.

:-)

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 4:00 am
by BarryG
It only needs .NET 4, which comes with Win 7 and later -> https://learn.microsoft.com/en-us/dotne ... ramework-4

So, nothing to install.

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 10:13 am
by Caronte3D
I used on a project the SAPI5 via an example from the French forum, and everything works nice, I don't remember, but I think maybe this link:
https://www.purebasic.fr/french/viewtop ... ese+vocale

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 5:52 pm
by blueznl
That's similar to the code I found on the forum. (It might be the same code, actually.)

But it's using some DLL that isn't found. Any suggestions?

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 8:29 pm
by Caronte3D
blueznl wrote: Fri Mar 24, 2023 5:52 pm That's similar to the code I found on the forum. (It might be the same code, actually.)

But it's using some DLL that isn't found. Any suggestions?
What dlls? It's only SAPI5 of Windows you don't need more.

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Fri Mar 24, 2023 10:31 pm
by idle
I just tried this, works on win 11

viewtopic.php?t=71402

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Sat Mar 25, 2023 1:51 am
by blueznl
Caronte3D wrote: Fri Mar 24, 2023 8:29 pm
blueznl wrote: Fri Mar 24, 2023 5:52 pm That's similar to the code I found on the forum. (It might be the same code, actually.)

But it's using some DLL that isn't found. Any suggestions?
What dlls? It's only SAPI5 of Windows you don't need more.
The example in that post includes some DLLs, doesn't it? (You have me mightily confused now.)

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Sat Mar 25, 2023 1:57 am
by blueznl
idle wrote: Fri Mar 24, 2023 10:31 pm I just tried this, works on win 11

viewtopic.php?t=71402
Yes, it does! Thank you! I'm going to study what it does exactly...

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Sat Mar 25, 2023 10:12 am
by Caronte3D
blueznl wrote: Sat Mar 25, 2023 1:51 am The example in that post includes some DLLs, doesn't it? (You have me mightily confused now.)
On the post you can read:
For XP, install the runtime if it is not already done and use Sapi 5 voices
so... you don't need it for recent Windows.
Like I said, I used this code with no external dependencies except the ones that come with Windows 10.

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Sat Mar 25, 2023 2:52 pm
by blueznl
Interestingly, it won't run on my Win 10 and Win 11 machine, as it is trying to open those .DLLs that are in the archive

In other words, the sample includes those DLLs, and the code tries to open them. Without those DLLs it doesn't run.

Can you run it on your machine without those DLLS?

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Sat Mar 25, 2023 6:27 pm
by Caronte3D
blueznl wrote: Sat Mar 25, 2023 2:52 pm Can you run it on your machine without those DLLS?
You make me doub, I do my program some time ago, but I don't remember to install any dll :?

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Mon Mar 27, 2023 10:41 pm
by blueznl
Caronte3D wrote: Sat Mar 25, 2023 6:27 pm
blueznl wrote: Sat Mar 25, 2023 2:52 pm Can you run it on your machine without those DLLS?
You make me doub, I do my program some time ago, but I don't remember to install any dll :?
Memory like a sieve :-) Don't worry, I got it working with the other example.

Re: Text to speech - Using Amazon Polly / S3 services from within PureBasic

Posted: Mon Mar 27, 2023 10:43 pm
by blueznl
Now I wonder, did anyone figure out a way to use the 'new' Windows 10 / 11 voices? They are pretty good compared with Amazon Polly and the old Sapi 5 voices.

I Googled a bit, but couldn't find any reference. Looks like it's MS only?

(For the difference, listen to this: https://ninelizardsblog.blogspot.com/20 ... mples.html )