SayBuf helps the Say class to render text-to-speech as soundfiles and buffers, in order to use play them as sound sources within SC.
Rendering say-events to soundfiles is on average 15-40x faster than realtime (tested on a 2014 Macbook Pro), so with short text fragments, writing soundfiles and reading them into buffers is fast enough for near-realtime use.
SayBuf has two schemes for preparing buffers: By default, it uses a ring of 100 buffers that get used round-robin. This leaves the most recent buffers loaded, and is recommended.
Creating and freeing buffers individually is also supported.
the dir where SayBuf writes temporary soundfiles
free a buffer and delete its soundfile. By default, this waits for buffer duration * 1.1 + server latency before freeing the buffer.
clear all temp soundfiles from dir
the dictionary of recently created buffers
the ring of reserved buffers that get re-used when using roundRobin buffers.
prepare a buffer for a sayEvent
sayEvent |
an event as used by Say, e.g. |
server |
the server on which to render the buffer |
action |
the action to perform when buffer is ready |
// TODO: measure all prepare variants and recommend best ones. // e.g. try with SayBuf.prepare in fork and non-fork versions.