小编raj*_*115的帖子

在Python中的AWS polly示例示例?

我第一次尝试AWS服务.我必须将AWS polly与星号集成,用于文本到语音.

这里是我编写的用于将文本转换为语音的示例代码

from boto3 import  client
import boto3
import StringIO
from contextlib import closing

polly = client("polly", 'us-east-1' )
response = polly.synthesize_speech(
    Text="Good Morning. My Name is Rajesh. I am Testing Polly AWS Service For Voice Application.",
    OutputFormat="mp3",
    VoiceId="Raveena")

print(response)

if "AudioStream" in response:
    with closing(response["AudioStream"]) as stream:
        data = stream.read()
        fo = open("pollytest.mp3", "w+")
        fo.write( data )
        fo.close()
Run Code Online (Sandbox Code Playgroud)

我收到了以下错误.

Traceback (most recent call last):
  File "pollytest.py", line 11, in <module>
    VoiceId="Raveena")
  File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 253, in _api_call
    return …
Run Code Online (Sandbox Code Playgroud)

asterisk amazon-web-services amazon-polly

5
推荐指数
1
解决办法
2029
查看次数

如何为我的自定义函数生成非空参数的警告?

我正在尝试编写一个库函数,其中参数不应为空,并且希望如果有人尝试传递 NULL,gcc 应该生成警告。我的代码是

\n\n
#include <stdio.h>\n#include <string.h>\nint own_strcmp(const char *str1, const char *str2)\n{\n        if( str1 == NULL || str2 == NULL){\n            if(str1 == NULL && str2 == NULL) \n                return 0;\n            else if( str1 == NULL)\n                return str2[0];\n            else\n                return str1[0];\n        }\n        int i=0;\n        while(str1[i] && str2[i]){\n                if( str1[i] != str2[i]){\n                        break;\n                }\n                i++;\n        }\n        return str1[i]-str2[i];\n}\n\n\n\nint main(int argc, char *argv[]){\n        const char *str1 = "hello";\n        const char *str2 = "hello";\n        printf("%s and %s is %d\\n", str1, str2, own_strcmp(NULL, str2));\n …
Run Code Online (Sandbox Code Playgroud)

c gcc

1
推荐指数
1
解决办法
3493
查看次数

标签 统计

amazon-polly ×1

amazon-web-services ×1

asterisk ×1

c ×1

gcc ×1