mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-01 14:30:37 +00:00
Reduce buffer length to 50mS and don't override it when using eSpeak for audio.
This commit is contained in:
@@ -27,6 +27,8 @@ bug fixes:
|
|||||||
* Fix determining the voice directory when installing the 32-bit Windows
|
* Fix determining the voice directory when installing the 32-bit Windows
|
||||||
binaries on a 64-bit Windows system.
|
binaries on a 64-bit Windows system.
|
||||||
* Fix a regression with the saved parameter logic.
|
* Fix a regression with the saved parameter logic.
|
||||||
|
* Reduce the default buffer length to 50mS to improve latency.
|
||||||
|
* Don't override buffer length when using espeak-ng for audio.
|
||||||
|
|
||||||
updated languages:
|
updated languages:
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, cons
|
|||||||
output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
|
output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
|
||||||
|
|
||||||
buflength: The length in mS of sound buffers passed to the SynthCallback function.
|
buflength: The length in mS of sound buffers passed to the SynthCallback function.
|
||||||
Value=0 gives a default of 200mS.
|
Value=0 gives a default of 50mS.
|
||||||
This paramater is only used for AUDIO_OUTPUT_RETRIEVAL and AUDIO_OUTPUT_SYNCHRONOUS modes.
|
This paramater is only used for AUDIO_OUTPUT_RETRIEVAL and AUDIO_OUTPUT_SYNCHRONOUS modes.
|
||||||
|
|
||||||
path: The directory which contains the espeak-ng-data directory, or NULL for the default location.
|
path: The directory which contains the espeak-ng-data directory, or NULL for the default location.
|
||||||
|
|||||||
@@ -230,9 +230,9 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE
|
|||||||
my_audio = create_audio_device_object(device, "eSpeak", "Text-to-Speech");
|
my_audio = create_audio_device_object(device, "eSpeak", "Text-to-Speech");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// buflength is in mS, allocate 2 bytes per sample
|
// buffer_length is in mS, allocate 2 bytes per sample
|
||||||
if ((buffer_length == 0) || (output_mode & ENOUTPUT_MODE_SPEAK_AUDIO))
|
if (buffer_length == 0)
|
||||||
buffer_length = 200;
|
buffer_length = 50;
|
||||||
|
|
||||||
outbuf_size = (buffer_length * samplerate)/500;
|
outbuf_size = (buffer_length * samplerate)/500;
|
||||||
out_start = (unsigned char *)realloc(outbuf, outbuf_size);
|
out_start = (unsigned char *)realloc(outbuf, outbuf_size);
|
||||||
@@ -242,7 +242,7 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE
|
|||||||
outbuf = out_start;
|
outbuf = out_start;
|
||||||
|
|
||||||
// allocate space for event list. Allow 200 events per second.
|
// allocate space for event list. Allow 200 events per second.
|
||||||
// Add a constant to allow for very small buf_length
|
// Add a constant to allow for very small buffer_length
|
||||||
n_event_list = (buffer_length*200)/1000 + 20;
|
n_event_list = (buffer_length*200)/1000 + 20;
|
||||||
espeak_EVENT *new_event_list = (espeak_EVENT *)realloc(event_list, sizeof(espeak_EVENT) * n_event_list);
|
espeak_EVENT *new_event_list = (espeak_EVENT *)realloc(event_list, sizeof(espeak_EVENT) * n_event_list);
|
||||||
if (new_event_list == NULL)
|
if (new_event_list == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user