Main Menu

News:

SyntaxBoom, now with pwetty syntax highlighted code boxes! \o/ 

https://www.syntaxboom.com/forum/index.php?topic=96

Shoutbox

Dabzy

Today at 12:17:43
Lol, not the ones from Poundland! :D Anyway, I've got a nice box of chocolates and a Prosecco to go in the bucket! ;)

Jackdaw

Today at 11:18:06
@Dabzy I think they will appreciate it. Have you seen how much it can cost for a good mop and bucket set in this day and age.  I can buy a bottle of Blonde chocolate cream liqueur for less at ASDA.

Dabzy

Today at 10:47:41
Well, I'm off out to buy a 60th birthday pressie... A mam of one of me mates... Gonna get her a mop and bucket, and wrap it up, even wrap the noodly mop bits individually... All in Christmas wrapping paper... Should go down well! :D

Dabzy

2025-10-17, 17:36:22
Well, just have to keep an eyes, even though they said they sorted it like

Jackdaw

2025-10-17, 17:22:26
When I saw it. It was in the very early hours when normal people are fast asleep. Lasted for around half an hour before back to normal.

Dabzy

2025-10-17, 15:02:27
First time I seen it, having me cuppa at work and had a browse... Saw it and I was like "WTF is that!?!", so got on the blower!

Baggey

2025-10-17, 11:22:52
Oh goody. Was getting withdraw symptons!

Jackdaw

2025-10-17, 10:38:44
I saw that the other week, and forgot to query it. Redirects to sedo.parking.

Dabzy

2025-10-17, 10:33:24
Seems we lost the site for a bit there, sorted, basically htaccess went a bit screwy and it was diverting to one of them stupid default search pages... Been on to ionos the host provider and they fixered it! \o/ Had meself a bit of a sweat on there!  ;D

Jackdaw

2025-10-16, 20:00:40
Going to have to try bourbon and beans. That should be an explosive combination.

Members
Stats
  • Total Posts: 1,824
  • Total Topics: 226
  • Online today: 19
  • Online ever: 232 (Oct 08, 2025, 09:18 AM)
Users Online
  • Users: 1
  • Guests: 9
  • Total: 10
  • Dabzy
Welcome to SyntaxBoom. Please login or sign up.

Recent

BlitzSpeech.DLL

Started by Dabzy, Oct 17, 2025, 03:33 PM

Previous topic - Next topic

Dabzy

BlitzSpeech v1.0 - Windows Text-to-Speech Library

Download: BlitzSpeech

About:
BlitzSpeech is a powerful, easy-to-use Windows Text-to-Speech (TTS) library that wraps Microsoft's Speech API (SAPI 5.3+) in a simple DLL. BlitzSpeech works seamlessly with Blitz3D, BlitzMax-NG, and Visual Studio C++, but not limited too. If you use a language that can import functions from DLL's, then all you need is to code the bridge.

- High-Quality Speech - Natural-sounding voices using Windows SAPI 5.3+
- Multi-Language - Access all installed Windows voices in 30+ languages
- Desktop + OneCore Voices - Supports both legacy SAPI and modern Windows 10/11 voices
- SAPI XML Support - Advanced speech control with SAPI XML markup
- WAV Export - Save speech to high-quality audio files
- Async/Sync - Blocking or non-blocking speech with full playback control
- Voice Control - Adjust rate, volume, pause, resume, and stop
- Smart File Reading - Auto-detects text file encoding (ANSI, UTF-8, both UTF-16 endian types)


What's in the Download:
Core Files

BlitzSpeech.dll - Main library (32-bit or 64-bit)
BlitzSpeech.lib - Import library

For Blitz3D

BlitzSpeech.decls - Function declarations
Examples/Blitz3D/ - Sample code

For BlitzMax-NG

BlitzSpeech.bmx - Complete header with constants
Examples/BlitzMaxNG/ - Sample code

For Visual Studio C++

BlitzSpeech.h - C/C++ header with full API
Examples/VisualStudio/ - Sample project

Documentation:
There is a readme file, but for usage, check the BMX-NG examples.

Quick examples:

Blitz3D

Include "BlitzSpeechInclude.bb"

InitSpeech()
SpeakText("Hello from Blitz3D!")
CleanupSpeech()

BlitzMax-NG

Import "BlitzSpeech.bmx"

InitSpeech()
SpeakText("Hello from BlitzMax-NG!")
CleanupSpeech()

Visual Studio C++

#include "BlitzSpeech.h"

int main() {
    InitSpeech();
    SpeakText("Hello from C++!");
    CleanupSpeech();
    return 0;
}

Setup (Visual Studio): Link BlitzSpeech.lib and copy BlitzSpeech.dll to your output directory.

Core Functions:

Initialization

InitSpeech() - Initialize the speech system
CleanupSpeech() - Clean up resources

Speech Output

SpeakText(text) - Speak text (synchronous)
SpeakTextFlags(text, flags) - Speak with custom flags
SpeakFile(filepath) - Read and speak a text file

Playback Control

PauseSpeech() - Pause speech
ResumeSpeech() - Resume speech
StopSpeech() - Stop immediately
IsSpeaking() - Check if speaking
WaitUntilSpeechIsDone(timeout_ms) - Wait for completion

Voice Management

GetVoiceCount() - Get number of voices
GetVoiceName(index) - Get voice name
GetVoiceLanguage(index) - Get voice language
GetVoiceType(index) - Get type (Desktop/OneCore)
SetSpeechVoice(index) - Set voice by index
SetSpeechVoiceByName(name) - Set voice by name
GetCurrentVoice() - Get active voice

Settings

SetSpeechRate(rate) - Speed (-10 to 10)
SetSpeechVolume(volume) - Volume (0 to 100)

File Output

SpeakToFileDefault(text, filepath) - Save to WAV
SpeakToFile(text, filepath, rate, bits, channels, flags) - Custom quality WAV

Utilities

GetFileEncoding(filepath) - Detect file encoding
AboutBlitzSpeech() - Show about dialog

Supported Languages:
English (US/UK/AU/CA/IN), Spanish, French, German, Italian, Portuguese, Dutch, Russian, Polish, Chinese, Japanese, Korean, Arabic, Czech, Danish, Finnish, Greek, Hebrew, Hindi, Hungarian, Norwegian, Swedish, Thai, Turkish, and more!
(Depends on installed Windows language packs)

Requirements:
OS: Windows 7 (Not personally tested) or later (Windows 10/11 for OneCore voices)
SAPI: 5.3+ (included in Windows)
Download showcases: VSC++ 2022, Blitz3D and BlitzMax-NG only at time of release.

License:
MIT License - Copyright © 2025 Michael Denathorn
Free to use in personal and commercial projects. See LICENSE file for details.

Any issues, let me know here, otherwise...

Enjoy! :)

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!

Stevie G

This didn't work for me using the Blitz3d example. I got 'userlib function not found'.

The Dll and decals are in the Blitz3d/userlib directory.  I'm on Win10 .. is it possible I don't have the SAPI?

Also, in your example above for Blitz3d, should the include not be for "BlitzSpeechInclude.bb" rather than the decls file?

Dabzy

Mmmmm, how odd... Because I did test it! :/

Quote from: Stevie G on Today at 09:52 AMI'm on Win10 .. is it possible I don't have the SAPI?

No, your system will have it... If you delve into the VSC++ project, in the Debug folder, you will find an executable to test it.

So, not sure what has happened with the Blitz3D thing... But I'll take a look! ;)

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!

Dabzy

I know whats wrong, I used an old DECLS file, but then doing a rejig and a tidy I changed the names of the exported functions to match the more Blitz-like affair, and thus... Bundled the old DECLS file in the download without checking! :D

Me bad... But thanks for catching that! ;)

Here is the newer DECLS file:

.lib "BlitzSpeech.dll"

InitSpeech%():"_InitSpeech@0"
SpeakText%(text$):"_SpeakText@4"
SpeakTextFlags%(text$, flags%):"_SpeakTextFlags@8"
SetSpeechRate%(rate%):"_SetSpeechRate@4"
SetSpeechVolume%(volume%):"_SetSpeechVolume@4"
PauseSpeech%():"_PauseSpeech@0"
ResumeSpeech%():"_ResumeSpeech@0"
StopSpeech%():"_StopSpeech@0"
IsSpeaking%():"_IsSpeaking@0"
WaitUntilSpeechIsDone%(timeout_ms%):"_WaitUntilSpeechIsDone@4"
SpeakFile%(filepath$):"_SpeakFile@4"
SpeakToFileDefault%(text$, filepath$):"_SpeakToFileDefault@8"
SpeakToFile%(text$, filepath$, sampleRate%, bitsPerSample%, channels%, flags%):"_SpeakToFile@24"
GetFileEncoding%(filepath$):"_GetFileEncoding@4"
GetVoiceCount%():"_GetVoiceCount@0"
GetVoiceName$(index%):"_GetVoiceName@4"
GetVoiceLanguage$(index%):"_GetVoiceLanguage@4"
GetVoiceType%(index%):"_GetVoiceType@4"
SetSpeechVoice%(index%):"_SetSpeechVoice@4"
SetSpeechVoiceByName%(name$):"_SetSpeechVoiceByName@4"
GetCurrentVoice%():"_GetCurrentVoice@0"
AboutBlitzSpeech():"_AboutBlitzSpeech@0"
CleanupSpeech():"_CleanupSpeech@0"

Oh, and thanks for mentioning that typo... I was in monkey at a keyboard mode! :P Hehehe

For anyone else, the download has been updated! :)

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!

Stevie G

Magic, I'll give it a go and report back.

Dabzy

Champion, fingers crossed! ;)

I knew something would crop up... Lol, way of the "programming come release it to the masses" scenerio innit! :D

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!

Stevie G

Works now BUT the speech doesn't sound good. Difficult to describe ... kinda grainy with weird artifacts. 

It's maybe my system, although I've never really had sound issues with Blitz. I'm using a version with inbuilt fmod - v1.108.

Hopefully someone else with Blitz can try and confirm.

Dabzy

#7
Well, the dafault one is roboty, but if you look at the BlitzMax-NG example number 4, you can see how to list and use different (More human) voices.

Also, the speech comes from your Windows default sound driver.

All in all, on my system, it sounds grand, even the default one, yes, very much Stephen Hawkings sounding, but, not bad.

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!