Do you know the limits of deferred and recursion times? Here is a good example, you can see
| 1 2 3 4 5 6 7 8 9 10 |
function Runasynctts (Text,speecher,audiopath) {var def = jquery.deferred (); var args = {"Synthtext": Text, "Voicespeecher": Speecher, "Wordspeed": "3", "USECSSML": "0", "audiopath": audiopath}; Tts.asynctts (Json.stringify (args), function (Err,result) {def.resolve (result); }); return Def.promise (); } |
function Texttospeechbat (Metajson, Speecher, audiopath) { var def = $. Deferred (); var result = {originalwords: "", resultjsonarr:[]}; var jsons= ""; for (Var index=0;index < metajson.words.length;index++) { var audioname = metajson.words[index][' audio ']; audioName = Audioname.replace ('. mp3 ', '); var audiofile = audiopath + "/" + Audioname + '. wav '; var args = ' {' Synthtext ': " ' +metajson.words[index][' word ']+ ', "Voicespeecher": "' +speecher+ '", "Wordspeed": "3", "USECSSML": "0", "audiopath": "' +audiofile+ ' "} '; jsons + = args +" | "; } jsons = Jsons.substr (0,jsons.length-1); Tts.asyncttsbat (jsons,function (err,ret) { result[' Resultjsonarr '] = ret.split (' | '); Def.resolve (Result); }); return Def.promise (); }
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 This is the |
|