Skip to content

Commit

Permalink
Adding source code files including B32_TTS.DLL
Browse files Browse the repository at this point in the history
  • Loading branch information
rommix0 authored Dec 4, 2024
0 parents commit 7ba0612
Show file tree
Hide file tree
Showing 21 changed files with 1,481 additions and 0 deletions.
Binary file added src/B32_TTS.DLL
Binary file not shown.
149 changes: 149 additions & 0 deletions src/BST.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
// Define global variables for BST synthesizer
//
// Author: Anthony C. Bartman (@rommix0)
//
// v1.00 - first version (11/28/2024)
// v1.01 - minor changes and fixes. (12/04/2024)
// + added pitch adjustment
// + added keyboard hotkeys
// + replaced BST.DLL with original B32_TTS.DLL

// Voice IDs
#define FRED 0
#define SARAH 1
#define HARRY 2
#define MARTHA 3
#define TIM 4
#define DEXTER 5
#define ALIEN 6
#define KIT 7
#define WENDY 8
#define BRUNO 9
#define GRANNY 10
#define GHOST 11
#define PEEPER 12
#define DRACULA 13

// Voices parameters
//-----------------------------------------------------------
// FRED
const char *V_FRED = "~v0]~e3]~h0]~u0]";
const char *V_FRED_R = "~r0]";
const int V_FRED_F = 80;

// SARAH
const char *V_SARAH = "~v2]~e3]~h-20]~u0]";
const char *V_SARAH_R = "~r0]";
const int V_SARAH_F = 175;

// HARRY
const char *V_HARRY = "~v3]~e3]~h10]~u0]";
const char *V_HARRY_R = "~r5]";
const int V_HARRY_F = 65;

// WENDY
const char *V_WENDY = "~v2]~e1]~h50]~u0]";
const char *V_WENDY_R = "~r-5]";
const int V_WENDY_F = 150;

// DEXTER
const char *V_DEXTER = "~v6]~e6]~h0]~u-12]"; // unvoiced gain -25 -> -12
const char *V_DEXTER_R = "~r7]";
const int V_DEXTER_F = 90;

// ALIEN
const char *V_ALIEN = "~v4]~e6]~h-50]~u-20]";
const char *V_ALIEN_R = "~r-20]";
const int V_ALIEN_F = 115;

// KIT
const char *V_KIT = "~v5]~e3]~h40]~u0]";
const char *V_KIT_R = "~r-10]";
const int V_KIT_F = 230;

// BRUNO
const char *V_BRUNO = "~v3]~e3]~h50]~u0]";
const char *V_BRUNO_R = "~r8]";
const int V_BRUNO_F = 60;

// GHOST
const char *V_GHOST = "~v3]~e2]~h50]~u6]"; // unvoiced gain 0 -> 6
const char *V_GHOST_R = "~r8]";
const int V_GHOST_F = 60;

// PEEPER
const char *V_PEEPER = "~v2]~e2]~h0]~u5]";
const char *V_PEEPER_R = "~r0]";
const int V_PEEPER_F = 80;

// DRACULA
const char *V_DRACULA = "~v3]~e3]~h45]~u-5]";
const char *V_DRACULA_R = "~r10]";
const int V_DRACULA_F = 47;

// GRANNY
const char *V_GRANNY = "~v4]~e3]~h-60]~u0]";
const char *V_GRANNY_R = "~r20]";
const int V_GRANNY_F = 350;

// MARTHA
const char *V_MARTHA = "~v6]~e4]~h100]~u-5]";
const char *V_MARTHA_R = "~r-10]";
const int V_MARTHA_F = 300;

// TIM
const char *V_TIM = "~v3]~e4]~h-10]~u0]";
const char *V_TIM_R = "~r-10]";
const int V_TIM_F = 60;
//-----------------------------------------------------------

// Variables for pitch adjustment
int global_pitch = 80;
const int freq_str_sz = 3;
char *freq_str = (char *)malloc(freq_str_sz * sizeof(char));

// Used to tell WndProc that TTS buffer is filled up.
#define TTS_BUFFER_FULL 957

// Settings for BST parameters
#define RATE_SETTING 257
#define GAIN_SETTING 258
#define UNVOICED_GAIN_SETTING 259 // ignore this. unvoiced gain is set with custom voices
#define PITCH_SETTING 260 // ignore this. doesn't work well when custom voices are set
#define BIT_DEPTH_SETTING 4097 // 8 and 16 are valid values for bit depth

// Settings adjust amounts
#define RATE_ADJUST 20
#define GAIN_ADJUST 5
#define PITCH_ADJUST 5

// Setup function types for BST functions
typedef int (__cdecl *bstCreateFunc)(long*&);
typedef int (__cdecl *TtsWavFunc)(long*, HWND, char*);
typedef void (__cdecl *bstRelBufFunc)(long*);
typedef void (__cdecl *bstShutupFunc)(long*);
typedef void (__cdecl *bstCloseFunc)(long*);
typedef void (__cdecl *bstDestroyFunc)();
typedef void (__cdecl *bstSetParamsFunc)(long*, int, int);
typedef void (__cdecl *bstGetParamsFunc)(long*, int, int*&);
TtsWavFunc _TtsWav;
bstCreateFunc _bstCreate;
bstRelBufFunc _bstRelBuf;
bstShutupFunc _bstShutup;
bstDestroyFunc _bstDestroy;
bstCloseFunc _bstClose;
bstSetParamsFunc _bstSetParams;
bstGetParamsFunc _bstGetParams;

// Load library and setup related variables
HINSTANCE bstLib = LoadLibrary("B32_TTS.DLL"); // The speech synthesizer itself.
long *tts_handle = 0; // The handle where the synthesizer will reside.
char *prefix; // Prefix string for the voice parameters to reside.
char *prefix_rate; // Prefix string for speech rate
char *prefix_freq; // Prefix string for baseline pitch
int voice_select = 0; // Used for voice selection via hotkeys

// About and help text for the synthesizer to speak
char *version_text = "Best speak version one point oh one is running.";
char *about_text = "Best speak version one point oh one. Programmed and built on december fourth, twenty twenty four by Anthony C Bartman. This version of T T S was created by Berkeley Speech Technologies between 1985 and 1991.";
char *help_text = "Escape to exit. F1 for help. F2 to describe program credits. F3 to make quieter. F4 to make louder. F5 to speak. F6 to stop speaking. F7 to reset synthesizer. F8 to speak slower. F9 to speak faster. F10 to lower pitch. F11 to raise pitch. Control F11 to change voice backwards. Control F12 to change voice forwards. End of help.";
Binary file added src/BeSTspeak.aps
Binary file not shown.
64 changes: 64 additions & 0 deletions src/BeSTspeak.clw
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
; CLW file contains information for the MFC ClassWizard

[General Info]
Version=1
LastClass=
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "bestspeak.h"
LastPage=0

ClassCount=0

ResourceCount=2
Resource1=SPEAKACCEL (Neutral (Default))
Resource2=IDC_BESTSPEAK

[MNU:IDC_BESTSPEAK]
Type=1
Class=?
Command1=IDM_EXIT
Command2=ID_CONTROLS_DECREASEVOLUME
Command3=ID_CONTROLS_INCREASEVOLUME
Command4=ID_CONTROLS_SLOWERSPEED
Command5=ID_CONTROLS_FASTERSPEED
Command6=ID_CONTROLS_PITCHDOWN
Command7=ID_CONTROLS_PITCHUP
Command8=ID_CONTROLS_SPEAKTEXT
Command9=ID_CONTROLS_SHUTUP
Command10=ID_CONTROLS_RESET
Command11=ID_VOICES_FRED
Command12=ID_VOICES_SARAH
Command13=ID_VOICES_HARRY
Command14=ID_VOICES_MARTHA
Command15=ID_VOICES_TIM
Command16=ID_VOICES_DEXTER
Command17=ID_VOICES_ALIEN
Command18=ID_VOICES_KIT
Command19=ID_VOICES_WENDY
Command20=ID_VOICES_BRUNO
Command21=ID_VOICES_GRANNY
Command22=ID_VOICES_GHOST
Command23=ID_VOICES_PEEPER
Command24=ID_VOICES_DRACULA
Command25=IDM_HELP
Command26=IDM_ABOUT
CommandCount=26

[ACL:SPEAKACCEL (Neutral (Default))]
Type=1
Class=?
Command1=IDM_EXIT
Command2=IDM_HELP
Command3=ID_CONTROLS_PITCHDOWN
Command4=ID_CONTROLS_PITCHUP
Command5=IDM_ABOUT
Command6=ID_CONTROLS_DECREASEVOLUME
Command7=ID_CONTROLS_INCREASEVOLUME
Command8=ID_CONTROLS_SPEAKTEXT
Command9=ID_CONTROLS_SHUTUP
Command10=ID_CONTROLS_RESET
Command11=ID_CONTROLS_SLOWERSPEED
Command12=ID_CONTROLS_FASTERSPEED
CommandCount=12

Loading

0 comments on commit 7ba0612

Please sign in to comment.