zaf / asterisk-googletts

Asterisk AGI script that uses Google's translate text to speech service.
GNU General Public License v2.0
214 stars 125 forks source link

The samplerate seems to be unreliable #5

Closed coaxial closed 11 years ago

coaxial commented 11 years ago

Hi,

The sample rate is set at 8000 in my googletts.agi script, yet when calling the script from the dialplan, the console has this to say:

[Jan  4 01:30:45] WARNING[20433][C-0000000f]: format_wav.c:112 check_header_fmt: Unexpected frequency mismatch 16000 (expecting 8000)
[Jan  4 01:30:45] WARNING[20433][C-0000000f]: file.c:395 fn_wrapper: Unable to open format wav

Or even

[Jan  4 01:25:12] WARNING[20195][C-0000000d]: format_wav.c:112 check_header_fmt: Unexpected frequency mismatch 22050 (expecting 8000)
[Jan  4 01:25:12] WARNING[20195][C-0000000d]: file.c:395 fn_wrapper: Unable to open format wav

core show version Asterisk 11.1.0 built by abuild @ build22 on a x86_64 running Linux on 2012-12-21 23:25:47 UTC

cat /proc/version Linux version 3.4.11-2.16-default (geeko@buildhost) (gcc version 4.7.1 20120723 [gcc-4_7-branch revision 189773](SUSE Linux) ) #1 SMP Wed Sep 26 17:05:00 UTC 2012 (259fc87)

perl -v This is perl 5, version 16, subversion 0 (v5.16.0) built for x86_64-linux-thread-multi

sox --version sox: SoX v14.4.0

mpg123 --version mpg123 1.14.4

zaf commented 11 years ago

There seem to be some problems with the detection function. As a temporary fix try setting the sample rate in a fixed value which disables the auto-detection. To do so just edit line 63 of the script and set the variable $samplerate to the proper value depending on the codes you are using (usually 8000).

coaxial commented 11 years ago

Right, it seems there was a mixup between the latest version and the one I was using. I thought it was the latest version but it wasn't, maybe I screwed up when pulling the file from your repo.

Tried again with the latest version and it's fine. Sorry about that!