Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Which of these is a better style? Is there much of a difference?
- def createMicrosoftAudio0(utterance: Utterance, svc: MsSynthSvc = MicrosoftSpeech.Synthesize): Future[SynthesizedSpeech] = {
- if(!utterance.text.isDefined) return Future.exception(new UtteranceTextNotFound(utterance))
- val req = SynthesizeRequest(utterance.convo.id, utterance.text.get)
- for {
- resp <- svc(req)
- } yield SynthesizedSpeed(resp._1, resp._2)
- }
- def createMicrosoftAudio1(utterance: Utterance, svc: MsSynthSvc = MicrosoftSpeech.Synthesize): Future[SynthesizedSpeech] = {
- if(utterance.emptyText) return Future.exception(new UtteranceTextNotFound(utterance))
- val req = SynthesizeRequest.fromUtterance(utterance)
- svc(req).map(SynthesizedSpeech)
- }
Add Comment
Please, Sign In to add comment