diff --git a/Jarvis-test/__pycache__/utilities.cpython-34.pyc b/Jarvis-test/__pycache__/utilities.cpython-34.pyc new file mode 100644 index 0000000..74dd29b Binary files /dev/null and b/Jarvis-test/__pycache__/utilities.cpython-34.pyc differ diff --git a/Jarvis-test/__pycache__/vlc.cpython-34.pyc b/Jarvis-test/__pycache__/vlc.cpython-34.pyc new file mode 100644 index 0000000..c1c8d86 Binary files /dev/null and b/Jarvis-test/__pycache__/vlc.cpython-34.pyc differ diff --git a/Jarvis-test/__pycache__/weather.cpython-34.pyc b/Jarvis-test/__pycache__/weather.cpython-34.pyc new file mode 100644 index 0000000..96226bb Binary files /dev/null and b/Jarvis-test/__pycache__/weather.cpython-34.pyc differ diff --git a/Jarvis-test/drivers/__init__.py b/Jarvis-test/drivers/__init__.py new file mode 100644 index 0000000..74ef7da --- /dev/null +++ b/Jarvis-test/drivers/__init__.py @@ -0,0 +1,17 @@ +''' +Speech driver implementations. + +Copyright (c) 2009, 2013 Peter Parente + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, 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. +''' \ No newline at end of file diff --git a/Jarvis-test/drivers/__init__.pyc b/Jarvis-test/drivers/__init__.pyc new file mode 100644 index 0000000..bd6be17 Binary files /dev/null and b/Jarvis-test/drivers/__init__.pyc differ diff --git a/Jarvis-test/drivers/__pycache__/__init__.cpython-34.pyc b/Jarvis-test/drivers/__pycache__/__init__.cpython-34.pyc new file mode 100644 index 0000000..efd5ba2 Binary files /dev/null and b/Jarvis-test/drivers/__pycache__/__init__.cpython-34.pyc differ diff --git a/Jarvis-test/drivers/__pycache__/dummy.cpython-34.pyc b/Jarvis-test/drivers/__pycache__/dummy.cpython-34.pyc new file mode 100644 index 0000000..d272988 Binary files /dev/null and b/Jarvis-test/drivers/__pycache__/dummy.cpython-34.pyc differ diff --git a/Jarvis-test/drivers/__pycache__/nsss.cpython-34.pyc b/Jarvis-test/drivers/__pycache__/nsss.cpython-34.pyc new file mode 100644 index 0000000..c93cdaf Binary files /dev/null and b/Jarvis-test/drivers/__pycache__/nsss.cpython-34.pyc differ diff --git a/Jarvis-test/drivers/_espeak.py b/Jarvis-test/drivers/_espeak.py new file mode 100644 index 0000000..a3c0fcd --- /dev/null +++ b/Jarvis-test/drivers/_espeak.py @@ -0,0 +1,460 @@ +'''espeak.py a thin ctypes wrapper for the espeak dll + +Gary Bishop +July 2007 +Modified October 2007 for the version 2 interface to espeak and more pythonic interfaces + +Free for any use. +''' + +import ctypes +from ctypes import cdll, c_int, c_char_p, c_wchar_p, POINTER, c_short, c_uint, c_long, c_void_p +from ctypes import CFUNCTYPE, byref, Structure, Union, c_wchar, c_ubyte, c_ulong +import time + +def cfunc(name, dll, result, *args): + '''build and apply a ctypes prototype complete with parameter flags''' + atypes = [] + aflags = [] + for arg in args: + atypes.append(arg[1]) + aflags.append((arg[2], arg[0]) + arg[3:]) + return CFUNCTYPE(result, *atypes)((name, dll), tuple(aflags)) + +dll = cdll.LoadLibrary('libespeak.so.1') + +# constants and such from speak_lib.h + +EVENT_LIST_TERMINATED = 0 +EVENT_WORD = 1 +EVENT_SENTENCE = 2 +EVENT_MARK = 3 +EVENT_PLAY = 4 +EVENT_END = 5 +EVENT_MSG_TERMINATED = 6 + +class numberORname(Union): + _fields_ = [ + ('number', c_int), + ('name', c_char_p) + ] + +class EVENT(Structure): + _fields_ = [ + ('type', c_int), + ('unique_identifier', c_uint), + ('text_position', c_int), + ('length', c_int), + ('audio_position', c_int), + ('sample', c_int), + ('user_data', c_void_p), + ('id', numberORname) + ] + +AUDIO_OUTPUT_PLAYBACK = 0 +AUDIO_OUTPUT_RETRIEVAL = 1 +AUDIO_OUTPUT_SYNCHRONOUS = 2 +AUDIO_OUTPUT_SYNCH_PLAYBACK = 3 + +EE_OK = 0 +EE_INTERNAL_ERROR = -1 +EE_BUFFER_FULL = 1 +EE_NOT_FOUND = 2 + +Initialize = cfunc('espeak_Initialize', dll, c_int, + ('output', c_int, 1, AUDIO_OUTPUT_PLAYBACK), + ('bufflength', c_int, 1, 100), + ('path', c_char_p, 1, None), + ('option', c_int, 1, 0)) +Initialize.__doc__ = '''Must be called before any synthesis functions are called. + output: the audio data can either be played by eSpeak or passed back by the SynthCallback function. + buflength: The length in mS of sound buffers passed to the SynthCallback function. + path: The directory which contains the espeak-data directory, or NULL for the default location. + options: bit 0: 1=allow espeakEVENT_PHONEME events. + + Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR).''' + +t_espeak_callback = CFUNCTYPE(c_int, POINTER(c_short), c_int, POINTER(EVENT)) + +cSetSynthCallback = cfunc('espeak_SetSynthCallback', dll, None, + ('SynthCallback', t_espeak_callback, 1)) +SynthCallback = None +def SetSynthCallback(cb): + global SynthCallback + SynthCallback = t_espeak_callback(cb) + cSetSynthCallback(SynthCallback) + +SetSynthCallback.__doc__ = '''Must be called before any synthesis functions are called. + This specifies a function in the calling program which is called when a buffer of + speech sound data has been produced. + + + The callback function is of the form: + +int SynthCallback(short *wav, int numsamples, espeak_EVENT *events); + + wav: is the speech sound data which has been produced. + NULL indicates that the synthesis has been completed. + + numsamples: is the number of entries in wav. This number may vary, may be less than + the value implied by the buflength parameter given in espeak_Initialize, and may + sometimes be zero (which does NOT indicate end of synthesis). + + events: an array of espeak_EVENT items which indicate word and sentence events, and + also the occurance if and