Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement this with streaming? [Question] #39

Open
roimulia2 opened this issue Apr 2, 2023 · 3 comments
Open

How to implement this with streaming? [Question] #39

roimulia2 opened this issue Apr 2, 2023 · 3 comments
Labels
community question Further information is requested waiting for response When the developer has responded and is awaiting more information.

Comments

@roimulia2
Copy link

Hey! I Loved the framework.

We are working on an app that gets "chunks" of text (like a bot) from an API. We want to sync the API calls with the Speech.
So we get something like:

"Hey"
"Hey There"
"Hey There Cute Puppy"

I assume we need an internal manager to feed the OSSVoice() object with the correct String. My question is, how can I properly achieve this from the framework perspective? Should I stop and re-speakText every time?

@AppDevGuy AppDevGuy added question Further information is requested waiting for response When the developer has responded and is awaiting more information. community labels Apr 3, 2023
@AppDevGuy
Copy link
Owner

Hi @roimulia2, thanks for your kind works.

I assume you mean that you are receiving a stream of strings so you want to speak each string as it is received by your app? If so, then yes, you would need to ask the app to speak after each string is received in the stream so the stream would be:

"Hey there cute puppy"

As each word comes through you would call speechKit.speakText(text: $0) so it would be:

speechKit.speakText(text: "Hey")
speechKit.speakText(text: "There")
speechKit.speakText(text: "Cute")
speechKit.speakText(text: "Puppy")

Alternatively you could wait for the entire string to be received and call speechKit.speakText(text: "Hey there cute puppy") just the one time.

If I have misunderstood your question let me know.

@roimulia2
Copy link
Author

Hey @AppDevGuy! Thank you for your response.
This is an example input we are getting (streamed):

In
 the
 morning
 light

 the
 world
 aw
akes


The
 birds
 sing
In
 the
 still
ness
 of
 the
 night,

Each line is the chunk we get. If I'll do speechKit.speakText(text: $0) It'll just speak the last word without the rest. I wonder if I should build my own service that will "queue" all the input from the stream and will check when the OSSpeech is finished, or do you have a better idea on how to achieve this?

Thank you!

@roimulia2
Copy link
Author

I just saw that private var speechSynthesizer: AVSpeechSynthesizer!, I think it'll be useful to make it public so I can listen to the didFinished delegate (to handle the queue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community question Further information is requested waiting for response When the developer has responded and is awaiting more information.
Projects
None yet
Development

No branches or pull requests

2 participants