Monthly Archives: April 2011

Net_DNS2 Version 1.1.0

Net_DNS2 version 1.1.0 is now available for download from the PEAR site, or can be installed using the “pear” command line client like:

pear install Net_DNS2

This release includes support for signing DNS updates and zone transfers (AXFR’s) using SIG(0), a private/public key authentication mechanism. The OpenSSL PHP extension is required for this feature to work.

// create a new Updater object
$u = new Net_DNS2_Updater('', array('nameservers' => array('')));

// add a SIG(0) to authenticate the request

// send the update rquest.

Support for the ATMA resource record- a method for publishing ATM addresses via DNS.

@      IN    SOA (
                                  1994041800   ; Serial  - date
                                  1800         ; Refresh - 30 minutes
                                  300          ; Retry   - 5 minutes
                                  604800       ; Expire  - 7 days
                                  3600 )       ; Minimum - 1 hour
       IN    NS
       IN    NS

salmon IN    ATMA   39.246f.000e7c9c031200010001.000012345678.00

And a new simple local cache system, using shared memory (using the PHP Shmop Extension), or using a flat file.

$r = new Net_DNS2_Resolver(array(

        'cache_type'    => 'shared',
        'cache_file'    => '/tmp/net_dns2.cache',
        'cache_size'    => 100000

Caching is disabled by default, and is only used for DNS queries (and not for updates), but can drastically improve query performance.

For more details, see the Net_DNS2 Google Code Page.

PERL Text-to-Speech using Cepstral voices (libswift)

I’ve released two new PERL modules:

Speech::Swift – a PERL interface to the Cepstral text-to-speech engine, Swift.


Speech::Swift::Simple – a simplified interface to Speech::Swift

The libswift shared library is required to support this code, which is included with every voice downloaded from Cepstral.

The reason for two releases, is that the Speech::Swift module exports all (well, almost all) the underlying functions of the library, while Speech::Swift::Simple has a simplified interface to generate speech in a just a few function calls.

For example:


use Speech::Swift::Simple;

# create a new Speech::Swift::Simple with one channel audio, and 16bit encoding.
my $s = new Speech::Swift::Simple(
         channels => 1,
         encoding => Speech::Swift::AUDIO_ENCODING_PCM16

# set the voice to use by name

# synthesize the text, and return it as a Speech::Swift::Simple::Wav object
my $wav = $s->generate("My name is allison");

# write the wav object to a file.

Or use the Speech::Swift library directly, for a more low-level interface.

The audio output is always as a WAV file; you can use one of the many audio modules available from CPAN, like Audio::GSM or Audio::MPEG, to re-encode the audio as needed.

Both PERL modules are available for download from CPAN now.

First Release of PHP Swift TTS Extension

I’m happy to announce the first release of the Swift Text-To-Speech PHP extension; the swift engine is the free TTS engine provided with any Cepstral TTS voice. A lot of Asterisk fans out there will recognize the Cepstral Allison voice, as the default voice for Asterisk installations.

The extension will only work on systems support by the Swift engine, and has only been tested (so far) on Linux (CentOS).

The extension will generate audio based on the text provided, and can be exported in several different audio formats, including:

  • PCM (RAW audio)
  • u-law / a-law (logarithmically encoded RAW audio)
  • WAV (RAW audio)
  • GSM (when compiled with the libgsm library)
  • MP3 (when compiled with the libmp3lame library)

A simple example on how to use this:

// create the new TTS object
$tts = new SwiftTTS();

// set a voice to use for generation

// generate text, and return a stream for the audio
$s = $tts->generate("hello my name is allison", SwiftTTS::FORMAT_WAV);
if ($s !== false)
        // write the stream contents to a file
        file_put_contents("audio.wav", $s);

For more details, and to download the current version, see the Google Code page.