PurESpeak, an ESpeak wrapper

Share your advanced PureBasic knowledge/code with the community.
erion
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Jan 24, 2010 11:12 pm

PurESpeak, an ESpeak wrapper

Post by erion »

Hi all,

I have finished creating a wrapper for ESpeak, a free and open source speech synthesizer.
Features include speak on a selected audio device, into a wave file, or even a PureBasic sound object. Change speed, volume, pitch, word gap, voice, add variants.
Info and the download link: http://erion.tdrealms.com/software/pb/purespeak

Sample:

Code: Select all

 initspeak(".") ;Initialize ESpeak. Use a full datapath, or . for current directory.
 speaktext("Hello, world! This is ESpeak from PureBasic!") ;speak some text. 2nd parameter can be path/filename.
delay(5000) ;wait 5 secs
closeSpeak() ;free up resources
Audio works the same way, except 'SpeakMemory' returns a pointer that you can use to catch the sound from. Remember to free up this memory block afterwards.

Cheers,
Erion
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.

- W. B.

Visit my site, also for PureBasic goodies http://erion.tdrealms.com
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Re: PurESpeak, an ESpeak wrapper

Post by electrochrisso »

8) , Thanks for sharing. :)
PureBasic! Purely the best 8)
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PurESpeak, an ESpeak wrapper

Post by Kwai chang caine »

Thanks works good !! 8)
ImageThe happiness is a road...
Not a destination
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: PurESpeak, an ESpeak wrapper

Post by SFSxOI »

Good job.

How do you set the voice to female?
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
erion
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Jan 24, 2010 11:12 pm

Re: PurESpeak, an ESpeak wrapper

Post by erion »

Thanks everyone.
Voice switching works by specifying the language+variant. So, for instance switching to the first female english voice you would say

Code: Select all

SetVoiceName("en+f1")
, before calling SpeakText.

Erion
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.

- W. B.

Visit my site, also for PureBasic goodies http://erion.tdrealms.com
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: PurESpeak, an ESpeak wrapper

Post by rsts »

Very nice :)

Thanks for sharing.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: PurESpeak, an ESpeak wrapper

Post by SFSxOI »

erion wrote:Thanks everyone.
Voice switching works by specifying the language+variant. So, for instance switching to the first female english voice you would say

Code: Select all

SetVoiceName("en+f1")
, before calling SpeakText.

Erion

Ahhh, ok. Thanks.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
dige
Addict
Addict
Posts: 1404
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: PurESpeak, an ESpeak wrapper

Post by dige »

Wow, sounds good even with the German language!
SetVoiceName("de+m1")
Thx erion!
"Daddy, I'll run faster, then it is not so far..."
erion
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Jan 24, 2010 11:12 pm

Re: PurESpeak, an ESpeak wrapper

Post by erion »

It seems I have a small problem. I'm trying to implement a stop procedure, but the program completely hangs at waveOutReset_(). I suspect this is an API level freeze, and despite the many topics about this on the internet I did not manage to find a definite answer. Does anyone know why this is happening? This is the Stop code:

Code: Select all

Procedure Stop()
    eSpeak_cancel()
waveOutPause_(hDevice)
waveOutReset_(hDevice) ;Hangs here
EndProcedure
Erion
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.

- W. B.

Visit my site, also for PureBasic goodies http://erion.tdrealms.com
Post Reply