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

Just starting out? Need help? Post your questions and find answers here.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post 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.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post by blueznl »

> Note: I don't want to use external libraries if possible, to reduce dependencies.

:-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post 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
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post 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?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post 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.
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post by idle »

I just tried this, works on win 11

viewtopic.php?t=71402
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post 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.)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post 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...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post 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.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post 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?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post 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 :?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post 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.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

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

Post 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 )
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply