festival-1.4.2.diff 2.6 KB

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