In the nearly two years since Stewart's posting ffmpeg has changed. Instead of -ab 32000 you should use -ar 8k. Here is the script I use to upload my Auto Attendant prompts:
#!/bin/bash
# Create with espeak -m -f <text file> -w <wave file>
# wave files for each synthesized Obihai prompt.
espeak -m -f welcome.txt -w welcome.wav
espeak -m -f main.txt -w main.wav
# Convert all of the prompts to g726 format using ffmpeg:
ffmpeg -y -i welcome.wav -acodec g726 -ar 8k user1.wav
ffmpeg -y -i noise_2sec.wav -acodec g726 -ar 8k user2.wav
ffmpeg -y -i main.wav -acodec g726 -ar 8k user3.wav
ffmpeg -y -i silence_1sec.wav -acodec g726 -ar 8k user4.wav
#
# Convert the user1.wav through up to user10.wav files
# into Okihai's upload format:
perl
aa.pl#
# Use the upload firmware feature of the Oki110.
# Specify the file useraa.dat created by the above
# perl script. After a reboot the new voices
# will be available.
#
For completeness, and to prevent it from being lost, here is Stuart's perl program referenced above. If this is whitespace-damaged you should download it from Stuart's original posting, a few replies ago in this thread.
#!/usr/bin/perl -w
use Digest::MD5 qw(md5);
$data = $names = '';
$filcnt = 0;
for $i (1 .. 10) {
next unless open(IN, "user$i.wav");
print "Reading user$i.wav\n";
binmode(IN);
unless (($cnt = read(IN, $rbuf, 60 * 4000)) > 1000 && $cnt < 60 * 4000
&& ($pos = index($rbuf, "data")) > 20 && $pos < 100) {
print "Invalid size or format -- ignoring file\n";
next;
}
$samps = ($cnt - $pos -
& ~7; # truncate to multiple of 8 bytes
$names .= pack("a8 N N N", "\%USER$i\%", length($data), 0, 0);
$data .= pack("N N", $samps, 0) . substr($rbuf, $pos + 8, $samps);
++$filcnt;
}
length($data) < 120 * 4000 or die "Total exceeds 120 seconds -- aborting\n";
$body = pack("N N", length($data), 0) . $data;
$body .= pack("N N", $filcnt, 0) . $names;
open(OUT, ">useraa.dat") or die "Can't write output file\n";
binmode(OUT);
print OUT "OBUSRLGE", pack("N", length($body)), md5($body), "\0\0\0\0", $body;
close(OUT) or die "Error writing output file\n";
print "Wrote useraa.dat\n";