change text2wave and soundmanager paths
[bookreader.git] / BookReaderIA / datanode / BookReaderGetTTS.php
1 <?
2
3 /*
4 Copyright(c)2008-2010 Internet Archive. Software license AGPL version 3.
5
6 This file is part of BookReader.
7
8     BookReader is free software: you can redistribute it and/or modify
9     it under the terms of the GNU Affero General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12
13     BookReader is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU Affero General Public License for more details.
17
18     You should have received a copy of the GNU Affero General Public License
19     along with BookReader.  If not, see <http://www.gnu.org/licenses/>.
20     
21     The BookReader source is hosted at http://github.com/openlibrary/bookreader/
22 */
23
24 $useMP3 = true;
25 if ('.ogg' == $_GET['format']) {
26     $useMP3 = false;
27 }
28
29 $cmd = 'echo ' . escapeshellarg($_GET['string']);
30 $cmd .= ' | /petabox/sw/bin/text2wave';
31 if ($useMP3) {
32     header('Content-Type: audio/mpeg');
33     $cmd .= ' |ffmpeg -i - -f mp3 -';
34 } else {
35     header('Content-Type: application/ogg');
36     $cmd .= ' |oggenc --quiet -';
37 }
38
39 passthru($cmd);
40 ?>