NAME

Speech::Rsynth -- Perl interface to 'librsynth' Klatt-style speech synthesis C library.

SYNOPSIS

use Speech::Rsynth;
{
# Constructor
$rs = Speech::Rsynth->new(%cfg);         # create a new synth object

# Synthesis
$rs->start;                              # start synthesis
$rs->say_string("test 1 2 3");           # synthesize string
$rs->say_file(STDIN);                    # synthesize a whole file
$rs->stop;                               # stop synthesis (synchronizes)

# Configuration
%cfg = $rs->configure;                   # get all synth configuration data
$rs->configure(%cfg);                    # set (partial) synth configuration

# Accessors : Flags
$bool = $rs->use_audio;  $rs->use_audio($bool);   # do/don't send to audio device
$bool = $rs->running;    $rs->running($bool);     # get/set active-flag

# Accessors : General
$level = $rs->verbose;   $rs->verbose($level);    # get/set verbosity level
$bool = $rs->help_only;  $rs->help_only($bool);   # get/set help-flag

# Accessors: Audio Properties
$hertz = $rs->samp_rate; $rs->samp_rate($hertz);  # get/set sample-rate

# Accessors: Audio Filenames
$file = $rs->dev_file;    $rs->dev_file($file);     # get/set audio device filename
$file = $rs->linear_file; $rs->linear_file($file);  # get/set raw linear filename
$file = $rs->au_file;     $rs->au_file($file);      # get/set Sun/NeXT filename

# Accessors: File Descriptors
$fd = $rs->dev_fd;        $rs->dev_fd($fd);         # get/set audio device fd
$fd = $rs->linear_fd;     $rs->linear_fd($fd);      # get/set raw linear fd
$fd = $rs->au_fd;         $rs->au_fd($fd);          # get/set Sun/NeXT fd

# Accessors: Klatt Guts
$ms = $rs->mSec_per_Frame;   $rs->mSec_per_Frame($ms);  # milliseconds per frame
$bool = $rs->impulse;        $rs->impulse($bool);       # impulse glottal source
$n = $rs->casc;              $rs->casc($n);             # number cascade formants
$n = $rs->klatt_f0_flutter;  $rs->klatt_f0_flutter($n); # F0 flutter
$dB = $rs->klatt_tilt_db;    $rs->klatt_tilt_db($dB);   # tilt dB
$hz = $rs->klatt_f0_hz;      $rs->klatt_f0_hz($hz);     # F0 base frequency

# Accessors: Holmes
$n = $rs->speed;             $rs->speed($n);            # speed (1.0 is 'normal')
$f = $rs->frac;              $rs->frac($f);             # parameter filter 'fraction'
$file = $rs->par_name;       $rs->par_name($file);      # parameter filename for plot
$file = $rs->jsru_name;      $rs->jsru_name($file);     # plot file for alternate synth (JSRU)

# Accessors: Dictionary
$path = $rs->dict_path;      $rs->dict_path($path);     # full path to GDBM dictionary file

# Accessors: low-level
$flags = $rs->flags;         $rs->flags($flags);        # get/set flags mask

DESCRIPTION

Speech::Rsynth is a Perl OO interface to my adaptation of Nick Ing-Simmons' "rsynth" speech synthesizer package, itself based on Jon Iles' implementation of a Klatt formant synthesizer. It currently provides only basic Text-to-Speech (TTS) capabilities, with output to file(s) of several formats, as well as directly to an audio device.

Currently tested only under linux.

EXPORTS

A number constants may be exported; they are listed here by tag.

  • :const_nsynth

    Constants from 'nsynth.h'.

    ALL_PARALLEL
    CASCADE_PARALLEL
    IMPULSIVE
    NATURAL
    NPAR
    PI
  • :const_rflags

    Constants from 'rstruct.h' -- can be used for the 'flags' accessor/keyword.

    RSY_RUNNING
    RSY_USEAUDIO
  • :const_aufile

    Constants from 'aufile.c'.

    SUN_HDRSIZE
    SUN_LIN_16
    SUN_LIN_8
    SUN_MAGIC
    SUN_ULAW
    SUN_UNSPEC
  • :const

    Exports the contents of all of the above 'const_*' tags.

METHODS

Constructor

  • new(%args)

    Create and return a new Speech::Rsynth object, initializing it according to the keyword-argments in '%args'. See "Accessors" for a list of valid keyword arguments for %args.

Synthesis

  • start()

    Start the synthesizer. This method must be called first if the 'say_*' methods are to produce any useful result.

  • say_string($string)

    Synthesize speech from the text string $string, which may contain literal phone-strings enclosed in square brackets. See the librsynth documentation for details on recognized phone encodings.

  • say_file(FILEHANDLE)

    Synthesize speech from the text from FILEHANDLE, which should be a Perl filehandle open for reading.

  • stop()

    Stops the synthesizer and synchronizes all its data files. Note that these files will be overwritten if the synthesizer is subsequently re-started.

Configuration

  • configure(%cfg)

    With arguments, sets the object fields named by the keyword arguments to the indicated values. With or without arguments, returns a hash containing all accessible field values indexed by field names.

    See "Accessors" for details on accessible fields.

Accessors

The following is a list of accessible fields of Speech::Rsynth objects. Fields may be read out individually for a Speech::Rsynth object $rs by calling $rs->NAME(), where NAME is the field name, and may be set individually by calling $rs->NAME($new_value). The field names also function as keyword arguments to the new() and configure() methods, described above.

* use_audio

Type: boolean

Whether or not to output directly to the audio device. Default=no.

* running

Type=boolean

Whether or not to start() the synth immediately. Default=no.

* verbose

Type: integer

Verbosity level. Default=0.

* help_only

Type: boolean

Whether or not only help messages should be printed. Default=0.

* samp_rate

Type: integer

Sample rate in Hz. Default=8000.

* dev_file

Type: string

Audio device filename. Default="/dev/dsp".

* linear_file

Type: string

Filename for raw linear output. Default=undef (none).

* au_file

Type: string

Filename for Sun/NeXT output. Default=undef (none).

* dev_fd

Type: integer

File descriptor for audio device. Default=-1 (none).

* linear_fd

Type: integer

File descriptor for raw linear file. Default=-1 (none).

* au_fd

File descriptor for Sun/NeXT file Default=-1 (none).

* mSec_per_Frame

Type: integer

milliseconds per frame. Default=10.

* impulse

Type: boolean

impulse glottal source. Default=0.

* casc

Type: integer

number cascade formants. Default=0.

* klatt_f0_flutter

Type: integer

F0 flutter. Default=0.

* klatt_tilt_db

Type: integer

tilt dB. Default=10.

* klatt_f0_hz

Type: integer

F0 base frequency. Default=1330.

* speed

Type: integer

speed (1.0 is 'normal'). Default=1.

* frac

Type: float

parameter filter 'fraction'. Default=1.0.

* par_name

Type: string

parameter filename for plot. Default=undef (none).

* jsru_name

Type: string

plot file for alternate synth (JSRU). Default=undef (none).

* dict_path

Type: string

full path to GDBM dictionary file. Default=undef (none).

* flags

Type: integer (mask)

mask of synth status flags. default=0.

BUGS AND LIMITATIONS

There are still some globals left in librsynth which may interfere with multiple synths running simultaneously.

The filename fields should disappear, and the fd fields should be replaced by something perl-friendly, like filehandles.

More control over synthesis-time parameters would be real nice.

Probably many, many more.

ACKNOWLEDGEMENTS

perl by Larry Wall.

"say" program and original rsynth package by Nick Ng-Simmons.

AUTHOR

Bryan Jurish <moocow@ling.uni-potsdam.de>

SEE ALSO

perl(1). say(1).

1 POD Error

The following errors were encountered while parsing the POD:

Around line 489:

You can't have =items (as at line 496) unless the first thing after the =over is an =item