Importing and exporting voice

If you want to import prerecorded digitized voice into Blueworx Voice Response, you need to convert the voice data to Blueworx Voice Response voice elements, using the CA_Import_Voice() subroutine. To obtain voice data in a standard format from a series of voice elements, use the CA_Export_Voice() subroutine. These subroutines provide functions similar to the import and export features of the Voice Segment Editor, but from a command-line program instead of from the user interface. For more information about the Voice Segment Editor and creating voice tables, see the Blueworx Voice Response for AIX: Application Development using State Tables information.

It is not necessary to use these routines if you are simply archiving voice elements from Blueworx Voice Response, or transferring them between Blueworx Voice Response systems. You only need to convert from voice element format if you are transferring voice data between Blueworx Voice Response and a different system.

The voice conversion and compression can be time-consuming, so you should leave the voice data in Blueworx Voice Response voice elements whenever possible. When you have converted your voice data to Blueworx Voice Response voice elements, you can add them to the Blueworx Voice Response database using, for example, the CA_Create_Segment() subroutine.

Voice data stored in the Blueworx Voice Response database may be compressed or uncompressed. It is always in 8-bit samples, sampled at 8000 Hz. If uncompressed and you are using T1 signaling protocols, it is in μ-law format, or if you are using E1 signaling protocols, it is in A-law format.

If the voice data you need to import is in a different format, CA_Import_Voice() will convert it to an acceptable form and compress it if necessary. Your voice data can have any sampling rate between 8000 Hz and 44000 Hz, a sample width of 8 or 16 bits, and may be in A-law, μ-law, or PCM formats. CA_Export_Voice() converts Blueworx Voice Response voice elements to the same set of external formats, decompressing them if necessary. When calculating the size of the output buffer required for CA_Import_Voice() and CA_Export_Voice(), you need to take into account the sampling rate, sample width, and compression of the data. For more detail, see EXT_VOICE_ST, and INT_VOICE_ST.

For example, when you export from Blueworx Voice Response, which holds 0.2 seconds of voice per element, to an external format that is 8-bit, 8000 Hz, each element required an output buffer of 1600 bytes, apart from the last element which might not require a whole 1600 bytes.

Use the CA_Get_Element_Info() subroutine to find out the size of output buffer required for a list of voice elements.

Use the CA_Get_Element_Count() subroutine to calculate the number of Blueworx Voice Response voice elements needed to hold input data.