festival-1.4.3.diff 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. diff -u -r festival-1.4.3/lib/tts.scm festival-1.4.3-asterisk/lib/tts.scm
  2. --- festival-1.4.3/lib/tts.scm 2003-01-09 07:39:22.000000000 -0800
  3. +++ festival-1.4.3-asterisk/lib/tts.scm 2003-08-14 12:07:00.000000000 -0700
  4. @@ -234,6 +234,17 @@
  5. (utt.synth
  6. (eval (list 'Utterance 'Text string))))))
  7. +;; begin tts_textasterisk
  8. +(define (tts_textasterisk string mode)
  9. + "(tts_textasterisk STRING MODE)
  10. +Apply tts to STRING. This function is specifically designed for
  11. +use in server mode so a single function call may synthesize the string.
  12. +This function name may be added to the server safe functions."
  13. + (utt.send.wave.asterisk
  14. + (utt.synth
  15. + (eval (list 'Utterance 'Text string)))))
  16. +;; end tts_textasterisk
  17. +
  18. (define (tts_return_to_client)
  19. "(tts_return_to_client)
  20. This function is called by clients who wish to return waveforms of
  21. diff -u -r festival-1.4.3/src/arch/festival/wave.cc festival-1.4.3-asterisk/src/arch/festival/wave.cc
  22. --- festival-1.4.3/src/arch/festival/wave.cc 2003-01-13 11:09:55.000000000 -0800
  23. +++ festival-1.4.3-asterisk/src/arch/festival/wave.cc 2003-08-14 12:10:53.000000000 -0700
  24. @@ -381,6 +381,7 @@
  25. type = "nist";
  26. else
  27. type = get_c_string(ltype);
  28. +
  29. w->save(tmpfile,type);
  30. #ifdef WIN32
  31. send(ft_server_socket,"WV\n",3,0);
  32. @@ -393,6 +394,44 @@
  33. return utt;
  34. }
  35. +// begin utt_send_wave_asterisk()
  36. +static LISP utt_send_wave_asterisk(LISP utt)
  37. +{
  38. + // Send the waveform to a client (must be acting as server)
  39. + EST_Utterance *u = utterance(utt);
  40. + EST_Wave *w;
  41. + EST_String tmpfile = make_tmp_filename();
  42. + LISP ltype;
  43. + EST_String type;
  44. +
  45. + w = get_utt_wave(u);
  46. + if (ft_server_socket == -1)
  47. + {
  48. + cerr << "utt_send_wave_client: not in server mode" << endl;
  49. + festival_error();
  50. + }
  51. +
  52. + ltype = ft_get_param("Wavefiletype");
  53. + if (ltype == NIL)
  54. + type = "nist";
  55. + else
  56. + type = get_c_string(ltype);
  57. + w->resample(8000);
  58. + w->rescale(5);
  59. +
  60. + w->save(tmpfile,type);
  61. +#ifdef WIN32
  62. + send(ft_server_socket,"WV\n",3,0);
  63. +#else
  64. + write(ft_server_socket,"WV\n",3);
  65. +#endif
  66. + socket_send_file(ft_server_socket,tmpfile);
  67. + unlink(tmpfile);
  68. +
  69. + return utt;
  70. +}
  71. +// end utt_send_wave_asterisk()
  72. +
  73. static LISP send_sexpr_to_client(LISP l)
  74. {
  75. EST_String tmpfile = make_tmp_filename();
  76. @@ -465,6 +504,15 @@
  77. "(utt.send.wave.client UTT)\n\
  78. Sends wave in UTT to client. If not in server mode gives an error\n\
  79. Note the client must be expecting to receive the waveform.");
  80. +
  81. +// begin asterisk mod
  82. + init_subr_1("utt.send.wave.asterisk",utt_send_wave_asterisk,
  83. + "(utt.send.wave.asterisk UTT)\n\
  84. + Sends wave in UTT to client. If not in server mode gives an error\n\
  85. + Note the client must be expecting to receive the waveform. The waveform\n\
  86. + is rescaled and resampled according to what asterisk needs");
  87. +// end asterisk mod
  88. +
  89. init_subr_1("send_sexpr_to_client", send_sexpr_to_client,
  90. "(send_sexpr_to_client SEXPR)\n\
  91. Sends given sexpression to currently connected client.");