A code example of a diphone speech synthesizer for speaking dates. It is some of the early development code for the Talk Calendar project. It has been developed using C and is a Linux console application.
Words are formed as sequences of elementary speech units. A phoneme is the smallest unit of sound that distinguishes one word from another word and there are 44 phonemes in the English language. A diphone is a sound unit composed of two adjacent partial phonemes i.e. the second half of the first phoneme and the first half of the second phoneme. The synthesizer uses a set of pre-recorded diphone sound samples and concatenates diphone audio to produce speech output for a given text input.
If phoneme one is represented as p1=[1 2 3] and phoneme two p2=[4 5 6] then the diphone derived from p1 and p2 is d1-2 =[2 3 4 5]. Phonemes are the "steady state" of a sound while diphones capture coarticulation which is the way the mouth moves from the middle of one sound to the middle of the next. The most complex part of speech is the transition between sounds. Recording the transition (i.e. the diphone) and then "gluing" diphones together at the stable centres of the phonemes produces much more natural speech than just playing phonemes back-to-back. With 44 phonemes there would theoretically be 44 squared diphone combinations (=1936). However, many combinations never occur in natural speech or are very rare and so typically a diphone count of around 1600 is used with standard English.
The voice used by the diphone speech synthesizer is derivative work based on the diphone collection created by Alan W Black and Kevin Lenzo which is free for use for any purpose (commercial or otherwise) and subject to the light restrictions detailed here. There is information about recording your own diphones here and in the speech synthesis lecture by Professor Alan W Black here.
The C source code for the diphone speech synthesizer for reading out dates is provided in the src directory and has been developed using Debian Trixie.
To build the diphone speech synthesizer from source you need the gcc compiler and the Make build system. You need to install the following package.
sudo apt install build-essential
The package:
sudo apt install alsa-utils
is needed but should be installed by default.
Use the MAKEFILE to compile the code. Just run "make" inside the source code folder.
make
To run the diphone speech synthesizer called talker from the terminal use
./talker
This will read out the current date.
The code has been developed from scratch and is not dependent on any other audio processing libraries and provides a working C code example of a diphone speech synthesizer which may be useful for educational purposes. It compiles and runs and reads out a date. I have developed a talking calendar called Talk Calendar which uses a more advanced diphone concatenation speech synthesizer.
SemVer is used for versioning. The version number has the form 0.0.0 representing major, minor and bug fix changes.
- Alan Crispin Github
Active.