Low-level C bindings to the Pico TTS engine.
ttspico for a high-level Rust wrapper.
Adds a mapping pair ('voiceName', 'resourceName') to the voice definition. Multiple mapping pairs can added to a voice defintion. When calling 'pico_newEngine' with 'voiceName', the corresponding resources from the mappings will be used with that engine.
Creates a voice definition. Resources must be added to the created voice with 'pico_addResourceToVoiceDefinition' before using the voice in 'pico_newEngine'. It is an error to create a voice definition with a previously defined voice name. In that case use 'pico_releaseVoiceName' first.
Disposes a Pico engine and releases all memory it occupied. The engine handle becomes invalid.
Gets speech data from the engine. Every time this function is called, the engine performs, within a short time slot, a small amount of processing its input text, and then gives control back to the calling application. Ie. after calling 'pico_putTextUtf8' (incl. a final embedded '\0'), this function needs to be called repeatedly till 'outBytesReceived' bytes are returned in 'outBuffer'. The type of data returned in 'outBuffer' (e.g. 8 or 16 bit PCM samples) is returned in 'outDataType' and depends on the lingware resources. Possible 'outDataType' values are listed in picodefs.h (PICO_DATA_*). This function returns PICO_STEP_BUSY while processing input and producing speech output. Once all data is returned and there is no more input text available in the Pico text input buffer, PICO_STEP_IDLE is returned. All other function return values indicate a system error.
Returns in 'outMessage' a description of the engine status or of an error that occurred with the most recently called engine-level API function.
Returns in 'outMessage' a description of a warning that occurred with the most recently called engine-level API function. 'warningIndex' must be in the range 0..N-1 where N is the number of warnings returned by 'pico_getNrEngineWarnings'. 'outCode' returns the warning as an integer code (cf. PICO_WARN_*).
Returns in 'outNrOfWarnings' the number of warnings that occurred with the most recently called engine-level API function.
Returns in 'outNrOfWarnings' the number of warnings that occurred with the most recently called system-level API function.
Gets the unique resource name of a loaded resource
Returns in 'outMessage' a description of the system status or of an error that occurred with the most recently called system-level API function.
Returns in 'outMessage' a description of a warning that occurred with the most recently called system-level API function. 'warningIndex' must be in the range 0..N-1 where N is the number of warnings returned by 'pico_getNrSystemWarnings'. 'outCode' returns the warning as an integer code (cf. PICO_WARN_*).
Initializes the Pico system and returns its handle in 'outSystem'. 'memory' and 'size' define the location and maximum size of memory in number of bytes that the Pico system will use. The minimum size required depends on the number of engines and configurations of lingware to be used. No additional memory will be allocated by the Pico system. This function must be called before any other API function is called. It may only be called once (e.g. at application startup), unless a call to 'pico_terminate'.
Loads a resource file into the Pico system. The number of resource files loaded in parallel is limited by PICO_MAX_NUM_RESOURCES. Loading of a resource file may be done at any time (even in parallel to a running engine doing TTS synthesis), but with the general restriction that functions taking a system handle as their first argument must be called in a mutually exclusive fashion. The loaded resource will be available only to engines started after the resource is fully loaded, i.e., not to engines currently running.
Creates and initializes a new Pico engine instance and returns its handle in 'outEngine'. Only one instance per system is currently possible.
Puts text 'text' encoded in UTF8 into the Pico text input buffer. 'textSize' is the maximum size in number of bytes accessible in 'text'. The input text may also contain text-input commands to change, for example, speed or pitch of the resulting speech output. The number of bytes actually copied to the Pico text input buffer is returned in 'outBytesPut'. Sentence ends are automatically detected. '\0' characters may be embedded in 'text' to finish text input or separate independently to be synthesized text parts from each other. Repeatedly calling 'pico_getData' will result in the content of the text input buffer to be synthesized (up to the last sentence end or '\0' character detected). To empty the internal buffers without finishing synthesis, use the function 'pico_resetEngine'.
Releases the voice definition 'voiceName'.
Resets the engine and clears all engine-internal buffers, in particular text input and signal data output buffers. 'resetMode' is one of 'PICO_RESET_SOFT', to be used to flush the engine, or 'PICO_RESET_FULL', to reset the engine after an engine error.
Terminates the Pico system. Lingware resources still being loaded are unloaded automatically. The memory area provided to Pico in 'pico_initialize' is released. The system handle becomes invalid. It is not allowed to call this function as long as Pico engine instances are existing. No API function may be called after this function, except for 'pico_initialize', which reinitializes the system.
Unloads a resource file from the Pico system. If no engine uses the resource file, the resource is removed immediately and its associated internal memory is released, otherwise PICO_EXC_RESOURCE_BUSY is returned.