Class DecTalk

The main class for the DECtalk Text-To-Speech system.

Hierarchy

  • any
    • DecTalk

Constructors

  • Create a new instance of the DECtalk Text-To-Speech system.

    Returns DecTalk

Accessors

  • get attenuationVolume(): number
  • Returns the current setting of the attenuation volume.

    Returns number

    Comment

    The current setting of the attenuation volume is returned even if the attenuation volume change has not yet occurred. This may occur while setting attenuationVolume without the () call. The attenuation volume change occurs on clause boundaries.

  • set attenuationVolume(value): void
  • Sets the attenuation volume of the text-to-speech system.

    Parameters

    • value: number

    Returns void

    Comment

    The attenuation volume change is not effective until the next phrase boundary. All the queued audio encountered before the phrase boundary is unaffected.

  • get inputCharacterCount(): number
  • Returns a count of characters that the text-to-speech system is currently processing.

    Returns number

  • get isSpeaking(): boolean
  • Returns if the Text-To-Speech system is currently speaking.

    Returns boolean

    Comment

    Has no meaning if the application is sending speech to a wave file or sending speech to memory.

  • get rate(): number
  • Returns the current setting of the speaking rate.

    Returns number

    Comment

    The current setting of the speaking rate is returned even if the speaking rate change has not yet occurred. This may occur while setting rate without the () call. The speaking-rate change occurs on clause boundaries.

  • set rate(value): void
  • Sets the text-to-speech speaking rate.

    Parameters

    • value: number

    Returns void

    Comment

    The speaking rate change is not effective until the next phrase boundary. All the queued audio encountered before the phrase boundary is unaffected.

  • get speaker(): Speaker
  • Returns the value of the identifier for the last voice that has spoken.

    Returns Speaker

    Comment

    Note that even after a setting speaker, speaker returns the value for the previous speaking voice until the new voice actually has spoken.

  • set speaker(value): void
  • Sets the voice of the speaker the text-to-speech system will use.

    Parameters

    Returns void

    Comment

    The change in speaking voice is not effective until the next phrase boundary. All queued audio encountered before the phrase boundary is unaffected.

  • get volume(): number
  • Returns the current setting of the volume.

    Returns number

    Comment

    The current setting of the volume is returned even if the volume change has not yet occurred. This may occur while setting volume without the () call. The volume change occurs on clause boundaries.

  • set volume(value): void
  • Sets the volume of the text-to-speech system.

    Parameters

    • value: number

    Returns void

    Comment

    The volume change is not effective until the next phrase boundary. All the queued audio encountered before the phrase boundary is unaffected.

  • get waveOutDeviceID(): number
  • Returns the current wave output device ID.

    Returns number

  • get version(): {
        dTalkVersion: number;
        dapiMajor: number;
        dapiMinor: number;
        dllVersion: number;
        dtMajor: number;
        dtMinor: number;
        language: string;
        structVersion: number;
        version: string;
        versionString: string;
    }
  • Returns information about the currently running version of DECtalk Software.

    Returns {
        dTalkVersion: number;
        dapiMajor: number;
        dapiMinor: number;
        dllVersion: number;
        dtMajor: number;
        dtMinor: number;
        language: string;
        structVersion: number;
        version: string;
        versionString: string;
    }

    • Readonly dTalkVersion: number
    • Readonly dapiMajor: number
    • Readonly dapiMinor: number
    • Readonly dllVersion: number
    • Readonly dtMajor: number
    • Readonly dtMinor: number
    • Readonly language: string
    • Readonly structVersion: number
    • Readonly version: string
    • Readonly versionString: string

    Static

Methods

  • Add a buffer to the memory list.

    Parameters

    • buf: TTSBuffer

      The buffer to be added to the memory list.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalParam - Invalid parameter.
    • Error - Output to memory not enabled or unable to create a system object.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    The application must call () before calling (). The memory buffer is passed using the TTSBuffer class.

    The text-to-speech system returns the buffer to the application when the memory buffer, phoneme array, or index mark array is full or when force was used in the () call.

    See

  • Return the Text-To-Speech system to it's normal state. Speech samples will be routed to the audio device (if audio output was enabled at startup).

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • Error - Output to memory not enabled or unable to create a system object.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    () must be called before calling ().

    See

    openInMemory

  • Closes the log file opened by the () function.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • Error - Failure to wait for pending speech, unable to close the output file, or no output file is open.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    This call closes an open log file, even if it was opened with the Log in-line command.

    The application must call () before calling ().

    See

    openLogFile

  • Close the Text-To-Speech Wave File.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • Error - Failure to wait for pending speech, unable to update wave file header, or unable to close the wave file.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    The application must call () before calling ().

    See

    openWaveFile

  • Loads a user-defined pronunciation dictionary into the text-to-speech system.

    Parameters

    • filename: string

      The name of the user dictionary file to be loaded.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • NoMem - Unable to allocate memory for dictionary.
    • InvalParam - Dictionary file not found or an invalid dictionary file name.
    • Error - Illegal dictionary format or a dictionary is already loaded.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    This call loads a dictionary created by the windict or userdict applet. Any previously loaded user dictionary must be unloaded before loading a new user dictionary. Note that the text-to-speech system will automatically load a user dictionary, user.dic, at startup if it exists in the home directory.

    See

    unloadUserDictionary

  • Causes the text-to-speech system to enter into the speech-to-memory mode. This mode indicates that the speech samples are to be written into memory buffers rather than sent to an audio device each time () is called. The () call supplies the text-to-speech system with the memory buffers that it needs. The text-to-speech system remains in the speech-to-memory mode until () is called.

    Parameters

    • format: WaveFormat

      Determines the wave file audio sample format

    Returns MMSysError

    The value will be zero if the function is successful. return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalParam - An invalid parameter or illegal wave output format was passed.
    • NoMem - Unable to allocate memory.
    • Error - Illegal output state.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    The text-to-speech system is in the speech-to-memory mode after successfully invoking this call. The memory buffer is passed using the class TTSBuffer.

    The text-to-speech system returns the buffer to the application when the memory buffer, phoneme array, or index mark array is full or when force was used in the () call.

    The startup function must be called to start the text-to-speech system before calling this function.

    () automatically resumes audio output if the text-to-speech system is in a paused state by a previously issued () call.

    See

  • Causes the specified log file to be opened and the text-to-speech sytem to enter into the log-file mode. This mode indicates that the speech samples are to be written as text, phonemes, or syllables into the log file each time () is called. The phonemes and syllables are written using the arpabet alphabet. The text-to-speech system remains in the log-file mode until () is called.

    Parameters

    • filename: string

      The name of the log file to be created.

    • Optional logType: LogType

      Specifies one or more of the type of output.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalParam - An invalid parameter was passed.
    • NoMem - Unable to allocate memory.
    • Allocated - A log file is already open.
    • Error - Unable to open the output file.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    If more than one of the dwFlags are passed, then the logged output is mixed in an unpredictable fashion. If there is already a log file open, this call returns an error. The Log command has no effect when a log file is already open.

    The startup function must be called to start the text-to-speech system before calling this function.

    () automatically resumes audio output if the text-to-speech system is in a paused state by a previously issued () call.

    See

  • Causes the specified wave file to be opened and the text-to-speech system to enter into wave-file mode. This mode indicates that the speech samples are to be written in wave format into the wave file each time () is called. The text-to-speech system remains in the wave-file mode until () is called.

    Parameters

    • filename: string

      The name of the wave file to be created.

    • format: WaveFormat

      Determines one or more of the wave file audio sample format.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalParam - An invalid parameter or an illegal wave output format was passed.
    • NoMem - Memory allocation error.
    • Allocated - A wave file is already open.
    • Error - Unable to open the wave file or unable to write to the wave file.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    This call automatically resumes audio output if the text-to-speech system is in a paused state by a previously issued () call.

    The startup function must be called to start the text-to-speech system before calling ().

    See

  • Pauses text-to-speech audio output.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalHandle - The specified device handle is invalid. The system is not speaking or the text-to-speech handle is invalid.

    Comment

    This call only affects the audio output and has no effect when writing log files, wave files, or when using the speech-to-memory capability of the text-to-speech system.

    If the text-to-speech system owns the audio device (i.e. OwnAudioDevice was specified in the startup function), then it remains paused until one of the following is called:

    • openInMemory
    • openLogFile
    • ppenWaveFile
    • resume
    • sync
    • If the text-to-speech system does not own the audio device (i.e. OwnAudioDevice was NOT specified in the startup function) and () is called while the system is speaking, it will remain paused until the system has completed speaking.
    • In this case, the wave output device is released when () is called. It will also be released if (), (), (), or () is called AND the system has completed speaking.
    • Note that the () call will NOT resume audio output if the text-to-speech system has been paused by the () call.

    See

  • Cancels all audio output and deletes any text from the Text-To-Speech systems text queue. All pending index marks are discarded.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • NoMem - Unable to allocate memory.
    • Error - Unable to flush the system.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    The () call flushes all previously queued text and stops all audio output. If the () call has enabled outputting the speech samples to memory, then all queued memory buffers will be returned to the calling application. If the reset flag is on and the text-to-speech system is in one of its special modes (log-file, wave-file or speech-to-memory mode), then all files will be closed and the text-to-speech system is returned to the startup state.

    () should be called before (). Failing to do this in a situation where the synthesizer is busy may result in a deadlock.

    See

  • Resumes text-to-speech output after it was paused by calling ().

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalHandle - The system was not paused or the text-to-speech handle was invalid.

    Comment

    This call only affects the audio output and has no effect when writing log files, writing wave files, or when writing speech samples to memory.

    See

    pause

  • Cause the current buffer to be returned even if it not yet full. The buffer may in fact be empty.

    Returns TTSBuffer

    The buffer returned by the Text-To-Speech system.

  • Shuts down the text-to-speech system and frees all system resources used by the text-to-speech system.

    Returns MMSysError

    This value is zero if shutdown was successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    This call is called when you close an application. Any user-defined dictionaries, which were previously loaded, are automatically unloaded. All previously queued text is discarded and the text-to-speech system will immediately stop speaking.

    See

    startup

  • Qqueues to the text-to-speech system. While in startup state, speech samples are routed to the audio device or ignored, depending on whether the DoNotUseAudioDevice flag is set in the deviceOptions parameter of the startup function. If the text-to-speech system is in one of its special modes (wave-file, log-file, or speech-to-memory modes), the speech samples are handled accordingly.

    Parameters

    • text: string | string[]

      The text to be spoken.

    • Optional force: boolean = false

    Returns Promise<MMSysError>

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • NoMem - Unable to allocate memory.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Async

    Comment

    The speaker, speaking rate, and volume can also be changed in the text string by inserting in-line commands as shown in the following example:

    [:name paul] I am Paul. [:nb] I am Betty. [:volume set 50] The volume has been set to 50% of the maximum level. [:ra 120] I am speaking at 120 words per minute.

    See

  • Qqueues to the text-to-speech system. While in startup state, speech samples are routed to the audio device or ignored, depending on whether the DoNotUseAudioDevice flag is set in the deviceOptions parameter of the startup function. If the text-to-speech system is in one of its special modes (wave-file, log-file, or speech-to-memory modes), the speech samples are handled accordingly.

    Parameters

    • text: string | string[]

      The text to be spoken.

    • Optional force: boolean = false

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • NoMem - Unable to allocate memory.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    The speaker, speaking rate, and volume can also be changed in the text string by inserting in-line commands as shown in the following example:

    [:name paul] I am Paul. [:nb] I am Betty. [:volume set 50] The volume has been set to 50% of the maximum level. [:ra 120] I am speaking at 120 words per minute.

    See

  • Initializes the text-to-speech system; defines the callback routine; and loads the main and user pronunciation dictionaries.

    Parameters

    • Optional deviceID: number

      Wave out device ID number. WaveMapper may be used here if the device ID number is unknown.

    • Optional deviceManagement: DeviceManagement = DeviceManagement.OwnAudioDevice

      Specifies how the wave output device is managed.

    • Optional cb: TTSCallback

    Returns MMSysError

    This value is zero if initialization was successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • NoDriver - No wave out device driver present.
    • BadDeviceID - Device ID out of range.
    • NoMem - Unable to allocate memory.
    • Error - Dictionary not found.
    • InvalParam - Invalid param for the load dictionary.

    Comment

    If the callback procedure is defined, then the calling application will be called via the callback routine when a buffer is filled while in speech-to-memory mode, an error occurs, or an index mark is encountered.

    The default parameters are:

    • Language: American English.
    • Speaking rate: 200 words per minute.
    • Speaker: Paul.

    See

  • Will block until all previously queued text has been spoken. This function will automatically resume audio if the Text - To - Speech system has been paused by the () function.

    Returns Promise<MMSysError>

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • Error - Unable to complete queued text.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Async

    Comment

    This call automatically resumes audio output if the text-to-speech system is in a paused state by a previously issued () call.

    See

    pause

  • Will block until all previously queued text has been spoken. This function will automatically resume audio if the Text-To-Speech system has been paused by the () function.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • Error - Unable to complete queued text.
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    This call automatically resumes audio output if the text-to-speech system is in a paused state by a previously issued () call.

    See

    pause

  • Speaks a single letter as quickly as possible, aborting any previously queued speech. This will be somewhat slower if () has been called since the last () or () call.

    Parameters

    • text: string

      The character to be spoken.

    Returns void

    Comment

    This function should only be called only when the application is synthesizing directly to an audio device (not to memory or to a file).
    `

  • Unloads the currently loaded user dictionary.

    Returns MMSysError

    The value will be zero if the function is successful. The return value will be one of the following constants:

    • NoError - Normal successful completion (zero).
    • InvalHandle - The Text-To-Speech handle is invalid.

    Comment

    A user dictionary is created using the User Dictionary Build tool.

    See

    loadUserDictionary

  • Closes an instance for an installed language and attempts to unload it from the DecTalk Multi-Language (ML) engine.

    Parameters

    • lang: string

      The language to be closed.

    Returns boolean

    True if the language was closed successfully.

    Static

    Comments

    Call this application per thread using the selected language. When a thread returns true, the language is freed and can be uninstalled or upgraded. A return of true may be a bad pass of the lang variable or more instances. If there are more instances, the call frees the current instance and returns a false flag. After calling (), assume the language handle is no longer valid.

    See

  • Retrieves information about what languages are available.

    Returns 0 | {
        languages: {
            code: string;
            name: string;
        }[];
        multiLang: boolean;
    }

    An object contains language data, and zero on error

    Static

    Comment

    () returns the default language in the registry as the first language of the array of entries returned by langs.

    See

  • Lists the current capabilities of the DECtalk Software by returning the class TTSCaps.

    Returns TTSCaps

    The capabilities of the DECtalk Software.

    Static

    Comment

    Information returned in the TTSCaps class includes languages and proper-name pronunciation support, sample rate, minimum and maximum speaking rate, number of predefined speaking voices, character-set supported, and version number.

  • Selects a loaded language for a program thread.

    Parameters

    • lang: number

      The language header to be selected.

    Returns boolean

    True if the language was selected successfully.

    Static

  • Checks for an installed language and loads it into the DecTalk Multi-Language (ML) engine.

    Parameters

    • lang: string

      The language to be loaded.

    Returns number

    A handle to the loaded language on success or sets the bit TTSLangError on failure. If the TTSLangError bit is set, the return can equal one of two values: TTSNotSupported for the application is not running DECtalk ML and TTSNotAvailable for the language selected is not installed.

    Static

    Comments

    This call must be called before a language may be selected and opened in a multi-language application.

Generated using TypeDoc