SayBuf:
Filter:
say (extension) | Speech Synthesis

SayBuf
ExtensionExtension

prepare text-to-speech in buffers

Description

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.

Class Methods

.dir

the dir where SayBuf writes temporary soundfiles

.freeBuf

free a buffer and delete its soundfile. By default, this waits for buffer duration * 1.1 + server latency before freeing the buffer.

.clearDir

clear all temp soundfiles from dir

.bufs

the dictionary of recently created buffers

.bufring

the ring of reserved buffers that get re-used when using roundRobin buffers.

.prepare

prepare a buffer for a sayEvent

Arguments:

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

Examples

More on Preparing Speech to Buffers

// TODO: measure all prepare variants and recommend best ones. // e.g. try with SayBuf.prepare in fork and non-fork versions.