Updated and cleaned up old libs and refactored speech api

This commit is contained in:
Ziver Koc 2017-03-07 18:11:13 +01:00
parent 25b15e3fd2
commit 0c14bbb6a3
68 changed files with 26 additions and 5017 deletions

View file

@ -1,74 +0,0 @@
MARY Software User Agreement
11 April 2011
MARY is licensed under the following terms.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Applicable Licenses
MARY is built upon a number of other open source technologies and products.
Here is a list of those products with links to their licenses.
hts_engine: the HMM-based speech synthesis code in MARY TTS is based on HTS, ported to Java by DFKI. The original HTS can be obtained from
http://hts-engine.sourceforge.net/ -- it is released under the New and
Simplified BSD License.
freetts: MARY uses code from FreeTTS (http://freetts.sf.net) for various
processing modules and as the source of one method for waveform synthesis.
FreeTTS is licensed under the (BSD-style) FreeTTS license, see
doc/licenses/freetts-license.txt.
JTok: The JTok tokenizer from http://heartofgold.dfki.de is distributed
under the GNU Lesser General Public License, see http://www.gnu.org or
doc/licenses/LGPL.txt.
jsresources.jar: A few utility classes from http://www.jsresources.org
are distributed under the terms of the jsresources license, see
doc/licenses/jsresources-license.txt.
log4j: MARY uses log4j (http://logging.apache.org/log4j) as a logging
mechanism. log4j is distributed under the Apache Software License, see
http://www.apache.org or doc/licenses/apache-software-license.txt
JUnit: For unit testing of the java source, mary uses JUnit
(http://junit.org). JUnit is licensed under the Common Public License, see
http://junit.org or doc/licenses/CPL.txt.
java-diff: A java diff implementation from http://www.incava.org/projects/java-diff for input-output-comparisons in the
Mary Expert Interface. java-diff is licensed under the GNU Lesser General
Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
fast-md5: A fast md5 checksum implementation from http://www.twmacinta.com/myjava/fast_md5.php
used for computing checksums after downloading voices. fast-md5 is licensed under
the GNU Lesser General Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
JavaOpenAIR: MARY can optionally be used as an OpenAIR component,
building on the JavaOpenAIR reference implementation from
http://www.mindmakers.org, which is licensed under the
(BSD-style) JavaOpenAIR license, see doc/licenses/JavaOpenAIR-license.txt
(files concerned: JavaOpenAIR.jar)
mwdumper: A tool for extracting sets of pages from a MediaWiki dump file.
mwdumper is MIT-style like licensed, see http://www.mediawiki.org/wiki/Mwdumper
and for the license http://en.wikipedia.org/wiki/MIT_License.
(files concerned: mwdumper-2008-04-13.jar)
sgt: The Scientific Graphics Toolkit (sgt) is provided by the NOAA/PMEL/EPIC group (see http://www.epic.noaa.gov/java/sgt/) under the BSD-style EPIC license, see doc/licenses/epic-license.txt.
IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS
AND CONDITIONS PRIOR TO USE OF THIS CONTENT.

View file

@ -1,10 +0,0 @@
#!/bin/bash
##########################################################################
# MARY TTS client
##########################################################################
# Set the Mary base installation directory in an environment variable:
BINDIR="`dirname "$0"`"
export MARY_BASE="`(cd "$BINDIR"/.. ; pwd)`"
java -showversion -ea -Dserver.host=localhost -Dserver.port=59125 -jar "$MARY_BASE/lib/marytts-client-5.1.2-jar-with-dependencies.jar"

View file

@ -1,10 +0,0 @@
@echo off
set BINDIR=%~dp0
call :RESOLVE "%BINDIR%\.." MARY_BASE
java -showversion -ea -Dserver.host=localhost -Dserver.port=59125 -jar "%MARY_BASE%\lib\marytts-client-5.1.2-jar-with-dependencies.jar"
goto :EOF
:RESOLVE
set %2=%~f1
goto :EOF

View file

@ -1,5 +0,0 @@
#!/bin/sh
BINDIR="`dirname "$0"`"
export MARY_BASE="`(cd "$BINDIR"/.. ; pwd)`"
java -showversion -ea -Dmary.base="$MARY_BASE" $* -cp "$MARY_BASE/lib/*" marytts.tools.install.InstallerGUI

View file

@ -1,9 +0,0 @@
@echo off
set BINDIR=%~dp0
call :RESOLVE "%BINDIR%\.." MARY_BASE
java -showversion -ea -Dmary.base="%MARY_BASE%" -cp ".;%MARY_BASE%\lib\*" marytts.tools.install.InstallerGUI
goto :EOF
:RESOLVE
set %2=%~f1
goto :EOF

View file

@ -1,11 +0,0 @@
#!/bin/bash
##########################################################################
# MARY TTS server
##########################################################################
# Set the Mary base installation directory in an environment variable:
BINDIR="`dirname "$0"`"
export MARY_BASE="`(cd "$BINDIR"/.. ; pwd)`"
java -showversion -ea -Xms40m -Xmx1g -cp "$MARY_BASE/lib/*" -Dmary.base="$MARY_BASE" $* marytts.server.Mary

View file

@ -1,14 +0,0 @@
@echo off
rem Set the Mary base installation directory in an environment variable:
set BINDIR=%~dp0
call :RESOLVE "%BINDIR%\.." MARY_BASE
set CLASSPATH=".;%MARY_BASE%\lib\*"
java -showversion -ea -Xms40m -Xmx1g -cp %CLASSPATH% "-Dmary.base=%MARY_BASE%" marytts.server.Mary
goto :EOF
:RESOLVE
set %2=%~f1
goto :EOF

View file

@ -1,367 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket, sys, types, getopt
languageNames = {'de':'German',
'en':'English',
'en_US':'US English',
'tib':'Tibetan'}
class MaryClient:
specificationVersion = "0.1"
"""Python implementation of a MARY TTS client"""
def __init__( self, host="cling.dfki.uni-sb.de", port=59125, profile=False, quiet=False ):
self.host = host
self.port = port
self.profile = profile
self.quiet = quiet
self.allVoices = None # array of Voice objects
self.voicesByLocaleMap = {} # Map locale strings to arrays of Voice objects
self.allDataTypes = None # array of DataType objects
self.inputDataTypes = None # array of DataType objects
self.outputDataTypes = None # array of DataType objects
self.serverExampleTexts = {}
self.voiceExampleTexts = {}
self.serverVersionInfo = u''
if not self.quiet:
sys.stderr.write( "MARY TTS Python Client %s\n" % ( self.specificationVersion ) )
try:
info = self.getServerVersionInfo()
except:
sys.stderr.write( "Problem connecting to mary server at %s:%i\n" % ( self.host, self.port ) )
raise
sys.stderr.write( "Connected to %s:%i, " % ( self.host, self.port ) )
sys.stderr.write( info )
sys.stderr.write( '\n' )
def __getServerInfo( self, request="", marySocket=None ):
"""Get answer to request from mary server. Returns a list of unicode strings,
each representing a line without the line break.
"""
closeSocket = False
if marySocket is None:
closeSocket = True
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
marySocket.connect( ( self.host, self.port ) )
assert isinstance(marySocket, socket.SocketType)
maryFile = marySocket.makefile( 'rwb', 1 ) # read-write, line-buffered
maryFile.write( unicode( request+"\n" ).encode( 'utf-8' ) )
result = []
while True:
got = unicode( maryFile.readline().strip(), 'utf-8' )
# read until end of file or an empty line is read:
if not got: break
result.append(got)
if closeSocket:
marySocket.close()
return result
def getServerVersionInfo( self ):
"Get version info from server. Returns a unicode string"
if self.serverVersionInfo == u'':
# need to get it from server
self.serverVersionInfo = u'\n'.join(self.__getServerInfo("MARY VERSION"))
return self.serverVersionInfo
def getAllDataTypes(self, locale=None):
"""Obtain a list of all data types known to the server. If the information is not
yet available, the server is queried. This is optional information
which is not required for the normal operation of the client, but
may help to avoid incompatibilities.
Returns an array of DataType objects
"""
if self.allDataTypes is None:
self.__fillDataTypes()
assert self.allDataTypes is not None and len( self.allDataTypes ) > 0
if locale is None:
return self.allDataTypes
else:
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
return [d for d in self.allDataTypes if d.locale is None or d.locale == locale]
def getInputDataTypes(self,locale=None):
"""Obtain a list of input data types known to the server. If the information is not
yet available, the server is queried. This is optional information
which is not required for the normal operation of the client, but
may help to avoid incompatibilities.
Returns an arry of DataType objects
"""
if self.inputDataTypes is None:
self.__fillDataTypes()
assert self.inputDataTypes is not None and len( self.inputDataTypes ) > 0
if locale is None:
return self.inputDataTypes
else:
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
return [d for d in self.inputDataTypes if d.locale is None or d.locale == locale]
def getOutputDataTypes(self, locale=None):
"""Obtain a list of output data types known to the server. If the information is not
yet available, the server is queried. This is optional information
which is not required for the normal operation of the client, but
may help to avoid incompatibilities.
Returns an arry of DataType objects
"""
if self.outputDataTypes is None:
self.__fillDataTypes()
assert self.outputDataTypes is not None and len( self.outputDataTypes ) > 0
if locale is None:
return self.outputDataTypes
else:
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
return [d for d in self.outputDataTypes if d.locale is None or d.locale == locale]
def __fillDataTypes( self ):
self.allDataTypes = []
self.inputDataTypes = []
self.outputDataTypes = []
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
marySocket.connect( ( self.host, self.port ) )
# Expect a variable number of lines of the kind
# RAWMARYXML INPUT OUTPUT
# TEXT_DE LOCALE=de INPUT
# AUDIO OUTPUT
typeStrings = self.__getServerInfo( "MARY LIST DATATYPES", marySocket )
if not typeStrings or len(typeStrings) == 0:
raise IOError( "Could not get list of data types from Mary server" )
marySocket.close()
for typeString in typeStrings:
parts = typeString.split()
if len( parts ) == 0:
continue
name = parts[0]
isInputType = False
isOutputType = False
locale = None
for part in parts[1:]:
if part[:7] == "LOCALE=":
locale = part[7:]
elif part == "INPUT":
isInputType = True
elif part == "OUTPUT":
isOutputType = True
dt = DataType( name, locale, isInputType, isOutputType )
self.allDataTypes.append( dt )
if dt.isInputType:
self.inputDataTypes.append( dt )
if dt.isOutputType:
self.outputDataTypes.append( dt )
def getVoices( self, locale=None ):
"""Obtain a list of voices known to the server. If the information is not
yet available, the server is queried. This is optional information
which is not required for the normal operation of the client, but
may help to avoid incompatibilities.
Returns an array of Voice objects
"""
if self.allVoices is None:
self.__fillVoices()
assert self.allVoices is not None and len( self.allVoices ) > 0
if locale is None:
return self.allVoices
else:
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
if self.voicesByLocaleMap.has_key(locale):
return self.voicesByLocaleMap[locale]
else:
raise Exception("No voices for locale '%s'" % (locale))
def __fillVoices( self ):
self.allVoices = []
self.voicesByLocaleMap = {}
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
marySocket.connect( ( self.host, self.port ) )
# Expect a variable number of lines of the kind
# de7 de female
# us2 en male
# dfki-stadium-emo de male limited
voiceStrings = self.__getServerInfo( "MARY LIST VOICES", marySocket )
if not voiceStrings or len(voiceStrings) == 0:
raise IOError( "Could not get list of voices from Mary server" )
marySocket.close()
for voiceString in voiceStrings:
parts = voiceString.split()
if len( parts ) < 3:
continue
name = parts[0]
locale = parts[1]
gender = parts[2]
domain = None
if len( parts ) > 3:
domain = parts[3]
voice = Voice( name, locale, gender, domain )
self.allVoices.append( voice )
localeVoices = None
if self.voicesByLocaleMap.has_key( locale ):
localeVoices = self.voicesByLocaleMap[locale]
else:
localeVoices = []
self.voicesByLocaleMap[locale] = localeVoices
localeVoices.append( voice )
def getGeneralDomainVoices( self, locale=None ):
"""Obtain a list of general domain voices known to the server. If the information is not
yet available, the server is queried. This is optional information
which is not required for the normal operation of the client, but
may help to avoid incompatibilities.
Returns an array of Voice objects
"""
return [v for v in self.getVoices( locale ) if not v.isLimitedDomain]
def getLimitedDomainVoices( self, locale=None ):
"""Obtain a list of limited domain voices known to the server. If the information is not
yet available, the server is queried. This is optional information
which is not required for the normal operation of the client, but
may help to avoid incompatibilities.
Returns an array of Voice objects
"""
return [v for v in self.getVoices( locale ) if v.isLimitedDomain]
def getAvailableLanguages(self):
""" Check available voices and return a list of tuples (abbrev, name)
representing the available languages -- e.g. [('en', 'English'),('de', 'German')].
"""
if self.allVoices is None:
self.__fillVoices()
assert self.allVoices is not None and len( self.allVoices ) > 0
languages = []
for l in self.voicesByLocaleMap.keys():
if languageNames.has_key(l):
languages.append((l,languageNames[l]))
else:
languages.append((l, l))
return languages
def getServerExampleText( self, dataType ):
"""Request an example text for a given data type from the server.
dataType the string representation of the data type,
e.g. "RAWMARYXML". This is optional information
which is not required for the normal operation of the client, but
may help to avoid incompatibilities."""
if not self.serverExampleTexts.has_key( dataType ):
exampleTexts = self.__getServerInfo( "MARY EXAMPLETEXT %s" % ( dataType ) )
if not exampleTexts or len(exampleTexts) == 0:
raise IOError( "Could not get example text for type '%s' from Mary server" % (dataType))
exampleText = u'\n'.join(exampleTexts)
self.serverExampleTexts[dataType] = exampleText
return self.serverExampleTexts[dataType]
def process( self, input, inputType, outputType, audioType=None, defaultVoiceName=None, output=sys.stdout ):
assert type( input ) in types.StringTypes
assert type( inputType ) in types.StringTypes
assert type( outputType ) in types.StringTypes
assert audioType is None or type( audioType ) in types.StringTypes
assert defaultVoiceName is None or type( defaultVoiceName ) in types.StringTypes
assert callable( getattr( output, 'write' ) )
if type( input ) != types.UnicodeType:
input = unicode( input, 'utf-8' )
maryInfoSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
maryInfoSocket.connect( ( self.host, self.port ) )
assert type( maryInfoSocket ) is socket.SocketType
maryInfo = maryInfoSocket.makefile( 'rwb', 1 ) # read-write, line-buffered
maryInfo.write( unicode( "MARY IN=%s OUT=%s" % ( inputType, outputType ), 'utf-8' ) )
if audioType:
maryInfo.write( unicode( " AUDIO=%s" % ( audioType ), 'utf-8' ) )
if defaultVoiceName:
maryInfo.write( unicode( " VOICE=%s" % ( defaultVoiceName ), 'utf-8' ) )
maryInfo.write( "\r\n" )
# Receive a request ID:
id = maryInfo.readline()
maryDataSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
maryDataSocket.connect( ( self.host, self.port ) )
assert type( maryDataSocket ) is socket.SocketType
maryDataSocket.sendall( id ) # includes newline
maryDataSocket.sendall( input.encode( 'utf-8' ) )
maryDataSocket.shutdown( 1 ) # shutdown writing
# Set mary info socket to non-blocking, so we only read somthing
# if there is something to read:
maryInfoSocket.setblocking( 0 )
while True:
try:
err = maryInfoSocket.recv( 8192 )
if err: sys.stderr.write( err )
except:
pass
got = maryDataSocket.recv( 8192 )
if not got: break
output.write( got )
maryInfoSocket.setblocking( 1 )
while True:
err = maryInfoSocket.recv( 8192 )
if not err: break
sys.stderr.write( err )
################ data representation classes ##################
class DataType:
def __init__( self, name, locale=None, isInputType=False, isOutputType=False ):
self.name = name
self.locale = locale
self.isInputType = isInputType
self.isOutputType = isOutputType
def isTextType( self ):
return self.name != "AUDIO"
class Voice:
def __init__( self, name, locale, gender, domain="general" ):
self.name = name
self.locale = locale
self.gender = gender
self.domain = domain
if not domain or domain == "general":
self.isLimitedDomain = False
else:
self.isLimitedDomain = True
def __str__(self):
if languageNames.has_key(self.locale):
langName = languageNames[self.locale]
else:
langName = self.locale
if self.isLimitedDomain:
return "%s (%s, %s %s)" % (self.name, self.domain, langName, self.gender)
else:
return "%s (%s %s)" % (self.name, langName, self.gender)
##################### Main #########################
if __name__ == '__main__':
serverHost = "cling.dfki.uni-sb.de"
serverPort = 59125
inputType = "TEXT"
outputType = "AUDIO"
audioType = "WAVE"
defaultVoice = None
inputEncoding = 'utf-8'
( options, rest ) = getopt.getopt( sys.argv[1:], '', \
['server.host=', 'server.port=', 'input.type=', 'output.type=', \
'audio.type=', 'voice.default=', 'input.encoding='] )
for ( option, value ) in options:
if option == '--server.host': serverHost = value
elif option == '--server.port': serverPort = int( value )
elif option == '--input.type': inputType = value
elif option == '--output.type': outputType = value
elif option == '--audio.type': audioType = value
elif option == '--voice.default': defaultVoice = value
elif option == '--input.encoding': inputEncoding = value
if len( rest )>0: # have input file
inputFile = file( rest[0] )
else:
inputFile = sys.stdin
input = unicode( ''.join( inputFile.readlines() ), inputEncoding )
if len( rest )>1: # also have output file
outputFile = file( rest[1] )
else:
outputFile = sys.stdout
maryClient = MaryClient( serverHost, serverPort )
maryClient.process( input, inputType, outputType, audioType, defaultVoice, outputFile )

View file

@ -1,96 +0,0 @@
/**
* Copyright 2000-2006 DFKI GmbH.
* All Rights Reserved. Use is subject to license terms.
*
* Permission is hereby granted, free of charge, to use and distribute
* this software and its documentation without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of this work, and to
* permit persons to whom this work is furnished to do so, subject to
* the following conditions:
*
* 1. The code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* 2. Any modifications must be clearly marked as such.
* 3. Original authors' names are not deleted.
* 4. The authors' names are not used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
import marytts.client.MaryClient;
import marytts.util.data.audio.AudioPlayer;
import marytts.util.http.Address;
import javax.sound.sampled.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.UnknownHostException;
/**
* A demo class illustrating how to use the MaryClient class.
* This will connect to a MARY server, version 4.x.
* It requires maryclient.jar from MARY 4.0.
* This works transparently with MARY servers in both http and socket server mode.
*
* Compile this as follows:
* <code>javac -cp maryclient.jar MaryClientUser.java</code>
*
* And run as:
* <code>java -cp .:maryclient.jar MaryClientUser</code>
*
* @author marc
*
*/
public class MaryClientUser {
public static void main(String[] args)
throws IOException, UnknownHostException, UnsupportedAudioFileException,
InterruptedException
{
String serverHost = System.getProperty("server.host", "cling.dfki.uni-sb.de");
int serverPort = Integer.getInteger("server.port", 59125).intValue();
MaryClient mary = MaryClient.getMaryClient(new Address(serverHost, serverPort));
String text = "Willkommen in der Welt der Sprachsynthese!";
// If the given locale is not supported by the server, it returns
// an ambigous exception: "Problem processing the data."
String locale = "de"; // or US English (en-US), Telugu (te), Turkish (tr), ...
String inputType = "TEXT";
String outputType = "AUDIO";
String audioType = "WAVE";
String defaultVoiceName = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
mary.process(text, inputType, outputType, locale, audioType, defaultVoiceName, baos);
// The byte array constitutes a full wave file, including the headers.
// And now, play the audio data:
AudioInputStream ais = AudioSystem.getAudioInputStream(
new ByteArrayInputStream(baos.toByteArray()));
LineListener lineListener = new LineListener() {
public void update(LineEvent event) {
if (event.getType() == LineEvent.Type.START) {
System.err.println("Audio started playing.");
} else if (event.getType() == LineEvent.Type.STOP) {
System.err.println("Audio stopped playing.");
} else if (event.getType() == LineEvent.Type.OPEN) {
System.err.println("Audio line opened.");
} else if (event.getType() == LineEvent.Type.CLOSE) {
System.err.println("Audio line closed.");
}
}
};
AudioPlayer ap = new AudioPlayer(ais, lineListener);
ap.start();
}
}

View file

@ -1,45 +0,0 @@
##########################################################################
# Copyright (C) 2000-2006 DFKI GmbH.
# All rights reserved. Use is subject to license terms.
#
# Permission is hereby granted, free of charge, to use and distribute
# this software and its documentation without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of this work, and to
# permit persons to whom this work is furnished to do so, subject to
# the following conditions:
#
# 1. The code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
# 2. Any modifications must be clearly marked as such.
# 3. Original authors' names are not deleted.
# 4. The authors' names are not used to endorse or promote products
# derived from this software without specific prior written
# permission.
#
# DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
# CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
# THIS SOFTWARE.
##########################################################################
CC=g++
CFLAGS=-Wall -w -O3 -g
ICUDIR=/usr/local/icu
ICULIBS=-Wl,-R,$(ICUDIR)/lib -L$(ICUDIR)/lib -licuuc -licui18n -ldl
all: MaryDemo
MaryDemo: MaryClient.o MaryDemo.o
$(CC) $(CFLAGS) *.o -o MaryDemo $(LIBS)
%.o: %.cc
$(CC) $(CFLAGS) $(RFLAGS) -o $@ -c $<
clean:
rm -rf *.o ./MaryDemo

View file

@ -1,277 +0,0 @@
/**
* Copyright 2000-2006 DFKI GmbH.
* All Rights Reserved. Use is subject to license terms.
*
* Permission is hereby granted, free of charge, to use and distribute
* this software and its documentation without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of this work, and to
* permit persons to whom this work is furnished to do so, subject to
* the following conditions:
*
* 1. The code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* 2. Any modifications must be clearly marked as such.
* 3. Original authors' names are not deleted.
* 4. The authors' names are not used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
#include <netdb.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include "MaryClient.h"
using namespace std;
/**
* A C++ implementation of a simple client to the MARY TTS system.
* result: an empty string serving as the container for the output.
* It will return text or audio data; text data will be encoded as UTF-8.
* inputText: the UTF-8 encoded text (or XML document) to send as a request
* maryInFormat: the input type of the data in inputText, e.g. TEXT
* maryOutFormat: the output type to produce, e.g. MBROLA, AUDIO
* locale: the language of the input, e.g. EN-US, DE
* audioType: for AUDIO output, the type of audio data to produce,
* e.g. WAVE or MP3.
* voice: the voice to be used, e.g. cmu-slt-hsmm, bits3.
* effects: the list of effects to be generated.
* return value: 0 on success, negative on failure.
*/
int
MaryClient::maryQuery( int server_port,
string server_host,
string& result,
string inputText,
string maryInFormat,
string maryOutFormat,
string locale,
string audioType,
string voice,
string effects ) {
// prepare the request
string query = "MARY";
query += " IN=" + maryInFormat;
query += " OUT=" + maryOutFormat;
query += " LOCALE=" + locale; // remove this line, if using an older version than MARY 4.0
query += " AUDIO=" + audioType;
query += " VOICE=" + voice;
if (effects != "") {
query += " EFFECTS=" + effects;
}
query += "\012\015";
//cout << "Constructed query: " << query << endl;
// declare connection stuff
struct sockaddr_in maryServer;
struct sockaddr_in maryClient;
struct hostent* hostInfo;
// declare variables
int maryInfoSocket;
int maryDataSocket;
// set configuration parameters
// get host information
hostInfo = gethostbyname (server_host.c_str());
if (hostInfo == NULL)
{
return -2;
}
// create a tcp connection to the mary server
maryInfoSocket = socket (AF_INET, SOCK_STREAM, 0);
// verify that the socket could be opened successfully
if (maryInfoSocket == -1)
{
return -2;
}
else
// autoflush stdout, bind and connect
{
maryClient.sin_family = AF_INET;
maryClient.sin_port = htons (0);
maryClient.sin_addr.s_addr = INADDR_ANY;
int status = bind (maryInfoSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
if (status != 0)
{
return -2;
}
maryServer.sin_family = AF_INET;
maryServer.sin_port = htons (server_port);
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
status = connect (maryInfoSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
if (status != 0)
{
return -2;
}
}
// send request to the Mary server
if (send (maryInfoSocket, query.c_str (), query.size (), 0) == -1)
{
return -2;
}
// receive the request id
char id [32] = "";
if (recv (maryInfoSocket, id, 32, 0) == -1)
{
return -2;
}
//cout << "Read id: " << id << endl;
// create a tcp connection to the mary server
maryDataSocket = socket (AF_INET, SOCK_STREAM, 0);
// verify that the socket could be opened successfully
if (maryDataSocket == -1)
{
return -2;
}
else
// autoflush stdout, bind and connect
{
maryClient.sin_family = AF_INET;
maryClient.sin_port = htons (0);
maryClient.sin_addr.s_addr = INADDR_ANY;
int status = bind (maryDataSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
if (status != 0)
{
return -2;
}
maryServer.sin_family = AF_INET;
maryServer.sin_port = htons (server_port);
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
status = connect (maryDataSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
if (status != 0)
{
return -2;
}
}
// send the request id to the Mary server
if (send (maryDataSocket, id, strlen (id), 0) == -1)
{
return -2;
}
//cout << "Sending request: " << inputText << endl;
// send the query to the Mary server
if (send (maryDataSocket, inputText.c_str (), inputText.size (), 0) == -1)
{
return -2;
}
if (send (maryDataSocket, "\012\015", 2, 0) == -1)
{
return -2;
}
// shutdown data socket
shutdown (maryDataSocket, 1);
//cout << "Reading result" << endl;
unsigned int total_bytes = 0;
int recv_bytes = 0;
char data [1024] = "";
result [0] = '\0';
// receive the request result
do
{
data [0] = '\0';
recv_bytes = recv (maryDataSocket, data, 1024, 0);
if (recv_bytes == -1)
{
return -2;
}
else if (recv_bytes > 0)
{
//cout << "("<<recv_bytes<<")" << endl;
total_bytes += recv_bytes;
data [recv_bytes] = '\0';
if (maryOutFormat == "AUDIO")
{
for (unsigned int i=0; i<recv_bytes; i++)
{
result += data [i];
}
}
else
{
result += data;
}
}
} while (recv_bytes != 0);
if (result.size () != total_bytes)
{
cerr << "error: total bytes received != result bytes!" << endl;
cerr << " total bytes received = " << total_bytes << endl;
cerr << " result bytes = " << result.size () << endl;
}
// receive the request error
do
{
data [0] = '\0';
recv_bytes = recv (maryInfoSocket, data, 1024, 0);
if (recv_bytes == -1)
{
return -2;
}
else if (recv_bytes > 0)
{
cerr << endl << "Mary error code: " << data << endl;
return -3;
}
} while (recv_bytes != 0);
// close all open sockets
close (maryInfoSocket);
close (maryDataSocket);
return 0;
}

View file

@ -1,290 +0,0 @@
/**
* Copyright 2000-2006 DFKI GmbH.
* All Rights Reserved. Use is subject to license terms.
*
* Permission is hereby granted, free of charge, to use and distribute
* this software and its documentation without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of this work, and to
* permit persons to whom this work is furnished to do so, subject to
* the following conditions:
*
* 1. The code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* 2. Any modifications must be clearly marked as such.
* 3. Original authors' names are not deleted.
* 4. The authors' names are not used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
#ifdef _WIN32
// use compiler option -L/<path to>/libwsock32.a
#include <winsock.h>
#else
#include <netdb.h>
#endif
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include "MaryClient.h"
using namespace std;
/**
* A C++ implementation of a simple client to the MARY TTS system.
* result: an empty string serving as the container for the output.
* It will return text or audio data; text data will be encoded as UTF-8.
* inputText: the UTF-8 encoded text (or XML document) to send as a request
* maryInFormat: the input type of the data in inputText, e.g. TEXT
* maryOutFormat: the output type to produce, e.g. MBROLA, AUDIO
* locale: the language of the input, e.g. EN-US, DE
* audioType: for AUDIO output, the type of audio data to produce,
* e.g. WAVE or MP3.
* voice: the voice to be used, e.g. cmu-slt-hsmm, bits3.
* effects: the list of effects to be generated.
* return value: 0 on success, negative on failure.
*/
int
MaryClient::maryQuery( int server_port,
string server_host,
string& result,
string inputText,
string maryInFormat,
string maryOutFormat,
string locale,
string audioType,
string voice,
string effects ) {
// prepare the request
string query = "MARY";
query += " IN=" + maryInFormat;
query += " OUT=" + maryOutFormat;
query += " LOCALE=" + locale; // remove this line, if using an older version than MARY 4.0
query += " AUDIO=" + audioType;
query += " VOICE=" + voice;
if (effects != "") {
query += " EFFECTS=" + effects;
}
query += "\012\015";
//cout << "Constructed query: " << query << endl;
// declare connection stuff
struct sockaddr_in maryServer;
struct sockaddr_in maryClient;
struct hostent* hostInfo;
// declare variables
int maryInfoSocket;
int maryDataSocket;
// set configuration parameters
// get host information
hostInfo = gethostbyname (server_host.c_str());
if (hostInfo == NULL)
{
return -2;
}
// create a tcp connection to the mary server
maryInfoSocket = socket (AF_INET, SOCK_STREAM, 0);
// verify that the socket could be opened successfully
if (maryInfoSocket == -1)
{
return -2;
}
else
// autoflush stdout, bind and connect
{
maryClient.sin_family = AF_INET;
maryClient.sin_port = htons (0);
maryClient.sin_addr.s_addr = INADDR_ANY;
int status = bind (maryInfoSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
if (status != 0)
{
return -2;
}
maryServer.sin_family = AF_INET;
maryServer.sin_port = htons (server_port);
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
status = connect (maryInfoSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
if (status != 0)
{
return -2;
}
}
// send request to the Mary server
if (send (maryInfoSocket, query.c_str (), query.size (), 0) == -1)
{
return -2;
}
// receive the request id
char id [32] = "";
if (recv (maryInfoSocket, id, 32, 0) == -1)
{
return -2;
}
//cout << "Read id: " << id << endl;
// create a tcp connection to the mary server
maryDataSocket = socket (AF_INET, SOCK_STREAM, 0);
// verify that the socket could be opened successfully
if (maryDataSocket == -1)
{
return -2;
}
else
// autoflush stdout, bind and connect
{
maryClient.sin_family = AF_INET;
maryClient.sin_port = htons (0);
maryClient.sin_addr.s_addr = INADDR_ANY;
int status = bind (maryDataSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
if (status != 0)
{
return -2;
}
maryServer.sin_family = AF_INET;
maryServer.sin_port = htons (server_port);
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
status = connect (maryDataSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
if (status != 0)
{
return -2;
}
}
// send the request id to the Mary server
if (send (maryDataSocket, id, strlen (id), 0) == -1)
{
return -2;
}
//cout << "Sending request: " << inputText << endl;
// send the query to the Mary server
if (send (maryDataSocket, inputText.c_str (), inputText.size (), 0) == -1)
{
return -2;
}
if (send (maryDataSocket, "\012\015", 2, 0) == -1)
{
return -2;
}
// shutdown data socket
shutdown (maryDataSocket, 1);
//cout << "Reading result" << endl;
unsigned int total_bytes = 0;
int recv_bytes = 0;
char data [1024] = "";
result [0] = '\0';
// receive the request result
do
{
data [0] = '\0';
recv_bytes = recv (maryDataSocket, data, 1024, 0);
if (recv_bytes == -1)
{
return -2;
}
else if (recv_bytes > 0)
{
//cout << "("<<recv_bytes<<")" << endl;
total_bytes += recv_bytes;
data [recv_bytes] = '\0';
if (maryOutFormat == "AUDIO")
{
for (unsigned int i=0; i<recv_bytes; i++)
{
result += data [i];
}
}
else
{
result += data;
}
}
} while (recv_bytes != 0);
if (result.size () != total_bytes)
{
cerr << "error: total bytes received != result bytes!" << endl;
cerr << " total bytes received = " << total_bytes << endl;
cerr << " result bytes = " << result.size () << endl;
}
// receive the request error
do
{
data [0] = '\0';
recv_bytes = recv (maryInfoSocket, data, 1024, 0);
if (recv_bytes == -1)
{
return -2;
}
else if (recv_bytes > 0)
{
cerr << endl << "Mary error code: " << data << endl;
return -3;
}
} while (recv_bytes != 0);
#ifdef _WIN32
// close all open sockets Windows
closesocket (maryInfoSocket);
closesocket (maryDataSocket);
#else
// close all open sockets UNIX
close (maryInfoSocket);
close (maryDataSocket);
#endif
return 0;
}

View file

@ -1,49 +0,0 @@
/**
* Copyright 2000-2006 DFKI GmbH.
* All Rights Reserved. Use is subject to license terms.
*
* Permission is hereby granted, free of charge, to use and distribute
* this software and its documentation without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of this work, and to
* permit persons to whom this work is furnished to do so, subject to
* the following conditions:
*
* 1. The code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* 2. Any modifications must be clearly marked as such.
* 3. Original authors' names are not deleted.
* 4. The authors' names are not used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
#ifndef __MARYCLIENT_H_
#define __MARYCLIENT_H_
class MaryClient {
public:
// send query to the MaryServer
int maryQuery( int server_port,
std::string server_host,
std::string& result,
std::string inputText,
std::string maryInFormat,
std::string maryOutFormat,
std::string locale,
std::string audioType,
std::string voice,
std::string effects = "" );
};
#endif

View file

@ -1,87 +0,0 @@
/**
* Copyright 2000-2006 DFKI GmbH.
* All Rights Reserved. Use is subject to license terms.
*
* Permission is hereby granted, free of charge, to use and distribute
* this software and its documentation without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of this work, and to
* permit persons to whom this work is furnished to do so, subject to
* the following conditions:
*
* 1. The code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* 2. Any modifications must be clearly marked as such.
* 3. Original authors' names are not deleted.
* 4. The authors' names are not used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
// This version, adapted to MARY 4.0, provided by Sebastian Ptock.
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include "MaryClient.h"
using namespace std;
/**
* Demonstration code for using the MaryClient.
+ Call this as:
* ./MaryDemo
* or
* ./MaryDemo > output.wav
*/
int main() {
int server_port = 59125;
string server_host = "localhost";
string inputText = "Welcome to the world of speech synthesis!";
string maryInFormat = "TEXT";
string maryOutFormat = "AUDIO";
//string maryOutFormat = "REALISED_DURATIONS";
string locale = "en-US";
string audioType = "WAV_FILE";
string voice = "cmu-slt-hsmm";
string effects;
// effects += "Volume(amount:5.0;)+";
// effects += "TractScaler(amount:1.5;)+";
// effects += "F0Scale(f0Scale:2.0;)+";
// effects += "F0Add(f0Add:50.0;)+";
// effects += "Rate(durScale:1.5;)+";
// effects += "Robot(amount:100.0;)+";
// effects += "Whisper(amount:100.0;)+";
// effects += "Stadium(amount:100.0)+";
// effects += "Chorus(delay1:466;amp1:0.54;delay2:600;amp2:-0.10;delay3:250;amp3:0.30)+";
// effects += "FIRFilter(type:3;fc1:500.0;fc2:2000.0)+";
// effects += "JetPilot";
string result;
MaryClient maryClient;
maryClient.maryQuery( server_port, server_host, result, inputText, maryInFormat, maryOutFormat, locale, audioType, voice, effects);
if (maryOutFormat == "AUDIO") {
// write result into a file
const char *filename = "output.wav";
ofstream file( filename );
file << result;
// play output
//system("play output.wav");
} else {
cout << "RESULT: " << endl << result << endl;
}
return 0;
}

View file

@ -1,4 +0,0 @@
Start MARY as a socket server:
maryserver -Dserver=socket
(or change entry 'server' in conf/marybase.config)

View file

@ -1,185 +0,0 @@
#!/usr/bin/env python
import httplib, urllib
# A basic mary client in Python,
# kindly donated to the MARY TTS project
# by Hugh Sasse. Thanks Hugh!
# A very basic Python class for accessing
# the MARY TTS system using the modern
# HTTP server.
# Warning, this is probably ghastly Python,
# most of my time of late has been with
# other languages, so I'm not up to date
# with all the stylistic conventions of
# modern Python.
# This does seem to work OK though.
class maryclient:
"""A basic handler for MARY-TTS HTTP clients
At present, there is no checking for
allowed voices, locales, and so on.
Most of the useful parameters can be
accessed by get_ and set_ methods.
Relying on winsound, this is Windows
specific.
"""
def __init__(self):
"""Set up useful defaults (for
people in England, anyway)"""
self.host = "127.0.0.1"
self.port = 59125
self.input_type = "TEXT"
self.output_type = "AUDIO"
self.audio = "WAVE_FILE"
self.locale = "en_GB"
self.voice = "dfki-prudence-hsmm"
def set_host(self, a_host):
"""Set the host for the TTS server."""
self.host = a_host
def get_host(self):
"""Get the host for the TTS server."""
self.host
def set_port(self, a_port):
"""Set the port for the TTS server."""
self.port = a_port
def get_port(self):
"""Get the port for the TTS server."""
self.port
def set_input_type(self, type):
"""Set the type of input being
supplied to the TTS server
(such as 'TEXT')."""
self.input_type = type
def get_input_type(self):
"""Get the type of input being
supplied to the TTS server
(such as 'TEXT')."""
self.input_type
def set_output_type(self, type):
"""Set the type of input being
supplied to the TTS server
(such as 'AUDIO')."""
self.output_type = type
def get_output_type(self):
"""Get the type of input being
supplied to the TTS server
(such as "AUDIO")."""
self.output_type
def set_locale(self, a_locale):
"""Set the locale
(such as "en_GB")."""
self.locale = a_locale
def get_locale(self):
"""Get the locale
(such as "en_GB")."""
self.locale
def set_audio(self, audio_type):
"""Set the audio type for playback
(such as "WAVE_FILE")."""
self.audio = audio_type
def get_audio(self):
"""Get the audio type for playback
(such as "WAVE_FILE")."""
self.audio
def set_voice(self, a_voice):
"""Set the voice to speak with
(such as "dfki-prudence-hsmm")."""
self.voice = a_voice
def get_voice(self):
"""Get the voice to speak with
(such as "dfki-prudence-hsmm")."""
self.voice
def generate(self, message):
"""Given a message in message,
return a response in the appropriate
format."""
raw_params = {"INPUT_TEXT": message,
"INPUT_TYPE": self.input_type,
"OUTPUT_TYPE": self.output_type,
"LOCALE": self.locale,
"AUDIO": self.audio,
"VOICE": self.voice,
}
params = urllib.urlencode(raw_params)
headers = {}
# Open connection to self.host, self.port.
conn = httplib.HTTPConnection(self.host, self.port)
# conn.set_debuglevel(5)
conn.request("POST", "/process", params, headers)
response = conn.getresponse()
if response.status != 200:
print response.getheaders()
raise RuntimeError("{0}: {1}".format(response.status,
response.reason))
return response.read()
# If this is invoked as a program, just give
# a greeting to show it is working.
# The platform specific code is moved to this
# part so that this file may be imported without
# bringing platform specific code in.
if __name__ == "__main__":
# For handling command line arguments:
import sys
import platform
# check we are on Windows:
system = platform.system().lower()
if (system == "windows"):
import winsound
class Player:
def __init__(self):
pass
def play(self, a_sound):
winsound.PlaySound(a_sound, winsound.SND_MEMORY)
#if ("cygwin" in system):
else:
# Not sure how to do audio on cygwin,
# portably for python. So have a sound
# player class that doesn't play sounds.
# A null object, if you like.
class Player:
def __init__(self):
pass
def play(self, a_sound):
print("Here I would play a sound if I knew how")
pass
# Probably want to parse arguments to
# set the voice, etc., here
client = maryclient()
client.set_audio("WAVE_FILE") # for example
player = Player()
the_sound = client.generate("hello from Mary Text to Speech, with Python.")
if client.output_type == "AUDIO":
player.play(the_sound)
# vi:set sw=4 et:

View file

@ -1,177 +0,0 @@
#!/usr/bin/perl -T
# -*- Mode: Perl -*-
# MARY Text-to-Speech System
# CGI Script implementing a simple mary client,
# can be used for web pages.
##########################################################################
# Copyright (C) 2000-2006 DFKI GmbH.
# All rights reserved. Use is subject to license terms.
#
# Permission is hereby granted, free of charge, to use and distribute
# this software and its documentation without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of this work, and to
# permit persons to whom this work is furnished to do so, subject to
# the following conditions:
#
# 1. The code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
# 2. Any modifications must be clearly marked as such.
# 3. Original authors' names are not deleted.
# 4. The authors' names are not used to endorse or promote products
# derived from this software without specific prior written
# permission.
#
# DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
# CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
# THIS SOFTWARE.
##########################################################################
# Author: Marc Schroeder
use strict;
use IO::Socket;
use CGI;
# variables getting their values from form:
my ($inputtext, $in, $out, $audiotype, $voice);
# little helpers:
my ($var, $tmp);
# contacting the mary server:
my ($host, $port, $maryInfoSocket, $maryDataSocket, $id);
# helping with audio output:
my ($save_to_disk, $audiosubtype, $filename);
my $cgi = new CGI;
my @param = $cgi->param();
$inputtext = $cgi->param('inputtext');
$in = $cgi->param('in');
$out = $cgi->param('out');
$audiotype = $cgi->param('audiotype');
$save_to_disk = $cgi->param('save_to_disk');
$voice = $cgi->param('voice');
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
$year += 1900;
printf STDERR "[%04i-%02i-%02i %02i:%02i:%02i] ", $year, $mon, $mday, $hour, $min, $sec;
print STDERR "Request from ",$cgi->remote_user(),"@",$cgi->remote_host(),": \n";
print STDERR " in=",$in;
print STDERR " out=",$out;
print STDERR " audiotype=",$audiotype;
print STDERR " voice=",$voice;
print STDERR " save_to_disk=",$save_to_disk,"\n";
print STDERR " inputtext: ";
print STDERR $inputtext,"\n";
# Limit inputtext length to 5000 bytes:
if (length $inputtext > 5000) {
$inputtext = substr $inputtext, 0, 5000;
}
# set audio subtype
if ($out eq "AUDIO") {
if ($audiotype eq "AU") {
$audiosubtype = "basic";
$filename = "mary.au";
} elsif ($audiotype eq "AIFF") {
$audiosubtype = "x-aiff";
$filename = "mary.aiff";
} elsif ($audiotype eq "WAVE") {
$audiosubtype = "x-wav";
$filename = "mary.wav";
} elsif ($audiotype eq "MP3") {
$audiosubtype = "mp3";
$filename = "mary.mp3";
} else {
$audiosubtype = "x-wav";
$filename = "mary.wav";
}
}
# announce data type on stdout
if ($save_to_disk) {
print "Content-Type: application/octet-stream";
} else {
print "Content-Type: audio/$audiosubtype";
}
print "\nContent-Disposition: filename=\"$filename\"\n\n";
# contact mary server
$host = "cling.dfki.uni-sb.de";
$port = 59125;
# create a tcp connection to the specified host and port
$maryInfoSocket = IO::Socket::INET->new(Proto => "tcp",
PeerAddr => $host,
PeerPort => $port)
or die "can't connect to port $port on $host: $!";
# avoid buffering when writing to server:
$maryInfoSocket->autoflush(1); # so output gets there right away
########## Write input to server: ##########
# formulate the request:
print $maryInfoSocket "MARY IN=$in OUT=$out AUDIO=$audiotype";
if ($voice && $voice ne 'v') { print $maryInfoSocket " VOICE=$voice"; }
print $maryInfoSocket " LOG=\"REMOTE_HOST=$ENV{'REMOTE_HOST'}",
", REMOTE_ADDR=$ENV{'REMOTE_ADDR'}\"";
print $maryInfoSocket "\015\012";
# receive a request ID:
$id = <$maryInfoSocket>;
# open second socket for the data:
$maryDataSocket = IO::Socket::INET->new(Proto => "tcp",
PeerAddr => $host,
PeerPort => $port)
or die "can't connect to port $port on $host: $!";
# identify with request number:
print $maryDataSocket $id; # $id contains a newline character
# copy $inputtext to mary data socket
print $maryDataSocket $inputtext;
# mark end-of-request:
print $maryDataSocket "\015\012"; # that is a \n, actually
$maryDataSocket->shutdown(1); # we have stopped writing data
########## Read output from server: ##########
# copy the data socket to standard output
if ($out ne "AUDIO") { # text output
my $line;
while (defined ($line = <$maryDataSocket>)) {
print STDOUT $line;
}
} else { # audio data output
my $nr; # number of bytes read
my $buf; # buffer to read into
my $outnr; # number of bytes written
while($nr = read($maryDataSocket, $buf, 8192)) {
# (read returns no. of bytes read, 0 at eof)
print STDOUT $buf
or die "Write error on stdout";
} # while read something from socket
} # audio output
### Read complaints from server:
my $line;
while (defined ($line = <$maryInfoSocket>)) {
print STDERR $line;
}

View file

@ -1,136 +0,0 @@
#!/usr/bin/env perl
#
# MARY Text-to-Speech System
# Minimal Socket client (for demonstration)
##########################################################################
# Copyright (C) 2000-2006 DFKI GmbH.
# All rights reserved. Use is subject to license terms.
#
# Permission is hereby granted, free of charge, to use and distribute
# this software and its documentation without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of this work, and to
# permit persons to whom this work is furnished to do so, subject to
# the following conditions:
#
# 1. The code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
# 2. Any modifications must be clearly marked as such.
# 3. Original authors' names are not deleted.
# 4. The authors' names are not used to endorse or promote products
# derived from this software without specific prior written
# permission.
#
# DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
# CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
# THIS SOFTWARE.
##########################################################################
# Author: Marc Schroeder
# This is a minimal version of a socket client for the mary TtS system.
# It is intended to be used as a model for writing socket clients for
# particular applications. All input verification, command line options,
# and other luxury have been omitted.
#
# Usage:
# maryclient.pl infile.txt > outfile.wav
#
# Input/output formats and other options must be set in the perl code directly.
# See also Protocol.html for a description of the Protocol.
#
use strict;
use IO::Socket;
############################
# Package-global variables #
############################
# global settings:
my $maryInfoSocket; # handle to socket server
my $maryDataSocket; # handle to socket server
my $host; # string containing host address
my $port; # socket port on which we listen
my ($in, $out, $audiotype); # requested input / output format
my $voice; # default voice
my $id; # request ID
######################################################################
################################ main ################################
######################################################################
STDOUT->autoflush(1);
$host = "cling.dfki.uni-sb.de";
$port = 59125;
$in = "TEXT_DE";
$out = "AUDIO";
$audiotype = "MP3";
#$audiotype = "WAVE";
#$voice = "male";
$voice = "de3";
# create a tcp connection to the specified host and port
$maryInfoSocket = IO::Socket::INET->new(Proto => "tcp",
PeerAddr => $host,
PeerPort => $port)
or die "can't connect to port $port on $host: $!";
# avoid buffering when writing to server:
$maryInfoSocket->autoflush(1); # so output gets there right away
########## Write input to server: ##########
# formulate the request:
print $maryInfoSocket "MARY IN=$in OUT=$out AUDIO=$audiotype";
if ($voice) { print $maryInfoSocket " VOICE=$voice"; }
print $maryInfoSocket "\015\012";
# receive a request ID:
$id = <$maryInfoSocket>;
chomp $id; chomp $id;
# open second socket for the data:
$maryDataSocket = IO::Socket::INET->new(Proto => "tcp",
PeerAddr => $host,
PeerPort => $port)
or die "can't connect to port $port on $host: $!";
# identify with request number:
print $maryDataSocket $id, "\015\012";
# copy standard input and/or files given on the command line to the socket
while (defined (my $line = <>)) {
print $maryDataSocket $line;
}
# mark end-of-request:
print $maryDataSocket "\015\012"; # that is a \n, actually
shutdown($maryDataSocket, 1); # we have stopped writing data
########## Read output from server: ##########
# copy the data socket to standard output
if ($out ne "AUDIO") { # text output
my $line;
while (defined ($line = <$maryDataSocket>)) {
print STDOUT $line;
}
} else { # audio data output
my $nr; # number of bytes read
my $buf; # buffer to read into
my $outnr; # number of bytes written
while($nr = read($maryDataSocket, $buf, 100000)) {
# (read returns no. of bytes read, 0 at eof)
print STDOUT $buf
or die "Write error on stdout";
} # while read something from socket
} # audio output
### Read complaints from server:
my $line;
while (defined ($line = <$maryInfoSocket>)) {
print STDERR $line;
}

View file

@ -1,261 +0,0 @@
#!/usr/bin/env ruby
#
# A basic mary client in Ruby,
# kindly donated to the MARY TTS project
# by Hugh Sasse. Thanks Hugh!
# Ruby client for the MARY TTS HTTP server.
# This is for Windows only, and relies on
# the Win32-Sound gem to access the audio.
#
#
require 'rubygems'
require 'net/http'
require 'uri'
# A fairly minimal client class for the
# MARY TTS system. This uses the modern
# HTTP interface to access the server.
# At present, this doesn't wrap the methods
# which provide documentation or lists of
# voices or features.
class MaryClient
attr_accessor :host, :port
attr_accessor :input_type, :output_type
attr_accessor :locale, :audio, :voice
# Set up the defaults for the MARY TTS
# server, which is assumed to be running
# on the local host, with British voices
# installed. These may be modified with
# the appropriate methods.
# host = 127.0.0.1)
# port = 59125
# input_type = "TEXT"
# output_type = "AUDIO"
# audio = "WAVE_FILE"
# locale = "en_GB"
# voice = "dfki-prudence-hsmm"
def initialize
@host = "127.0.0.1" # The local machine
@port = 59125
@input_type = "TEXT"
@output_type = "AUDIO"
@locale = "en_GB"
@audio = "WAVE_FILE"
@voice = "dfki-prudence-hsmm"
end
# Process a text message, which with a
# new client, will return the audio.
# This is so that platform dependent parts
# are kept separate.
def generate(message)
raw_params = {"INPUT_TEXT" => message,
"INPUT_TYPE" => @input_type,
"OUTPUT_TYPE" => @output_type,
"LOCALE" => @locale,
"AUDIO" => @audio,
"VOICE" => @voice,
}
res = Net::HTTP.post_form(URI.parse("http://#{@host}:#{@port}/process"), raw_params)
res.value # Throw an exception on failure
#puts res.body
return res.body
end
end
# If this invoked as a program with no
# argumens, just give a greeting to show
# that it is working. If arguments are
# supplied, process options to work out
# what to do with the arguments.
if __FILE__ == $0
# These files are only loaded when this is
# invoked as a program.
require 'rbconfig'
require 'getoptlong'
# PLATFORM SPECIFIC CODE.
# Needs more work [!]
case Config::CONFIG['host_os']
when /darwin/i
raise NotImplementedError.new("Don't know how to play audio on a Mac")
when /linux/i
raise NotImplementedError.new("Far too many ways to play audio on Linux, you'll need to choose something")
when /sunos|solaris/i
raise NotImplementedError.new("Have not played audio on Suns for too long to implement this.")
when /java/i
raise NotImplementedError.new("Don't know how to play audio from Java ")
when /win32|cygwin|mingw32/i
# The various things that can use the Win32
# sound gem
require 'win32/sound'
# Create a player class that will play the
# sound that the Mary TTS system returns
class Player
# Play the audio passed in.
# Possibly this should receive the audio
# type so we can check that we can play it,
# but at the moment that is the
# responsibility of the user.
def self.play(sound)
Win32::Sound.play(sound, Win32::Sound::MEMORY)
end
end
else
raise NotImplementedError.new("Haven't thought how to support this OS yet")
end
client = nil
split = ""
if ARGV.size.zero?
client = MaryClient.new()
sound = client.generate("Hello from Mary Text to Speech with Ruby.")
Player.play(sound)
else
args_mode = :words
stdout_mode = :absorb
opts = GetoptLong::new(
["--audio", "-a", GetoptLong::REQUIRED_ARGUMENT],
["--echo", "-e", GetoptLong::NO_ARGUMENT],
["--help", "-h", GetoptLong::NO_ARGUMENT],
["--host", "-H", GetoptLong::REQUIRED_ARGUMENT],
["--input-type", "-i", GetoptLong::REQUIRED_ARGUMENT],
["--locale", "-l", GetoptLong::REQUIRED_ARGUMENT],
["--read", "-r", GetoptLong::NO_ARGUMENT],
["--split", "-s", GetoptLong::REQUIRED_ARGUMENT],
["--output-type", "-o", GetoptLong::REQUIRED_ARGUMENT],
["--port", "-P", GetoptLong::REQUIRED_ARGUMENT],
["--tee", "-t", GetoptLong::NO_ARGUMENT],
["--voice", "-v", GetoptLong::REQUIRED_ARGUMENT]
)
opts.each do |opt, arg|
unless ["--help", "-h"].include?(opt)
# skip if we are only getting help
client ||= MaryClient.new()
end
case opt
when "--help", "-h"
puts <<-EOHELP
Usage: #{$0} [options] [arguments]
--audio -a
Audio format. Defualt: WAVE_FILE
--echo -e
Act as an echo command and send output
arguments to the synthesizer only (not
to standard output.
Turns off --read|-r
--help -h
Print this help, then exit.
--host -H
The host which is the server.
Default: 127.0.0.1
--input-type -i
The type of the input supplied to the
TTS system. Default: TEXT
--locale -l
The locale of the input. Default: en_GB
--output-type -o
The output type from the TTS system.
Default: AUDIO
--port -P
The port for the TTS server
Default: 59125
--read -r
Read the files passed as arguments.
Turns off --echo|-e
--split -s (lines|paragraphs)
When reading files, split the input
into lines or paragraphs. Paragraphs
mean reading up to the next double
newline. Note, the argument is literally
"lines" or "paragraphs" (or some
abbreviation of those) without the
quotes.
Default is paragraphs.
--tee -t
Act as tee: send the output to the TTS
system, and to standard output.
--voice -v
The voice to use.
Default: dfki-prudence-hsmm
EOHELP
exit(0)
when "--audio", "-a"
client.audio = arg
when "--echo", "-e"
args_mode = :words
when "--host", "-H"
client.host = arg
when "--input-type", "-i"
client.input_type = arg
when "--locale", "-l"
client.locale = arg
when "--output-type", "-o"
client.output_type = arg
when "--port", "-P"
client.port = arg.to_i
when "--read", "-r"
args_mode = :files
when "--split", "-s"
case arg
when /^p/i
split = ""
when /^l/i
split = $/
end
when "--tee", "-t"
stdout_mode = :emit
when "--voice", "-v"
client.voice = arg
end
end
client ||= MaryClient.new()
case args_mode
when :words
input_text = ARGV.join(" ")
unless input_text =~ /\A\s*\Z/m
sound = client.generate(input_text)
if client.output_type == "AUDIO"
Player.play(sound)
end
end
if stdout_mode == :emit
puts input_text
end
when :files
# Slurp in paragraphs so sentences
# don't get broken in stupid places.
$/ = split # paragraph mode
ARGF.each do |paragraph|
begin
unless paragraph =~ /\A\s*\Z/m
sound = client.generate(paragraph)
if client.output_type == "AUDIO"
# and client.audio == "WAVE_FILE"
Player.play(sound)
end
end
rescue Exception => e
puts "got error #{e} while trying to say #{paragraph.inspect}"
raise
end
if stdout_mode == :emit
puts paragraph
end # end if
end # end ARGF.each
end # end case
end # if ARGV.size.zero?
end

View file

@ -1,705 +0,0 @@
# Tcl/Tk MARY TTS client.
# This has been tested on Windows, and because
# of the use of sound there will be portability
# issues. However, there should be enough here
# for a reasonable start at a client, for any
# platform that supports Tcl/Tk. The platform
# specific code has, as far as possible, been
# isolated in the part of the code that detects
# whether this is being run as a program.
# Notes:
# More work will need to be done with this,
# in order to make the code clean. It should
# probably be wrapped in a package, to solve
# any namespace issues. There are a lot of
# global variables. It seems that some of
# these are necessary for the menus to work.
# Handling of temporary files could be improved.
# TODO:
# Create modifier sliders, for the effects.
# Extend the query proc to make use of them.
# Turn the Help menu into something more useful.
# Debug the actions for the Edit menu.
# Provide a means of getting example inputs
# from the server.
# Provide a means of re-loading all the
# dynamically collected information when the
# server is changed from the menu. This means
# that we need to delete the existing menu
# entries in order to add them correctly.
# How do we ensure temporary files are removed
# in the event of a problem? if {catch {}} ...?
# Maybe leaving them around is diagnostic info?
# Make that an option?
# Add error handling code for network and disk
# failures likely to beset such clients.
# Add sensible defaults for things the user must
# always set at startup, but these will be
# platform spacific. Always default to Audio
# output for example, or is it possible that
# people have no voices installed?
# This is a GUI, so:
package require Tk
# We are communicating with the Mary server
# with HTTP.
package require http
# Use the local machine in preference to the
# one in Germany.
set mary_tts_default_host "127.0.0.1"
set mary_tts_default_port 59125
# Actual host and port, and global old
# copies to allow revert on cancel in the
# dialogues. Apparently upvar #0 is the
# norm for that sort of thing [Tcl Wiki]
set mary_tts_host $mary_tts_default_host
set old_mary_tts_host $mary_tts_host
set mary_tts_port $mary_tts_default_port
set old_mary_tts_port $mary_tts_port
# Informational URLs
set informational_urls [ list \
version datatypes voices \
audioformats audioeffects ]
#######
# Obtain a static page from the server, i.e.
# no parameters are needed to get it.
proc get_page { relative_url } {
global mary_tts_host mary_tts_port
set url http://$mary_tts_host:$mary_tts_port/$relative_url
set result [::http::geturl $url]
return [::http::data $result]
}
proc list_of_lines {str} {
return [ split $str "\n" ]
}
# We will need to collect this information
# when we have the server and port chosen.
proc get_audioeffects {} {
return [list_of_lines [get_page audioeffects] ]
}
proc get_audioformats {} {
return [list_of_lines [get_page audioformats] ]
}
proc get_datatypes {} {
return [ list_of_lines [get_page datatypes] ]
}
proc get_voices {} {
return [list_of_lines [get_page voices] ]
}
# Handling post queries.
# Submit the query to the server, using the
# http POST method.
proc make_query {url encoded_params} {
set http [::http::geturl $url -query $encoded_params]
set result [::http::data $http]
return $result
}
# Get the text from the input text area
proc get_input_text {} {
return [.io.inp.input_area get 1.0 end]
}
# Get the text from the output text area
proc get_output_text {} {
return [.io.out.output_area get 1.0 end]
}
# Collect the audio data from the server.
proc collect_audio_data {text_to_process} {
global mary_tts_host mary_tts_port
global inputtype outputtype locales
global audioformat voice
set url "http://$mary_tts_host:$mary_tts_port/process"
# ::http::formatQuery converts a list of
# key value pairs into the correct format
# for http POST.
set params [::http::formatQuery INPUT_TEXT $text_to_process INPUT_TYPE $inputtype OUTPUT_TYPE $outputtype LOCALE $locales($voice) AUDIO $audioformat VOICE $voice ]
set result [make_query $url $params]
return $result
}
# Pushes the query to the server and gets
# the results back, displaying or playing
# them.
proc generate_output {text_to_process} {
global outputtype
set result [collect_audio_data $text_to_process]
if {$outputtype eq "AUDIO"} {
# call the platform dependent implementation.
play $result
} else {
clear_output
add_message $result
}
# Return the result so we can save it if
# the user requires it.
return $result
}
# These next procs are for handling the
# lists of data one gets back from the server
# which possibly have several words per line,
# separated by spaces.
# If the first word of each listed line is
# significant, extract the list of first words.
proc collect_first_words_of_phrase_list {a_list} {
for {set i 0} {$i < [llength $a_list]} {incr i} {
set data [lindex $a_list $i ]
set word [ lindex [split $data " "] 0 ]
lappend words $word
}
return $words
}
# If the second word of each listed line is
# significant, extract the list of second words.
proc collect_second_words_of_phrase_list {a_list} {
for {set i 0} {$i < [llength $a_list]} {incr i} {
set data [lindex $a_list $i ]
set word [ lindex [split $data " "] 1 ]
lappend words $word
}
return $words
}
# The list of datatypes must be separated into
# input data types and output data types so that
# interactions with the server make sense.
# This handles the inputs.
proc collect_first_words_of_input_types {a_list} {
for {set i 0} {$i < [llength $a_list]} {incr i} {
set data [lindex $a_list $i ]
if {[ string match -nocase "*input*" $data ]} {
set word [ lindex [split $data " "] 0 ]
lappend words $word
}
}
return $words
}
# The list of datatypes must be separated into
# input data types and output data types so that
# interactions with the server make sense.
# This handles the outputs.
proc collect_first_words_of_output_types {a_list} {
for {set i 0} {$i < [llength $a_list]} {incr i} {
set data [lindex $a_list $i ]
if {[string match -nocase "*output*" $data]} {
set word [ lindex [split $data " "] 0 ]
lappend words $word
}
}
return $words
}
# setup all the variables to hold voices,
# audio options, etc., based on what the
# server can do.
proc setup_globals {} {
global audioeffects audioformats voices
global inputtypes outputtypes audioformat voice
global inputtype outputtype locales
set audioeffects [get_audioeffects]
set audioformats [get_audioformats]
set audioformat [lindex $audioformats 0 ]
set datatypes_data [get_datatypes]
set inputtypes [collect_first_words_of_input_types $datatypes_data]
set inputtype [lindex $inputtypes 0]
set outputtypes [collect_first_words_of_output_types $datatypes_data]
set outputtype [lindex $outputtypes 0]
set voices_data [get_voices]
set voices [collect_first_words_of_phrase_list $voices_data]
set locales_list [collect_second_words_of_phrase_list $voices_data ]
for {set i 0} {$i < [llength $voices]} {incr i} {
set locales([lindex $voices $i]) [lindex $locales_list $i]
}
set voice [lindex $voices 0]
}
# A general procedure for filling in the
# elements of a listbox from a list.
# At present this is unused, but it could
# be useful later. [It took a while to
# figure out so I'm not ready to kill it
# with YAGNI.]
proc add_listbox_items {a_var a_widget} {
upvar $a_var var
foreach item $var {
$a_widget insert end $item
}
}
# Create the menubuttons along the top.
# Usual File, Edit and Help menus plus
# those to set attributes.
proc create_menubuttons {} {
set buttons [ list file File edit Edit \
server "Server" \
inputtype "Input type" outputtype "Output type" \
voice Voice \
audioformat "Audio format" \
textstyle "Text style" help Help ]
set count 1
foreach { menu_tag string_tag} $buttons {
menubutton .menus.$menu_tag -text $string_tag \
-menu .menus.${menu_tag}.menu -underline 0 -font ClientFont
menu .menus.${menu_tag}.menu -tearoff true
grid .menus.$menu_tag -in .menus -row 1 -column $count -sticky w
incr count
}
}
# Get the contents of a text file for reading
# or loading into a text widget, etc.
proc text_file_contents {what_for} {
set a_file [tk_getOpenFile -title $what_for ]
set the_text ""
if {$a_file != ""} {
set a_stream [open $a_file r ]
set the_text [read $a_stream]
close $a_stream
}
return $the_text
}
# Save the_text to a text file specified
# by the user, for the given reason (what_for).
# At the moment there is no error handling
# for this (disk full, write protected, etc).
proc save_text_file {the_text what_for} {
set a_file [tk_getSaveFile -title $what_for -parent .]
if {$a_file != ""} {
set a_stream [open $a_file w ]
puts $a_stream $the_text
close $a_stream
}
}
# Save the_data to a binary file specified
# by the user, for the given reason (what_for),
# a text string.
# At the moment there is no error handling
# for this (disk full, write protected, etc).
proc save_binary_file {the_data what_for} {
set a_file [tk_getSaveFile -title $what_for -parent .]
if {$a_file != ""} {
set a_stream [open $a_file w ]
fconfigure $a_stream -translation binary
puts -nonewline $a_stream $the_data
close $a_stream
}
}
# Create the menu for File operations
proc create_menu_file {} {
set fmenu .menus.file.menu
$fmenu add command -label "New" \
-font ClientFont -command {
.io.inp.input_area delete 1.0 end
}
# Replace the contents of the input text
# widget by the data from the open file.
# <FIXME>YAGNI, but is there any reason
# to allow inserting a file, rather than
# replacing the text with file contents?
# </FIXME>
$fmenu add command -label "Open" \
-font ClientFont -command {
set the_text [text_file_contents "File to load"]
if {$the_text != ""} {
.io.inp.input_area delete 1.0 end
.io.inp.input_area insert end $the_text
}
}
$fmenu add command -label "Read" \
-font ClientFont -command {
generate_output [text_file_contents "File to read"]
}
# How to make these disabled for now?
$fmenu add command -label "Save Input" \
-font ClientFont -command {
set the_text [get_input_text]
save_text_file $the_text "Save Input"
}
$fmenu add command -label "Save Output" \
-font ClientFont -command {
set the_text [get_output_text]
save_text_file $the_text "Save Output"
}
}
# Create the menu for edit operations
proc create_menu_edit {} {
set emenu .menus.edit.menu
$emenu add command -label "Select All from Input Area" \
-font ClientFont -command {
# This code says copy the selection as well.
# May be wrong for some platforms, but is
# it more useful?
.io.inp.input_area tag add sel 1.0 end
event generate .io.inp.input_area <<copy>>
}
$emenu add command -label "Select All from Output Area" \
-font ClientFont -command {
# This code says copy the selection as well.
# May be wrong for some platforms, but is
# it more useful?
.io.out.output_area tag add sel 1.0 end
event generate .io.out.output_area <<Copy>>
}
$emenu add command -label "Copy from Input Area" \
-font ClientFont -command {
# this appears not to work. FIXME
event generate .io.inp.input_area <<Copy>>
}
$emenu add command -label "Copy from Output Area" \
-font ClientFont -command {
# this appears not to work. FIXME
event generate .io.out.output_area <<copy>>
}
$emenu add command -label "Paste into Input Area" \
-font ClientFont -command {
# this appears not to work. FIXME
event generate .io.inp.input_area <<Paste>>
}
$emenu add command \
-font ClientFont -label "Insert example text into Input Area"\
-command {
}
# Add specific editing commands here later.
# For example, we would like to be able to
# add whole tags to the XML based formats,
# wrap matching tags around selected text.
# Also we need to find out what happens with
# copy cut and paste, given that X Windows
# is different from MS Windows.
# Allow example text to be inserted.
# However, my thinking is that this should not
# overwrite as it is in the Java application,
# because this rubs out edits when switching
# voices, and this can be annoying when
# exploring the system.
}
# Set the server properties, mostly just
# host and port. Maybe later protocol will
# be possible for https connections?
proc create_menu_server {} {
set smenu .menus.server.menu
$smenu add command -label "host" -font ClientFont -command {
create_entry_dialog "MARY TTS server name" "hostname/IP Address" mary_tts_host
}
$smenu add command -label "port" -font ClientFont -command {
create_entry_dialog "MARY TTS server port" "pott number" mary_tts_port
}
}
# setup the fonts for the various areas on the dipslay.
proc setup_font {family size} {
foreach win {.io .controls .entry.dialogue } {
font configure ClientFont -family $family -size $size
}
}
# Create the menu for changing the text size.
proc create_menu_textstyle {} {
set tmenu .menus.textstyle.menu
$tmenu add cascade -label "Courier" -underline 0 -menu \
$tmenu.courier -font ClientFont
$tmenu add cascade -label "Times" -underline 0 -menu \
$tmenu.times -font ClientFont
$tmenu add cascade -label "Helvetica" -underline 0 -menu \
$tmenu.helvetica -font ClientFont
foreach {name family} [list $tmenu.courier Courier \
$tmenu.times Times $tmenu.helvetica Helvetica ] {
set m1 [menu $name]
foreach pts {6 7 8 9 10 12 14 16 18 20 24 28 32 36} {
$m1 add command -label "$pts" -font ClientFont\
-command [list setup_font $family $pts ]
}
}
}
# Create the menu for Help
proc create_menu_help {} {
# This is all pretty much "wet paint"
# Is there enough to merit separate menus?
set hmenu .menus.help.menu
$hmenu add command -label "Introduction" -font ClientFont\
-command {
tk_messageBox -message "This is a basic Tcl/Tk
client for the MARY TTS system. Most of the options
are reached through the menus on the top. Some
facilities are presently lacking.
Most of the interface should be self-explanatory.
In the File menu, Read will read a given file aloud
(or at least take it as input for the present
form of processing), whereas Open will load it
into the input area. Save input and Save output
refer to the contents of the text windows. The
save button next to the play button will save
the output to a file; this is assumed to be a
text file, unless the output is audio, in which
case it is a binary file.
The Edit menu has cut and paste facilities,
but these don't seem to work reliably. The
default key bindings for text areas should
be useable.
You will need to set the input and output types
and the audio format before pressing play.
Code does not yet exist to figure out sensible
defaults for your platform.
This does not have support for the effects, yet.
Contributions from developers welcome." -type ok
}
$hmenu add command -label "About" -command {} -font ClientFont
}
# We need to create menus for the available
# voices and audio formats, etc.
# When we have the data for these menus from
# the server, create them by using the global
# lists of information.
proc create_radio_menu_from_list {what} {
global $what
set plural "${what}s"
upvar 1 $plural var
foreach item $var {
.menus.${what}.menu add radiobutton -label $item -variable $what \
-value $item -font ClientFont
}
}
proc reset_entry_and_var {a_variable} {
upvar #0 $a_variable var
upvar #0 old_$a_variable old_var
set var $old_var
destroy .entry_dialogue
}
# Create the toplevel for choosing a host
# or port, something taken from an entry.
proc create_entry_dialog {a_message a_label a_variable} {
upvar #0 $a_variable var
upvar #0 old_$a_variable old_var
toplevel .entry_dialogue
label .entry_dialogue.the_message -text $a_message \
-font ClientFont
label .entry_dialogue.the_label -text $a_label -font ClientFont
entry .entry_dialogue.the_entry -textvariable $a_variable \
-font ClientFont
button .entry_dialogue.ok -text "OK" -font ClientFont -command {
destroy .entry_dialogue
}
button .entry_dialogue.cancel -text "Cancel" -font ClientFont \
-command "reset_entry_and_var $a_variable"
grid .entry_dialogue.the_message -row 1 -column 1
grid .entry_dialogue.the_label -row 2 -column 1
grid .entry_dialogue.the_entry -row 2 -column 2
grid .entry_dialogue.ok -row 3 -column 1
grid .entry_dialogue.cancel -row 3 -column 2
}
# Add a message to the end of the output
# text widget.
proc add_message {a_message} {
.io.out.output_area configure -state normal
.io.out.output_area insert end $a_message
.io.out.output_area configure -state disabled
}
# Clear the text in the output text widget.
proc clear_output {} {
.io.out.output_area configure -state normal
.io.out.output_area delete 1.0 end
.io.out.output_area configure -state disabled
}
# Sound generation is platform dependent.
# This provides an "abstract" function to
# be overridden by the platform dependent
# code. In this case it alerts the user
# in the output window that nothing is going
# to happen.
proc play {sound} {
add_message \
"play sound not implemented on this platform apparently"
}
# Graphical stuff.
# In order to be able to scale the font, define a font.
font create ClientFont -family [font actual TkDefaultFont -family] \
-size [font actual TkDefaultFont -size]
frame .menus
create_menubuttons
create_menu_file
create_menu_edit
create_menu_server
create_menu_textstyle
create_menu_help
# Fill in the other menus at runtime.
# .io communicates text with the user,
# through an input and output window.
frame .io
frame .io.inp
frame .io.out
# .controls will hold the play button and
# the effects controls.
frame .controls
# Draw the controls in .io
label .io.inp.input_label -text "Input Area" -font ClientFont
text .io.inp.input_area -height 10 -width 40 \
-xscrollcommand ".io.inp.input_x set" \
-yscrollcommand ".io.inp.input_y set" -font ClientFont
scrollbar .io.inp.input_x -orient horizontal \
-command ".io.inp.input_area xview"
scrollbar .io.inp.input_y -orient vertical \
-command ".io.inp.input_area yview"
label .io.out.output_label -text "Output Area" -font ClientFont
text .io.out.output_area -height 10 -width 40 -state disabled \
-xscrollcommand ".io.out.output_x set" \
-yscrollcommand ".io.out.output_y set" -font ClientFont
scrollbar .io.out.output_x -orient horizontal \
-command ".io.out.output_area xview"
scrollbar .io.out.output_y -orient vertical \
-command ".io.out.output_area yview"
grid .io.inp -in .io -row 1 -column 1
grid .io.out -in .io -row 1 -column 2
grid .io.inp.input_label -in .io.inp -row 1 -column 1
grid .io.inp.input_area -in .io.inp -row 2 -column 1
grid .io.inp.input_y -in .io.inp -row 2 -column 2 -sticky ns
grid .io.inp.input_x -in .io.inp -row 3 -column 1 -sticky ew
grid .io.out.output_label -in .io.out -row 1 -column 1
grid .io.out.output_area -in .io.out -row 2 -column 1
grid .io.out.output_y -in .io.out -row 2 -column 2 -sticky ns
grid .io.out.output_x -in .io.out -row 3 -column 1 -sticky ew
button .controls.play -text "play" -font ClientFont -command {
generate_output [get_input_text]
}
grid .controls.play -in .controls -row 1 -column 1
button .controls.save -text "save" -font ClientFont -command {
global outputtype
set input_text [get_input_text]
if { $outputtype eq "AUDIO" } {
save_binary_file [collect_audio_data $input_text ] "Save audio file"
} else {
save_text_file [collect_audio_data $input_text ] "Save output to file"
}
}
grid .controls.save -in .controls -row 1 -column 2
pack .menus .io .controls -in . -side top
# Detect whether this is the main program
# This test was taken from the Tcl Wiki, and
# seems to work OK.
if {[info exists argv0] && [file tail [info script]] eq [file tail $argv0]} {
# Try to find the temporary files directory.
catch { set tmpdir "/tmp" }
catch { set tmpdir $::env(TRASH_FOLDER) }
catch { set tmpdir $::env(TMP) }
catch { set tmpdir $::env(TEMP) }
# <FIXME>This needs better handling of
# possible alternatives</FIXME>
# This is needed for Windows sound only.
# Do the platform dependent things.
if {$tcl_platform(platform) eq "windows"} {
package require twapi
proc play {sound} {
global tmpdir
# Write sound to a temporary file
set sndfile [file join $tmpdir "MARYTTS_sound.[pid].wav" ]
set stream [open $sndfile w]
# Make sure the file is binary:
fconfigure $stream -translation binary
puts -nonewline $stream $sound
close $stream
# Play the file.
::twapi::play_sound $sndfile
# Remove the file.
file delete $sndfile
}
}
# Put other platforms here.
# Setup the globals with reference to the
# server, which is assumed to be working.
# Since we have options to alter this with
# menu items, there probably needs to be
# some way to reload all this. But we need
# to know how to delete the existing menu
# entries to do that.
setup_globals
create_radio_menu_from_list inputtype
create_radio_menu_from_list outputtype
create_radio_menu_from_list voice
create_radio_menu_from_list audioformat
# Note, at the moment voices holds locales,
# gender, and voice type
# At the moment this is just diagnostic:
## add_message [ join $voices "\n" ]
# it tells us we have a basically working
# system and the list of voices has been
# picked up and manipulated correctly.
# So it is commented out now.
}

View file

@ -1,81 +0,0 @@
<html>
<!--
Copyright 2000-2006 DFKI GmbH.
All Rights Reserved. Use is subject to license terms.
Permission is hereby granted, free of charge, to use and distribute
this software and its documentation without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of this work, and to
permit persons to whom this work is furnished to do so, subject to
the following conditions:
1. The code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Any modifications must be clearly marked as such.
3. Original authors' names are not deleted.
4. The authors' names are not used to endorse or promote products
derived from this software without specific prior written
permission.
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
-->
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel=stylesheet type="text/css" href="mary.css">
<script type="text/javascript">
</head>
<body>
<h1 align="center">The MARY Text-to-Speech System: Online Demo</h1>
<div align="center">
<p>Synthesise any text online (max. 5000 characters):
</p>
<form name="InputForm" method="get" action="maryclient.cgi">
<!-- Set the language of your input here: TEXT_DE=German, TEXT_EN=English... -->
<input type="hidden" name="in" value="TEXT"/>
<input type="hidden" name="out" value="AUDIO"/>
<p>Input text:</p>
<textarea name="inputtext" rows=8 cols=50 wrap=virtual>
Welcome to the world of speech synthesis!
</textarea><br>
<table align="center">
<tr>
<td>
Voice:
<select name="voice">
<option value="us1">us1 (American English, female)</option>
<option value="us2">us2 (American English, male)</option>
</select>
</td><td>
Audio format:
<select name="audiotype">
<option value="AU">Sun Audio, 16 bit</option>
<option value="AIFF">AIFF, 16 bit</option>
<option value="WAVE" selected>WAV, 16 bit</option>
<option value="MP3">mp3</option>
</select>
</td>
</tr>
<tr>
<td align="right">
<input type=submit value="Speak">
</td><td align="left">
<input type=reset value="Reset">
</td>
</tr>
</table>
<p>
<input type=radio name="save_to_disk" value="0" checked>Hear directly
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=radio name="save_to_disk" value="1">Save to disk
</form>
</div>
</body>
</html>

View file

@ -1,20 +0,0 @@
<HTML>
<HEAD>
<TITLE>EmoSpeak Applet</TITLE>
</HEAD>
<BODY>
<H3><HR WIDTH="100%">EmoSpeak Applet<HR WIDTH="100%"></H3>
To properly run the emospeak applet, the following conditions must be fulfilled:
<br>
1. The emospeakapplet.jar and maryclient.jar files must be in the same directory as this html file.
<br>
2. On the server machine from which the html file is loaded, a MARY server with German voices must be running.
<br>
<P>
<APPLET archive="emospeakapplet.jar, maryclient.jar" code="marytts.tools.emospeak.EmoSpeakApplet.class" width=550 height=600></APPLET>
</P>
</BODY>
</HTML>

View file

@ -1,94 +0,0 @@
#!/bin/sh -e
#
# marytts This init.d script is used to start a MARY TTS server.
# Run process as same user as this script:
SUDO=""
# Run process as user 'mary':
#SUDO="sudo -u mary"
JAVA=/usr/bin/java
MARY_BASE="/usr/local/MARY TTS"
MARY_PIDFILE=/var/run/marytts.pid
pidof_marytts() {
PIDOF=`which pidof` || true
if [ -x "$PIDOF" ]; then # command exists
PIDS=`pidof java` || true
else # no pidof command
PIDS=`ps axc|awk "{if (\\$5==\\"java\\") print \\$1}"`
fi
[ -e $MARY_PIDFILE ] && PIDS2=`cat $MARY_PIDFILE`
# if there is a pid we need to verify that belongs to MARY
# for real
for i in $PIDS; do
if [ "$i" = "$PIDS2" ]; then
# in this case the pid stored in the
# pidfile matches one of the pidof java
# so a simple kill will make it
echo $i
return 0
fi
done
return 1
}
marytts_start() {
CLASSPATH="$MARY_BASE/java/mary-common.jar:$MARY_BASE/java/log4j-1.2.15.jar"
$SUDO $JAVA -ea -Xms40m -Xmx1g -cp "$CLASSPATH" -Dmary.base="$MARY_BASE" marytts.server.Mary &
PID="$!"
echo $PID > $MARY_PIDFILE
}
marytts_stop() {
PID=$(pidof_marytts)
if [ "${PID}" ]; then
kill $PID
fi
}
case $1 in
start)
echo "Starting TTS server"
if marytts_start; then
exit 0
else
exit 1
fi
;;
stop)
echo "Stopping TTS server"
if marytts_stop; then
exit 0
else
exit 1
fi
;;
restart)
echo "Restarting TTS server"
marytts_stop
sleep 10
if marytts_start; then
exit 0
else
exit 1
fi
;;
status)
PID=$(pidof_marytts) || true
if [ "${PID}" ]; then
echo "MARY TTS is running (pid $PID)"
else
echo "MARY TTS is not running"
fi
exit 0
;;
*)
echo "Usage: /etc/init.d/marytts {start|stop|restart|status}"
exit 1
;;
esac

View file

@ -1,242 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><marytts-install xmlns="http://mary.dfki.de/installer">
<voice locale="de" name="bits1-hsmm" gender="female" type="hsmm" version="5.1">
<description>A female German hidden semi-Markov model voice, built from voice recordings provided by the BITS project at the Bavarian Archive of Speech Signals</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="69aeb40bc27492d887f7d60bd8afc2aa" filename="voice-bits1-hsmm-5.1.zip" size="1360761">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="de" version="5.1"/>
</voice>
<voice locale="de" name="bits3" gender="male" type="unit selection" version="5.1">
<description>A male German unit selection voice, built from voice recordings provided by the BITS project at the Bavarian Archive of Speech Signals</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="e11f0d1057dd80d5ab307eaf3c2a2e81" filename="voice-bits3-5.1.zip" size="278237075">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="de" version="5.1"/>
</voice>
<voice locale="de" name="bits3-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male German hidden semi-Markov model voice, built from voice recordings provided by the BITS project at the Bavarian Archive of Speech Signals</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="d535206d88da7f5b066a4624c321ee73" filename="voice-bits3-hsmm-5.1.zip" size="1557124">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="de" version="5.1"/>
</voice>
<voice locale="de" name="dfki-pavoque-neutral" gender="male" type="unit selection" version="5.1">
<description>A male German unit selection voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="b2067addeb337de0e31c1e0057ccaf93" filename="voice-dfki-pavoque-neutral-5.1.zip" size="446054145">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="de" version="5.1"/>
</voice>
<voice locale="de" name="dfki-pavoque-neutral-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male German hidden semi-Markov model voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="c064426f03689cc0681514818495b347" filename="voice-dfki-pavoque-neutral-hsmm-5.1.zip" size="2835023">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="de" version="5.1"/>
</voice>
<voice locale="de" name="dfki-pavoque-styles" gender="male" type="unit selection" version="5.1">
<description>A male German unit selection voice with expressive styles "happy", "sad", "angry", and "poker"</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="f497dd93f78fa4a2350adea1196ccd7a" filename="voice-dfki-pavoque-styles-5.1.zip" size="692113207">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="de" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-poppy" gender="female" type="unit selection" version="5.1">
<description>A female British English expressive unit selection voice: Cheerful Poppy</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="8a9bd4c4c888e99f8c367cdac614af9c" filename="voice-dfki-poppy-5.1.zip" size="99318417">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-poppy-hsmm" gender="female" type="hsmm" version="5.1">
<description>A female British English hidden semi-Markov model voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="04f1b36ee7113b13e01d3b131c6af75f" filename="voice-dfki-poppy-hsmm-5.1.zip" size="1015901">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-prudence" gender="female" type="unit selection" version="5.1">
<description>A female British English expressive unit selection voice: Pragmatic Prudence</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="7c81cbc736450219ea1597b217ea9b8f" filename="voice-dfki-prudence-5.1.zip" size="250841190">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-prudence-hsmm" gender="female" type="hsmm" version="5.1">
<description>A female British English hidden semi-Markov model voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="87a27d0ae3eed71d1d34bd3337f06501" filename="voice-dfki-prudence-hsmm-5.1.zip" size="1560473">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-obadiah" gender="male" type="unit selection" version="5.1">
<description>A male British English expressive unit selection voice: Gloomy Obadiah</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="dde06a7a4849b922bc45b123a5b7b504" filename="voice-dfki-obadiah-5.1.zip" size="146431509">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-obadiah-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male British English hidden semi-Markov model voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="eb9872af54a1f944f191b2b7237f8d25" filename="voice-dfki-obadiah-hsmm-5.1.zip" size="1216409">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-spike" gender="male" type="unit selection" version="5.1">
<description>A male British English expressive unit selection voice: Aggressive Spike</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="f1161fd1da6306cc65d054cd8ff75f4e" filename="voice-dfki-spike-5.1.zip" size="136165028">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_GB" name="dfki-spike-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male British English hidden semi-Markov model voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="a0bfd497423bf504dc3c985476b4e669" filename="voice-dfki-spike-hsmm-5.1.zip" size="1083544">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-GB" version="5.1"/>
</voice>
<voice locale="en_US" name="cmu-slt" gender="female" type="unit selection" version="5.1">
<description>A female US English unit selection voice, built from recordings provided by Carnegie Mellon University</description>
<license href="http://mary.dfki.de/download/arctic-license.html"/>
<package md5sum="0fe2293ba1f9a0e373b54d79f0a701cc" filename="voice-cmu-slt-5.1.zip" size="105909149">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-US" version="5.1"/>
</voice>
<voice locale="en_US" name="cmu-bdl-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male US English hidden semi-Markov model voice, built from recordings provided by Carnegie Mellon University</description>
<license href="http://mary.dfki.de/download/arctic-license.html"/>
<package md5sum="b192a878fb782b48c2ea37deed769c28" filename="voice-cmu-bdl-hsmm-5.1.zip" size="1017477">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-US" version="5.1"/>
</voice>
<voice locale="en_US" name="cmu-rms-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male US English hidden semi-Markov model voice, built from recordings provided by Carnegie Mellon University</description>
<license href="http://mary.dfki.de/download/arctic-license.html"/>
<package md5sum="fc06214cf245ecba0c2ddf437149bd89" filename="voice-cmu-rms-hsmm-5.1.zip" size="1028060">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="en-US" version="5.1"/>
</voice>
<voice locale="fr" name="enst-camille" gender="female" type="unit selection" version="5.1">
<description>A female French unit selection voice, built at Télécom ParisTech (ENST) using data recorded by Camille Dianoux</description>
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
<package md5sum="ba18cb28526de107a9b6b8c76d5404ff" filename="voice-enst-camille-5.1.zip" size="183466604">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="fr" version="5.1"/>
</voice>
<voice locale="fr" name="enst-camille-hsmm" gender="female" type="hsmm" version="5.1">
<description>A female French hidden semi-Markov model voice, built at Télécom ParisTech (ENST) using data recorded by Camille Dianoux</description>
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
<package md5sum="19cb43b7fed60b732aa1c2e0e86dff03" filename="voice-enst-camille-hsmm-5.1.zip" size="1518635">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="fr" version="5.1"/>
</voice>
<voice locale="fr" name="upmc-jessica" gender="female" type="unit selection" version="5.1">
<description>A female French unit selection voice, built at ISIR (UPMC) using data recorded by Jessica Durand</description>
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
<package md5sum="ba2daa2a0c69164932ff833817fa4b0e" filename="voice-upmc-jessica-5.1.zip" size="126834351">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="fr" version="5.1"/>
</voice>
<voice locale="fr" name="upmc-jessica-hsmm" gender="female" type="hsmm" version="5.1">
<description>A female French hidden semi-Markov model voice, built at ISIR (UPMC) using data recorded by Jessica Durand</description>
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
<package md5sum="0e95f86b9297f2c60fa6286432d20d84" filename="voice-upmc-jessica-hsmm-5.1.zip" size="1118972">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="fr" version="5.1"/>
</voice>
<voice locale="fr" name="enst-dennys-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male Québécois French hidden semi-Markov model voice, built at Télécom ParisTech (ENST)</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="ee95a5257ea4aba46591cfe7c4429d84" filename="voice-enst-dennys-hsmm-5.1.zip" size="1676376">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="fr" version="5.1"/>
</voice>
<voice locale="fr" name="upmc-pierre" gender="male" type="unit selection" version="5.1">
<description>A male French unit selection voice, built at ISIR (UPMC) using data recorded by Pierre Chauvin</description>
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
<package md5sum="3120b9dadfb56046e86e64c124d1fa82" filename="voice-upmc-pierre-5.1.zip" size="171764059">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="fr" version="5.1"/>
</voice>
<voice locale="fr" name="upmc-pierre-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male French hidden semi-Markov model voice, built at ISIR (UPMC) using data recorded by Pierre Chauvin</description>
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
<package md5sum="064e272e3e3283134b44df8eb768dd71" filename="voice-upmc-pierre-hsmm-5.1.zip" size="1557436">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="fr" version="5.1"/>
</voice>
<voice locale="it" name="istc-lucia-hsmm" gender="female" type="hsmm" version="5.1">
<description>Italian female Hidden semi-Markov model voice kindly made available by Fabio Tesser</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="68258f5b94c596ac961e9bc45be0e521" filename="voice-istc-lucia-hsmm-5.1.zip" size="1466943">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="it" version="5.1"/>
</voice>
<voice locale="ru" name="voxforge-ru-nsh" gender="male" type="unit selection" version="5.1">
<description>Russian male voice kindly made available by Nickolay V. Shmyrev</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="b0ec23e41a2e9c2485b55e640ef32fb3" filename="voice-voxforge-ru-nsh-5.1.zip" size="175120753">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="ru" version="5.1"/>
</voice>
<voice locale="te" name="cmu-nk" gender="female" type="unit selection" version="5.1">
<description>A female Telugu unit selection voice built from voice recordings provided by IIIT Hyderabad and Carnegie Mellon University</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="2fb7b6b6c9e9eb12ea2ebcba4f356505" filename="voice-cmu-nk-5.1.zip" size="495885808">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="te" version="5.1"/>
</voice>
<voice locale="te" name="cmu-nk-hsmm" gender="female" type="hsmm" version="5.1">
<description>A female Telugu hidden semi-Markov model voice built from voice recordings provided by IIIT Hyderabad and Carnegie Mellon University</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="8dd7545a096dd87275b51028bc7623c3" filename="voice-cmu-nk-hsmm-5.1.zip" size="3397557">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="te" version="5.1"/>
</voice>
<voice locale="tr" name="dfki-ot" gender="male" type="unit selection" version="5.1">
<description>A male Turkish unit selection voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="c9940e0a58578fc02113b61ac86a6ebf" filename="voice-dfki-ot-5.1.zip" size="157783972">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="tr" version="5.1"/>
</voice>
<voice locale="tr" name="dfki-ot-hsmm" gender="male" type="hsmm" version="5.1">
<description>A male Turkish hidden semi-Markov model voice</description>
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
<package md5sum="211f3d322f19295b5a7671020d76552e" filename="voice-dfki-ot-hsmm-5.1.zip" size="1366536">
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
</package>
<depends language="tr" version="5.1"/>
</voice>
</marytts-install>

View file

@ -1,675 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,10 +0,0 @@
<marytts-install xmlns="http://mary.dfki.de/installer">
<language locale="en-US" name="en-US" version="5.1.2">
<description>en-US language component</description>
<license href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"/>
<package filename="marytts-lang-en-US-5.1.2.zip" md5sum="dummy" size="0">
<location href="http://mary.dfki.de/download/5.1.2/"/>
</package>
<files>lib/marytts-lang-en-US-5.1.2.jar</files>
</language>
</marytts-install>

View file

@ -1,10 +0,0 @@
<marytts-install xmlns="http://mary.dfki.de/installer">
<language locale="sv" name="sv" version="5.1.2">
<description>sv language component</description>
<license href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"/>
<package filename="marytts-lang-sv-5.1.2.zip" md5sum="dummy" size="0">
<location href="http://mary.dfki.de/download/5.1.2/"/>
</package>
<files>lib/marytts-lang-sv-5.1.2.jar</files>
</language>
</marytts-install>

View file

@ -1,166 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

Binary file not shown.

View file

@ -1,10 +0,0 @@
Sathish | ' s A - t I S
Eire | ' E - r @
speech | ' s p i tS
hasnt | ' h { z n t
havent | ' h { v n t
mustnt | ' m V s n t
isnt | ' I z n t
Greta | ' g r { - t A
minute | ' m I - n I t
does | ' d V z

View file

@ -1 +0,0 @@
kyrka | C ,Y r - k %a

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -2,11 +2,11 @@ package se.hal;
import se.hal.bot.AliceBot;
import se.hal.intf.HalBot;
import se.hal.intf.HalSpeachToText;
import se.hal.intf.HalTextToSpeach;
import se.hal.intf.HalSpeechToText;
import se.hal.intf.HalTextToSpeech;
import se.hal.struct.devicedata.SwitchEventData;
import se.hal.stt.ManualSTTClient;
import se.hal.tts.MaryRemoteTTSClient;
import se.hal.tts.MaryTTSLocalClient;
import java.util.HashMap;
import java.util.regex.Matcher;
@ -14,12 +14,9 @@ import java.util.regex.Pattern;
/**
* Created with IntelliJ IDEA.
* User: ezivkoc
* Date: 2013-12-17
* Time: 10:59
* This class manages all speech related capabilities for Hal
*/
public class HalSpeechClient {
public class SpeechManager {
private static HashMap<String, SwitchEventData> switches = new HashMap<String, SwitchEventData>();
@ -29,20 +26,17 @@ public class HalSpeechClient {
/********************************************************************/
System.out.println("Initializing STT...");
HalSpeachToText stt =
HalSpeechToText stt =
new ManualSTTClient();
// new GoogleSTTClient();
// new Sphinx4STTClient();
stt.initSTT();
stt.initialize();
/********************************************************************/
System.out.println("Initializing TTS...");
final HalTextToSpeach tts =
// new JarvisTTSClient();
new MaryRemoteTTSClient();
// new MaryLocalTTSClient();
tts.initTTS();
final HalTextToSpeech tts =
new MaryTTSLocalClient();
tts.initialize();
/********************************************************************/
System.out.println("Initializing BOT...");

View file

@ -23,11 +23,11 @@
package se.hal.intf;
/**
* @author Ziver
* A generic interface for Speech to Text analysis
*/
public interface HalSpeachToText {
public interface HalSpeechToText {
void initSTT();
void initialize();
String listen();
}

View file

@ -23,11 +23,11 @@
package se.hal.intf;
/**
* @author Ziver
* A Common interface for Text to Speech generation
*/
public interface HalTextToSpeach {
public interface HalTextToSpeech {
void initTTS();
void initialize();
void speak(String msg);
}

View file

@ -1,123 +0,0 @@
package se.hal.stt;
import com.darkprograms.speech.microphone.MicrophoneAnalyzer;
import com.darkprograms.speech.recognizer.FlacEncoder;
import com.darkprograms.speech.recognizer.GSpeechDuplex;
import com.darkprograms.speech.recognizer.GSpeechResponseListener;
import com.darkprograms.speech.recognizer.GoogleResponse;
import se.hal.intf.HalSpeachToText;
import zutil.io.file.FileUtil;
import javax.sound.sampled.AudioFileFormat;
import java.io.File;
public class GoogleSTTClient implements HalSpeachToText, GSpeechResponseListener {
private MicrophoneAnalyzer mic;
private File audioFile;
private File flacFile;
private int ambientVolume;
private GSpeechDuplex google;
private String response;
@Override
public void initSTT() {
try{
this.mic = new MicrophoneAnalyzer(AudioFileFormat.Type.WAVE);
this.audioFile = File.createTempFile("input", "wav");
this.flacFile = File.createTempFile("input", "flac");
this.google = new GSpeechDuplex("AIzaSyBGAQ29aMvts9MObj739_HYa-tvNeEI0X8");
this.google.addResponseListener(this);
/*System.out.println("Messuring ambient noise...");
mic.captureAudioToFile(audioFile);
Thread.sleep(300);
ambientVolume = mic.getAudioVolume();
Thread.sleep(300);
mic.close();*/
}catch(Exception e){
e.printStackTrace();
}
}
@Override
public synchronized String listen() {
try {
String request = null;
while(request == null){
/*mic.captureAudioToFile(audioFile);
try{Thread.sleep(2000);}catch(Exception e){}
mic.close();*/
FlacEncoder flacEncoder = new FlacEncoder();
//flacEncoder.convertWaveToFlac(audioFile, flacFile);
flacEncoder.convertWaveToFlac(FileUtil.find("edu/cmu/sphinx/demo/speakerid/test.wav"), flacFile);
response = null;
google.recognize(flacFile, 8000);
this.wait();
flacFile.delete();
audioFile.delete();
}
}catch(Exception e){
e.printStackTrace();
}
return response;
}
public String thresholdListen(){
try{
boolean speaking = false;
while(!speaking){
mic.captureAudioToFile(audioFile);
System.out.print("_");
final int THRESHOLD = 10; //YOUR THRESHOLD VALUE.
mic.open();
int speakingVolume = -2;
do{
int volume = mic.getAudioVolume();
if(volume>ambientVolume+THRESHOLD){
speakingVolume = volume;
speaking = true;
System.out.print(".");
Thread.sleep(1000);
}
if(speaking && volume+THRESHOLD<speakingVolume){
break;
}
Thread.sleep(100);
}while(speaking);
mic.close();
}
mic.close();
FlacEncoder flacEncoder = new FlacEncoder();
flacEncoder.convertWaveToFlac(audioFile, flacFile);
response = null;
google.recognize(flacFile, 8000);
this.wait();
flacFile.delete();
}catch(Exception e){
e.printStackTrace();
}
return response;
}
@Override
public void onResponse(GoogleResponse googleResponse) {
response = googleResponse.getResponse();
this.notifyAll();
}
}

View file

@ -22,17 +22,17 @@
package se.hal.stt;
import se.hal.intf.HalSpeachToText;
import se.hal.intf.HalSpeechToText;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ManualSTTClient implements HalSpeachToText {
public class ManualSTTClient implements HalSpeechToText {
private BufferedReader in;
@Override
public void initSTT() {
public void initialize() {
// open up standard input
in = new BufferedReader(new InputStreamReader(System.in));
}

View file

@ -25,7 +25,7 @@ package se.hal.stt;
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.LiveSpeechRecognizer;
import edu.cmu.sphinx.api.SpeechResult;
import se.hal.intf.HalSpeachToText;
import se.hal.intf.HalSpeechToText;
import java.io.IOException;
@ -33,11 +33,11 @@ import java.io.IOException;
/**
* Created by Ziver on 2015-05-08.
*/
public class Sphinx4STTClient implements HalSpeachToText {
public class Sphinx4STTClient implements HalSpeechToText {
private LiveSpeechRecognizer recognizer;
@Override
public void initSTT() {
public void initialize() {
Configuration configuration = new Configuration();
// Set path to acoustic model.

View file

@ -1,101 +0,0 @@
/*
* Copyright (c) 2013 ezivkoc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.tts;
import com.darkprograms.speech.synthesiser.SynthesiserV2;
import javafx.embed.swing.JFXPanel;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import se.hal.intf.HalTextToSpeach;
import java.io.*;
import java.net.URISyntaxException;
import java.net.URL;
/**
* Created with IntelliJ IDEA.
* User: ezivkoc
* Date: 2013-12-17
* Time: 13:45
*/
public class GoogleTTSClient implements HalTextToSpeach {
private static final String API_KEY = "AIzaSyBGAQ29aMvts9MObj739_HYa-tvNeEI0X8";
private SynthesiserV2 synthesiser;
private File tmpAudioFile;
public void initTTS() {
try {
// JavaFX should be initialized
JFXPanel fxPanel = new JFXPanel();
synthesiser = new SynthesiserV2(API_KEY);
tmpAudioFile = File.createTempFile("tts", "tmp");
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void speak(String msg) {
try{
String language = synthesiser.detectLanguage(msg);
InputStream is = synthesiser.getMP3Data(msg);
BufferedInputStream buff = new BufferedInputStream(is);
DataInputStream di = new DataInputStream(buff);
FileOutputStream fos = new FileOutputStream(tmpAudioFile);
while(di.available() != 0){
fos.write(di.readByte());
}
fos.close();
URL resource = tmpAudioFile.toURI().toURL();
Media media = new Media(resource.toURI().toString());
final MediaPlayer mediaPlayer = new MediaPlayer(media);
mediaPlayer.play();
mediaPlayer.setOnEndOfMedia(new Runnable() {
@Override public void run() {
mediaPlayer.stop();
}
});
while(mediaPlayer.getStatus() != MediaPlayer.Status.STOPPED){
try{Thread.sleep(200);}catch(Exception e){}
}
}catch(URISyntaxException e){
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -1,72 +0,0 @@
/*
* Copyright (c) 2013 ezivkoc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.tts;
import marytts.MaryInterface;
import marytts.client.RemoteMaryInterface;
import marytts.exceptions.SynthesisException;
import marytts.util.data.audio.AudioPlayer;
import se.hal.intf.HalTextToSpeach;
import javax.sound.sampled.AudioInputStream;
import java.io.IOException;
import java.util.Set;
/**
* Created with IntelliJ IDEA.
* User: ezivkoc
* Date: 2013-12-17
* Time: 14:36
*/
public class MaryRemoteTTSClient implements HalTextToSpeach {
private MaryInterface marytts;
@Override
public void initTTS() {
try {
marytts = new RemoteMaryInterface("127.0.0.1", 59125);
Set<String> voices = marytts.getAvailableVoices();
marytts.setVoice(voices.iterator().next());
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}
@Override
public synchronized void speak(String msg) {
try {
AudioInputStream audio = marytts.generateAudio(msg);
AudioPlayer player = new AudioPlayer(audio);
player.start();
player.join();
} catch (SynthesisException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

View file

@ -27,23 +27,20 @@ import marytts.MaryInterface;
import marytts.exceptions.MaryConfigurationException;
import marytts.exceptions.SynthesisException;
import marytts.util.data.audio.AudioPlayer;
import se.hal.intf.HalTextToSpeach;
import se.hal.intf.HalTextToSpeech;
import javax.sound.sampled.AudioInputStream;
import java.util.Set;
/**
* Created with IntelliJ IDEA.
* User: ezivkoc
* Date: 2013-12-17
* Time: 14:36
*
*/
public class MaryLocalTTSClient implements HalTextToSpeach {
public class MaryTTSLocalClient implements HalTextToSpeech {
private MaryInterface marytts;
@Override
public void initTTS() {
public void initialize() {
try {
marytts = new LocalMaryInterface();
Set<String> voices = marytts.getAvailableVoices();

View file

@ -1,83 +0,0 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.test;
import zutil.io.DynamicByteArrayStream;
import javax.sound.sampled.*;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
/**
* Created with IntelliJ IDEA.
* User: ezivkoc
* Date: 2013-12-17
* Time: 11:24
*/
public class GoogleTTSTest {
public static void main(String[] args){
try {
/* URL url = new URL("http://translate.google.com/translate_tts?q=I+love+techcrunch");
InputStream in = url.openStream();
byte[] data = getContent(in);
in.close();
*/
Clip push = AudioSystem.getClip();
URL url = new URL("http://translate.google.com/translate_tts?ie=UTF-8&q=Hello%20World&tl=en-us");
URLConnection con = url.openConnection();
con.setRequestProperty("Cookie", "JSESSIONID=UX61oaN8vRhLE5pYXAjTWg; _ga=GA1.3.53937642.1385651778; HSID=AINSMauAFJWBs84WQ; APISID=RgytV3HJnm0dWjVr/AtidsIB_LJQzDmBMc; NID=67=R0kMLqIXXiOkrU8jlk4vgqLUiWUYUZRvxjf1Un0DQbQxGKt9pXXzDv-v0zSCSqLi_YNzcZujTDDr9r_KGsiPhEMfk-oKQSKvHe-DVVuwHZb2UZraJKCBAb6mPJO6AxBExoXHzU2pHd-DI1yIMxuLyVJA9RxhM_2kB4h7U0w9WiWqRNN7sU5DPVeLpF_ScW1VH9_igIR2ACK0WHvmoZXBjXDDrnUiVJt9DjkbMpHxU1o_1PnuUXi5FmfJLjrQspI; SID=DQAAANgAAADcaXZk9dA01UfdydUwIH32OGbA0k6mhbV2GSsiqcGYTUhNqLn_Z9TAlUsizBVoG-3g-ghXzpev46P--fqcR4UACZ2iVawFbfUB44B2hBmQQsFbyjGop1smPLu3cJORBLUKQ4PiZQb23GtXYg28prWlK3IFj8Wc3AHY5yoIpnssRY24k9DybwSSVt2Ww7c4ySzfw4uXxwtbSDTy0q8lmdAorjT4R6DCJwhaCGV4ysexY-vJaQE2kiRe3fPY2z9jQ6Mi9z_XjGRamLTI_AvJj-_XdQIfv0ZSo7JiEEjTUMb10Q; PREF=ID=8bf4d3a7414e8137:U=4ebb392cf34740cf:LD=sv:CR=2:TM=1368543367:LM=1387278509:GM=1:SG=1:S=fpteokIgX46FW8tp");
con.connect();
AudioInputStream audioPush = AudioSystem.getAudioInputStream(con.getInputStream());
push.open(audioPush);
push.start();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
} catch (LineUnavailableException e) {
e.printStackTrace();
}
}
public static byte[] getContent(InputStream stream) throws IOException{
BufferedInputStream in = new BufferedInputStream(stream);
byte[] tmp = new byte[256];
int len;
DynamicByteArrayStream buff = new DynamicByteArrayStream();
while((len=in.read(tmp)) != -1){
buff.append(tmp, 0, len);
}
return buff.getBytes();
}
}

View file

@ -1,198 +0,0 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.test;
import com.darkprograms.speech.microphone.MicrophoneAnalyzer;
import com.darkprograms.speech.recognizer.FlacEncoder;
import com.darkprograms.speech.recognizer.GoogleResponse;
import javax.sound.sampled.AudioFileFormat;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class JarvisRecognizerTest {
public static void main(String[] args){
try {
new JarvisRecognizerTest();
} catch (Exception e) {
e.printStackTrace();
}
}
public JarvisRecognizerTest() throws Exception{
MicrophoneAnalyzer mic = new MicrophoneAnalyzer(AudioFileFormat.Type.WAVE);
File audioFile = new File("bin/tmp.wav");
boolean speaking = false;
while(!speaking){
mic.captureAudioToFile(audioFile);
final int THRESHOLD = 10;//YOUR THRESHOLD VALUE.
mic.open();
int ambientVolume = mic.getAudioVolume();//
int speakingVolume = -2;
do{
int volume = mic.getAudioVolume();
System.out.println(volume);
if(volume>ambientVolume+THRESHOLD){
speakingVolume = volume;
speaking = true;
Thread.sleep(1000);
System.out.println("SPEAKING");
}
if(speaking && volume+THRESHOLD<speakingVolume){
break;
}
}while(speaking);
mic.close();
}
Thread.sleep(100);
mic.close();
FlacEncoder flacEncoder = new FlacEncoder();
File flacFile = new File(audioFile + ".flac");
flacEncoder.convertWaveToFlac(audioFile, flacFile);
audioFile.delete();
Path path = Paths.get("bin/tmp.wav.flac");
byte[] data = Files.readAllBytes(path);
String request = "https://www.google.com/"+
"speech-api/v1/recognize?"+
"xjerr=1&client=speech2text&lang=en-US&maxresults=1";
URL url = new URL(request);
Proxy proxy =new Proxy(Proxy.Type.HTTP, new InetSocketAddress("www-proxy.ericsson.se", 8080));
HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy);
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "audio/x-flac; rate=8000");
connection.setRequestProperty("User-Agent", "speech2text");
connection.setConnectTimeout(60000);
connection.setUseCaches (false);
DataOutputStream wr = new DataOutputStream(connection.getOutputStream ());
wr.write(data);
wr.flush();
wr.close();
connection.disconnect();
flacFile.delete();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String decodedString = in.readLine();
GoogleResponse googleResponse = new GoogleResponse();
parseResponse(decodedString, googleResponse);
System.out.println(googleResponse);
}
private void parseResponse(String rawResponse, GoogleResponse googleResponse) {
if(rawResponse == null)
return;
if (!rawResponse.contains("utterance"))
return;
String array = substringBetween(rawResponse, "[", "]");
String[] parts = array.split("}");
boolean first = true;
for( String s : parts ) {
if( first ) {
first = false;
String utterancePart = s.split(",")[0];
String confidencePart = s.split(",")[1];
String utterance = utterancePart.split(":")[1];
String confidence = confidencePart.split(":")[1];
utterance = stripQuotes(utterance);
confidence = stripQuotes(confidence);
if( utterance.equals("null") ) {
utterance = null;
}
if( confidence.equals("null") ) {
confidence = null;
}
//googleResponse.setResponse(utterance);
//googleResponse.setConfidence(confidence);
} else {
String utterance = s.split(":")[1];
utterance = stripQuotes(utterance);
if( utterance.equals("null") ) {
utterance = null;
}
googleResponse.getOtherPossibleResponses().add(utterance);
}
}
}
private String substringBetween(String s, String part1, String part2) {
String sub = null;
int i = s.indexOf(part1);
int j = s.indexOf(part2, i + part1.length());
if (i != -1 && j != -1) {
int nStart = i + part1.length();
sub = s.substring(nStart, j);
}
return sub;
}
private String stripQuotes(String s) {
int start = 0;
if( s.startsWith("\"") ) {
start = 1;
}
int end = s.length();
if( s.endsWith("\"") ) {
end = s.length() - 1;
}
return s.substring(start, end);
}
}

View file

@ -1,85 +0,0 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.test;
import com.darkprograms.speech.synthesiser.Synthesiser;
import javafx.application.Application;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.stage.Stage;
import java.io.*;
import java.net.URL;
@SuppressWarnings("restriction")
public class JarvisSyntersizerTest extends Application {
public static void main(String[] args){
try {
Application a = new JarvisSyntersizerTest();
a.launch();
} catch (Exception e) {
e.printStackTrace();
}
}
public JarvisSyntersizerTest(){
}
/**
* Returns the URL to the given file
*
* @param path is the path to the file (no / if not absolute path)
* @return A URL object for the file
*/
public static URL findURL(String path){
return Thread.currentThread().getContextClassLoader().getResource(path);
}
@Override
public void start(Stage arg0) throws Exception {
Synthesiser synthesiser = new Synthesiser("auto");
String language = synthesiser.detectLanguage("hi what is your name?");
System.out.println(language);
InputStream is = synthesiser.getMP3Data("hi what is your name?");
BufferedInputStream buff = new BufferedInputStream(is);
DataInputStream di = new DataInputStream(buff);
File f = new File("bin\\tmp.mp3");
FileOutputStream fos = new FileOutputStream(f);
while(di.available() != 0){
fos.write(di.readByte());
}
fos.close();
URL resource = findURL("tmp.mp3");
Media hit = new Media(resource.toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(hit);
mediaPlayer.play();
}
}

View file

@ -1,63 +0,0 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.test;
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.LiveSpeechRecognizer;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.result.WordResult;
public class LiveSpeechRecognizerTest {
public static void main(String[] args) throws Exception {
System.out.println("Loading models...");
Configuration configuration = new Configuration();
// Set path to acoustic model.
configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
// Set path to dictionary.
configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
// Set language model.
configuration.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.dmp");
System.out.println("Listening...");
LiveSpeechRecognizer recognizer = new LiveSpeechRecognizer(configuration);
// Start recognition process pruning previously cached data.
recognizer.startRecognition(false);
SpeechResult result = recognizer.getResult();
// Pause recognition process. It can be resumed then with startRecognition(false).
recognizer.stopRecognition();
// Print utterance string without filler words.
System.out.println("Hypothesis: " + result.getHypothesis());
// Get individual words and their times.
for (WordResult r : result.getWords()) {
System.out.println("Word: "+r);
}
// Save lattice in a graphviz format.
result.getLattice().dumpDot("lattice.dot", "lattice");
}
}

View file

@ -1,50 +0,0 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.test;
import marytts.MaryInterface;
import marytts.client.RemoteMaryInterface;
import marytts.util.data.audio.AudioPlayer;
import javax.sound.sampled.AudioInputStream;
import java.util.Set;
/**
* Created with IntelliJ IDEA.
* User: ezivkoc
* Date: 2013-12-17
* Time: 12:39
*/
public class MaryTTS {
public static void main(String[] args) throws Exception {
MaryInterface marytts = new RemoteMaryInterface("127.0.0.1", 59125);
Set<String> voices = marytts.getAvailableVoices();
marytts.setVoice(voices.iterator().next());
AudioInputStream audio = marytts.generateAudio("Hello world.");
AudioPlayer player = new AudioPlayer(audio);
player.start();
player.join();
System.exit(0);
}
}

View file

@ -1,86 +0,0 @@
/*
* Copyright (c) 2015 Ziver
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package se.hal.test;
import com.darkprograms.speech.microphone.MicrophoneAnalyzer;
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.api.StreamSpeechRecognizer;
import edu.cmu.sphinx.result.WordResult;
import javax.sound.sampled.AudioFileFormat;
import java.io.File;
import java.io.FileInputStream;
/**
* A simple example that shows how to transcribe a continuous audio file that
* has multiple utterances in it.
*/
public class TranscriberDemo {
public static void main(String[] args) throws Exception {
System.out.println("Loading models...");
Configuration configuration = new Configuration();
// Load model from the jar
configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
// You can also load model from folder
// configuration.setAcousticModelPath("file:en-us");
configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.dmp");
MicrophoneAnalyzer mic = new MicrophoneAnalyzer(AudioFileFormat.Type.WAVE);
StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);
File audioFile = File.createTempFile("input", "wav");
while(true) {
System.out.println("Listening...");
mic.captureAudioToFile(audioFile);
try {
Thread.sleep(3000);
} catch (Exception e) {}
mic.close();
System.out.println("Done");
// Simple recognition with generic model
recognizer.startRecognition(new FileInputStream(audioFile));
SpeechResult result;
while ((result = recognizer.getResult()) != null) {
System.out.format("Hypothesis: %s\n", result.getHypothesis());
System.out.println("List of recognized words and their times:");
for (WordResult r : result.getWords()) {
System.out.println(r);
}
System.out.println("Best 3 hypothesis:");
for (String s : result.getNbest(3))
System.out.println(s);
}
recognizer.stopRecognition();
}
}
}