aws / aws-sdk-cpp

AWS SDK for C++
Apache License 2.0
1.97k stars 1.06k forks source link

Add more Polly C++ examples / tutorials #968

Closed dreaming-augustin closed 4 years ago

dreaming-augustin commented 6 years ago

Hello,

I just started using Amazon Polly with the C++ sdk.

I struggled for a few days before achieving something very basic (getting a mp3 stream and saving to file). I found the official documentation to be lacking. The Amazon Polly documentation does not include any C++ code samples. And the aws-sdk-cpp documentation does not include any Amazon Polly code samples.

For a few days, I was mislead by https://aws.amazon.com/blogs/developer/cross-platform-text-to-speech-for-c-with-amazon-polly/ and https://github.com/aws/aws-sdk-cpp/tree/master/aws-cpp-sdk-polly-sample as it is demonstrating a functionality that is completely different than the one I was trying to achieve. I am on gentoo/linux without pulseaudio installed, and I kept wondering why do I need to install pulseaudio since the speech is supposed to be generated by the Amazon Polly server? I wanted to get a mp3 stream and either save it to file, or stream it forward to the client's web browser.

I finally achieved my first significant step thanks to https://github.com/kPanesar/aws-cpp-sdk-example , which I fortunately found after a few days of searching.

My difficulties can be easily explained by the fact that I am a beginner developer, with little experience working with streams. Still, it would be nice having a more comprehensive tutorials and code samples of the Amazon Polly with aws-sdk-cpp.

I obviously spent a lot of time consulting the available official documentation, including https://sdk.amazonaws.com/cpp/api/LATEST/namespace_aws_1_1_polly.html but some extra code samples that can be compiled independently (linux/gcc/cmake) would be helpful for beginners, something like kPanesar/aws-cpp-sdk-example, but covering more aspects of Polly with C++.

For my part, I have a web server application coded in C++. I just found out how to get and save the mp3 stream to file. Now, I'll try to figure out how to forward the stream to the client's web browser... After that, I think the existing documentation should be enough for me to progress more smoothly.

Thanks a lot. :)

singku commented 6 years ago

Based on Polly's doc here: https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html

The solution is actually pretty straightforward. It's no more than creating a polly client and make a request then get the response. Part of the example here https://github.com/aws/aws-sdk-cpp/blob/095f7ab48b3834243cf8edcf551439ea67f7561e/aws-cpp-sdk-text-to-speech-tests/TextToSpeechManagerTests.cpp#L339 did the job and even send the stream to a output device.

I think your problem is about extracting the stream from response and save it to a file.

dreaming-augustin commented 6 years ago

kPanesar's code sample, linked above, provides an easy to understand sample on how to extract the stream to save it to file.

I find that the documentation is generally very good and extensive. I was pointing out one specific area where it's lacking. It's up to Amazon employees to decide whether they want to improve it for the sake of future new customers, so that they don't struggle the way I did...

dreaming-augustin commented 6 years ago

In the linked issue (see above), kPanesar just wrote:

Hi, I'm glad it helped! I struggled with it as well in the beginning. AWS can certainly do a much better job at providing proper examples.

singku commented 6 years ago

Hi, thanks for the suggestion. We have a team actively working on adding SDK examples. https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/cpp We are trying our best to cover as many use cases as possible but obviously this is one of missed examples. While we are adding them, you are welcome to make a PR to contribute to that repo.

dreaming-augustin commented 6 years ago

aws-doc-sdk-examples does not include any Polly examples, which proves our point.

I hope I am not being misunderstood. I am not demanding anything nor requesting personal support, here. I filed this issue as a matter of courtesy, to share my personal experience, should you find such feedback useful in order to improve your customer support. I am appreciative of individual Amazon employees like yourself who I am sure do their best, bound by their company's policies, under the order of their bosses, and within their own time constraints.

As to me contributing more with a PR: I do not have the skills, nor the time nor the inclination to do so. I am still struggling with the very basics! I am already contributing by the present feedback, and by being a customer of Amazon AWS.

github-actions[bot] commented 4 years ago

Greetings! Sorry to say but this is a very old issue that is probably not getting as much attention as it deservers. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one.