--- trunk/mbrola.pl 2006/08/05 10:54:32 1 +++ trunk/mbrola.pl 2006/08/05 12:13:01 2 @@ -214,6 +214,8 @@ my ($g,$f) = ('',''); + my $last_c = ''; + foreach my $i ( 0 .. $#chars ) { my $c = $chars[$i]; @@ -266,6 +268,21 @@ } + # same last chars? double duration + if ($last_c eq $c) { + $pho[ $#pho ]->{dur}->[0] *= 2; + next; + } + + # fixup sequences that need special handling + if (defined($recovery->{ $last_c . $c })) { + push @pho, { + char => '_', + dur => [ $silence->{word} * $speed ], + }; + } + + $last_c = $c; push @pho, { char => $c, dur => \@dur, @@ -280,15 +297,8 @@ my $out; - my $last_c = ''; - foreach my $p (@pho) { - if (defined($recovery->{ $last_c . $p->{char} })) { - $out .= '_ ' . ( $silence->{word} * $speed ) . "\n"; - } $out .= $p->{char} . ' ' . join(' ', map { $_ * $speed } @{ $p->{dur} }) . "\n"; - - $last_c = $p->{char}; } return ($out, $g, $f);