TTS Project Journal

The Voice Sample Library

← 2: The Living LVS
→ 4: The Voice Sample Library

Other than defining the data type itself, the voice sample library serves chiefly to provide the basic utilities required to create, save, and load the native format of the TTS, the LVS:

The saving of an LVS is not done directly, but rather by placing its contents, per-byte, onto a string using cLVS(). The string is what is then written to a LVS or LCV file. For the latter format, an offset variable is provided for copying the LVS to an arbitrary point along the string. A flag is provided for specifying to only copy the header of an LVS, ignoring the data (helpful in debugging situations). The offset and header-only variables are optional. Besides what's in the struct, cLVS() also prepends the string LVS to the data block.

As for the contents of the function, or of rhLVS(), nothing much is of note except that they are hopelessly messy. cLVS() may have hope should I have time to work on it again. rdLVS() is a straightforward ifstream block read, as to be expected.

As wLVS()'s presence indicates, an LVS file can be created as a standalone container, outside of an LCV. Unless you want to reuse certain samples out of a voice I see little purpose in doing so at the moment. wLVS() consists of a simple ofstream write, taking the LVS header for its data size.

rdRawF() was mainly for testing I/O during the early stages of the project, though it may have future application. rdRaw(), however, is probably the most important function in the voice or voice sample libraries. It simply imports a raw data file and attaches it to an LVS's data pointer. Raw data, however, is presently the only format supported by the program, and will be until the project reaches release stage and time can be spent on support for popular formats.

One can use Audacity among other programs to export audio as a raw data file as required by the program. The following (untested, unsafe) script turns such a file into an LVS, showing off much of the library. Using encod and rate, one can use a function called calcSize() to peek at the file and derive the proper values for sdata and nsamp, which cuts manually entered information. Knowing the former value is required to budget memory for the load.

//Fill out data
LVS oblong;
oblong.cpres=0; //Not implemented
oblong.bhav=0; //Not implemented

//Load data
calcSize(oblong, "path/of/raw");
rdRaw(oblong, "path/of/raw");

//Here you can do stuff with your brand new LVS!

//Save data
//_hsVS measures the bytesize of an LVS header
char outoutout[_hsVS+oblong.sdata];
cLVS(oblong, outoutout);
wLVS(oblong, outoutout, "path/of/file.lvs");

Fully understanding this script requires some familiarity with the language and its syntax. For the most part, however, you should be able to glean the purpose of the program by noting the order of the functions and their purpose as stated above, as well as the reappearance of any variable names from the LVS struct definition. Establishing this layer of functionality already puts us well on the road to a full voice file.

~LCK, 5/14/2010

*As explained in a previous entry, a character array, or string is used because of characters' unambiguous size.

← 2: The Living LVS
→ 4: The Voice Sample Library

All content © Casady Roy Kemper (a.k.a. Loki Clock) and protected by the Digital Millenium Copyright Act and the Berne Convention, unless otherwise stated or unless alternative authorship is indicated without explicit accompanying copyright claims on the part of Loki Clock.