Page 2 of 3
Re: PB.Ex Speech (Windows)
Posted: Mon May 06, 2019 12:44 pm
by RSBasic
I tested in a VM with Windows XP with .NET 4 installed. Works here.
I tested in a VM with Windows XP without .NET 4. Here the variable PBEx_Speech has the value > 0.
The application crashes when the first function is executed, but the DLL file could be loaded.
BarryG wrote:I just noticed that the return value of the PBEx_Speech variable is 0 on XP
Do you use the right version (32 or 64 bit)? Can the DLL file be found?
Re: PB.Ex Speech (Windows)
Posted: Mon May 06, 2019 1:12 pm
by BarryG
Hi RSBasic, yes, I used the right DLL. Here's a picture to explain it all:
https://i.imgur.com/UYubizc.png
Other things I tried: renaming the DLL (in case the dot in "PB.Ex" made it look like not a DLL file), turned off my virus-scanner (Avast), changed #PB_Any to 1 (hard-coded library number). Still returns 0 when trying to load the DLL, despite all of these changes.
Re: PB.Ex Speech (Windows)
Posted: Mon May 06, 2019 1:26 pm
by RSBasic
You tried everything. I have no other idea. I don't know why that is.
\\Edit:
Maybe:
https://thewindowsclub-thewindowsclubco ... nblock.jpg
Re: PB.Ex Speech (Windows)
Posted: Mon May 06, 2019 1:37 pm
by BarryG
RSBasic wrote:You tried everything.
I even tried after booting XP in Safe Mode, but still no luck.
XP doesn't have an option to unblock a file from the Properties dialog.
XP is dead anyway, so don't worry about it. Just thought it may be something you overlooked.
Re: PB.Ex Speech (Windows)
Posted: Sun Aug 25, 2019 1:14 pm
by RSBasic
PB.Ex Speech 1.0.3.0 has been released.
Changelog:
- Bugfix: TextToAudioFile(): After the creation the audio file was still opened by the program.
Re: PB.Ex Speech (Windows)
Posted: Sat Oct 03, 2020 1:12 pm
by minimy
Hello, thanks for this incredible dll. Really usefull!
I have a little problem. Whe try to use other voices, in spanish (from Spain) may be Pablo (es-ES-Pablo) or Laura..
System return no match.
I use some thing like this: TextToSpeaker("¡Hola amigos de PureBasic!", "ES-es-Pablo", 0, 100, 0, @ErrorOutput$)
What is the right syntax used by tts?. I try lot of combinations but no work. (es-Pablo, ES-es-Pablo, ..)
Can you help me?. Thanks you very much and congratulations for another great job!
Re: PB.Ex Speech (Windows)
Posted: Fri Jan 29, 2021 9:29 am
by loulou2522
Hi RSBASIC,
Where can i find the name of all voice as invoke in text speech ?
Thanks
Re: PB.Ex Speech (Windows)
Posted: Fri Jan 29, 2021 10:15 am
by ar-s
@loulou2522
Voice list here :
Code: Select all
Global NewList Voices.s()
Import "ole32.lib"
CoInitialize(reserved.l = #Null)
CoUninitialize()
CLSIDFromProgID(ProgID.p-bstr, *clsid.CLSID)
CLSIDFromString(String.p-bstr, *clsid.CLSID)
EndImport
#CLSCTX_INPROC_SERVER = 1
Enumeration 0 ; SpeechVoiceSpeakFlags
#SVSFDefault = 0
#SVSFlagsAsync = 1
#SVSFPurgeBeforeSpeak = 2
#SVSFIsFilename = 4
#SVSFIsXML = 8
#SVSFIsNotXML = 16
#SVSFPersistXML = 32
#SVSFNLPSpeakPunc = 64
#SVSFNLPMask = 64
#SVSFVoiceMask = 127
#SVSFUnusedFlags = -128
EndEnumeration
Interface ISpeechVoice Extends IDispatch
get_Status(*ISpeechVoiceStatus.l)
get_Voice(*ISpeechObjectToken.l)
put_Voice(*ISpeechObjectToken.l)
get_AudioOutput(*ISpeechObjectToken.l)
put_AudioOutput(*ISpeechObjectToken.l)
get_AudioOutputStream(*ISpeechBaseStream.l)
put_AudioOutputStream(*ISpeechBaseStream.l)
get_Rate(long.l)
put_Rate(long.l)
get_Volume(long.l)
put_Volume(long.l)
put_AllowAudioOutputFormatChangesOnNextSet(VARIANT_BOOL.l)
get_AllowAudioOutputFormatChangesOnNextSet(VARIANT_BOOL.l)
get_EventInterests(SpeechVoiceEvents.l)
put_EventInterests(SpeechVoiceEvents.l)
put_Priority(SpeechVoicePriority.l)
get_Priority(SpeechVoicePriority.l)
put_AlertBoundary(SpeechVoiceEvents.l)
get_AlertBoundary(SpeechVoiceEvents.l)
put_SynchronousSpeakTimeout(long.l)
SynchronousSpeakTimeout(long.l)
Speak(Text.p-bstr, SpeechVoiceSpeakFlags.l, long.l)
SpeakStream(*ISpeechBaseStream, SpeechVoiceSpeakFlags.l, long.l)
Pause()
Resume()
Skip(*Type, NumItems.l, long.l)
GetVoices(*RequiredAttributes.l, *OptionalAttributes, *ISpeechObjectTokens.l)
GetAudioOutputs(*RequiredAttributes, *OptionalAttributes, *ISpeechObjectTokens.l)
WaitUntilDone(msTimeout.l, VARIANT_BOOL.l)
SpeakCompleteEvent(long.l)
IsUISupported(*TypeOfUI, *ExtraData.VARIANT, VARIANT_BOOL.l)
DisplayUI(hWndParent.l, *Title, *TypeOfUI, *ExtraData.VARIANT)
EndInterface
Interface ISpeechObjectToken Extends IDispatch
get_Id(ObjectId)
get_DataKey(ISpeechDataKey.l)
get_Category(ISpeechObjectTokenCategory.l)
GetDescription(Locale.l, Description)
SetId(id, CategoryID, CreateIfNotExist)
GetAttribute(AttributeName.p-bstr, *AttributeValue)
CreateInstance(pUnkOuter, SpeechTokenContext, Object)
Remove(ObjectStorageCLSID)
GetStorageFileName(ObjectStorageCLSID, KeyName, FileName, SpeechTokenShellFolder, *FilePath)
RemoveStorageFileName(ObjectStorageCLSID, KeyName, DeleteFile)
IsUISupported(TypeOfUI, *ExtraData, *Object, *Supported)
DisplayUI(hwnd, Title, TypeOfUI, *ExtraData, *Object)
MatchesAttributes(Attributes, *Matches)
EndInterface
Interface ISpeechObjectTokens Extends IDispatch
get_Count(a.l)
Item(Index.l, Token.ISpeechObjectToken)
get__NewEnum(ppEnumVARIANT.IUnknown )
EndInterface
Procedure.l Speak(*SpeechVoice.ISpeechVoice, *SpeechObjectTokens.ISpeechObjectTokens, Text.s, Rate.l = 0, Voice.l = 0,Volume=100)
Protected flag.l = #SVSFDefault, Token.ISpeechObjectToken
If *SpeechObjectTokens\Item(Voice, @Token) = #S_OK
*SpeechVoice\put_Volume(volume)
*SpeechVoice\put_Voice(Token)
*SpeechVoice\put_Rate(Rate)
*SpeechVoice\Speak(Text, 0, @flag)
EndIf
EndProcedure
;
Procedure ListVoices( )
If CLSIDFromProgID("SAPI.SpVoice", @clsid.CLSID) = #S_OK
If CLSIDFromString("{269316D8-57BD-11D2-9EEE-00C04F797396}", @Refiid.CLSID) = #S_OK
CoInitialize()
If CoCreateInstance_(clsid, #Null, #CLSCTX_INPROC_SERVER, Refiid, @SpeechVoice.ISpeechVoice) = #S_OK
SpeechVoice\GetVoices(0, 0, @SpeechObjectTokens.ISpeechObjectTokens)
SpeechObjectTokens\get_Count(@Count)
VoiceList.s = ""
VoiceList =Str(count)+","
For i = 0 To Count - 1
SpeechObjectTokens\Item(i, @Token.ISpeechObjectToken)
Token\GetDescription(0, @Description)
Token\GetAttribute("Language", @AttributeValue)
VoiceList+ PeekS(Description, -1, #PB_Unicode) + ","
AddElement (Voices())
Voices() = PeekS(Description, -1, #PB_Unicode)
Token\Release()
Next i
SpeechObjectTokens\Release()
SpeechVoice\Release()
EndIf
CoUninitialize()
EndIf
EndIf
ProcedureReturn ListSize(Voices())
EndProcedure
;- Test it ---
If ListVoices( ) > 0
ForEach Voices( )
Debug Voices()
Next
Else
Debug "My Computer is mute :)"
EndIf
Re: PB.Ex Speech (Windows)
Posted: Sun May 08, 2022 7:51 pm
by morosh
Hello:
How to select a particular voice (not the default one), I need to speak in many languages.
Thanks
Re: PB.Ex Speech (Windows)
Posted: Tue Jul 26, 2022 12:55 pm
by BarryG
Is there any way to stop a voice from speaking before it's finished? Thanks.
Re: PB.Ex Speech (Windows)
Posted: Tue Jul 26, 2022 9:11 pm
by Caronte3D
I don't use this library, but sometimes...
Try to send an empty string (you may need some flag to play the empty scring without waiting for the previous one to finish).
Re: PB.Ex Speech (Windows)
Posted: Sun Jul 31, 2022 12:19 pm
by BarryG
Tried an empty string but it doesn't work.
Re: PB.Ex Speech (Windows)
Posted: Mon Aug 01, 2022 6:18 am
by TassyJim
I haven't used that library but I can confirm that this code on the French forum works.
https://www.purebasic.fr/french/viewtop ... ese+vocale
I used the code in a project a few years ago and just tested it on Windows 11.
It runs well including the pause and stop functions.
The only problem I have is, I can't compile as 64 bit. 32 bit C backend is fine.
There will be a variable somewhere that is long instead of integer but I don't know my way around the code well enough to find it.
Jim
Re: PB.Ex Speech (Windows)
Posted: Wed Aug 10, 2022 2:00 pm
by dige
Download not possible:
http://www.rsbasic.de/downloads/downloa ... Speech.zip
Is there a new download link? Thx.
Re: PB.Ex Speech (Windows)
Posted: Wed Aug 10, 2022 3:53 pm
by RSBasic
The problem is with the http address. With https it works:
https://www.rsbasic.de/downloads/downlo ... Speech.zip