我正在参考这个链接,讨论Google语音引擎.它说我必须从谷歌获得API密钥,才能使用他们正在讨论的谷歌语音引擎.在发布的链接中,他们显示了激活Speech API密钥的图像.
但是,当我访问API站点时,我找不到任何相关信息Speech API.
是否没有更多用于Speech API的API密钥?或者不需要使用它们?值得理解的是,这种语音API允许上传flac文件,这与其他文件完全不同.
api speech-recognition chromium voice-recognition google-speech-api
我正在尝试使用谷歌云语音 api 将音频剪辑 [.flac 格式] 转换为文本。我正在使用 python 客户端库来发出请求,并在 GCP 上有一个带有平面目录结构的存储桶,用于存储音频文件并发出异步请求。下面是发出请求的python代码
from google.cloud import storage
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
import json
def AudioAnalyze(bucket_name):
storage_client = storage.Client()
speech_client = speech.SpeechClient()
bucket = storage_client.get_bucket(bucket_name)
bucket_contents = bucket.list_blobs()
urls = []
audio_content=[]
for i in bucket_contents:
urls.append("gs://"+i.bucket.name+"/"+i.public_url.split("/")[-1])
for gcs_uri in urls:
audio = types.RecognitionAudio(uri=gcs_uri)
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.FLAC,
sample_rate_hertz=44100,
language_code='en-US')
operation = speech_client.long_running_recognize(config,audio)
print(gcs_uri)
print('Waiting for operation to complete...')
response = operation.result(timeout=450)
speech2text=[]
for result in …Run Code Online (Sandbox Code Playgroud) python google-app-engine google-cloud-storage google-cloud-platform google-speech-api
我在使用语音API时收到以下错误.我希望得到相同的回报,好像文件将在该限制之下.提前致谢.
asynch <- gl_speech(MonoPath,
asynch = TRUE)
gl_speech_op(asynch)
Error: API returned: Request payload size exceeds the limit: 10485760 bytes.
Run Code Online (Sandbox Code Playgroud) 我正在使用SpeechToText API从现场麦克风录音中获取语音转录。这适用于简单的 LINEAR16 编码,但我需要减少带宽,因此我切换到 OGG Opus 编码。
使用这个库在 OGG Opus 客户端中记录和编码音频。
然后,它使用 websocket 发送到后端应用程序。
最后,后端应用程序以流模式请求 STT API,该模式保持静默(没有错误,但输出中也没有文本)。
这些是编码选项:
var options = {
monitorGain: 0,
recordingGain: 1,
numberOfChannels: 1,
encoderSampleRate: 16000,
encoderPath: "./javascript/ogg_opus/encoderWorker.min.js",
originalSampleRateOverride: 16000,
streamPages: true,
encoderApplication: 2048
};
Run Code Online (Sandbox Code Playgroud)
这是发送到 API 的配置:
{
encoding: 'OGG_OPUS',
language: 'fr',
rate: 16000
}
Run Code Online (Sandbox Code Playgroud)
这是将音频发送到 websocket 的方式:
recorder.ondataavailable = function(typedArray){
var dataBlob = new Blob([typedArray], { type: 'audio/ogg' });
websocket.emit('audio_data', dataBlob);
};
Run Code Online (Sandbox Code Playgroud)
后端部分是用 Python 开发的,遵循这个例子。
您知道使 API 工作所需的 …
我正在使用下面的 python 脚本从实时流音频输入中获取来自谷歌语音 API 的预测。
问题是,我需要从谷歌语音 API 对每个话语进行预测,然后还将每个话语的音频保存到磁盘。
我不确定如何修改脚本以保存每个话语的实时音频并打印每个话语的结果而不是连续预测。
#!/usr/bin/env python
import os
import re
import sys
import time
from google.cloud import speech
import pyaudio
from six.moves import queue
# Audio recording parameters
STREAMING_LIMIT = 240000 # 4 minutes
SAMPLE_RATE = 16000
CHUNK_SIZE = int(SAMPLE_RATE / 10) # 100ms
api_key = r'path_to_json_file\google.json'
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = api_key
RED = '\033[0;31m'
GREEN = '\033[0;32m'
YELLOW = '\033[0;33m'
def get_current_time():
"""Return Current Time in MS."""
return int(round(time.time() * 1000))
class ResumableMicrophoneStream:
"""Opens a recording …Run Code Online (Sandbox Code Playgroud) python python-3.x google-cloud-platform google-speech-api google-speech-to-text-api
根据:
https://cloud.google.com/speech/docs/common/auth
我们可以为 GCP 资源(例如 Google Maps、Speech、Translate)创建一个 API 密钥,该资源受“iOS 应用”限制为特定包 ID。原则上这很好,但 GCP 是如何实现这一点的呢?GCP 如何确定客户端的包 ID,因为只有客户端只向 GCP 发出标准 HTTP 请求——大概它没有在标头中报告其包 ID?
我想为 API 密钥启用此功能,但不想突然关闭我的 iOS 客户端,因为不知何故它没有报告其包 ID。
google-translate google-maps-api-3 ios google-cloud-platform google-speech-api
我使用 c# 创建了一个控制台应用程序。我使用了谷歌云语音 api。我按照这个示例应用程序来创建应用程序。为了验证语音 api,我在 main 方法中编写了以下代码
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", "path-to-json-file", EnvironmentVariableTarget.Process);
Run Code Online (Sandbox Code Playgroud)
一切正常。我的问题,我必须将 exe 与 json 文件一起发送。我不想公开 json 文件。如何在代码中嵌入 json 文件内容或在没有 json 文件的情况下进行身份验证?这样我只能将exe发送给用户。
对此的任何帮助将不胜感激。
谢谢。
在文档页面https://cloud.google.com/speech/ 中有一个演示示例,它通过浏览器收听语音并在后台使用 API。此演示的源是否可用?
如果没有,语音 API 将使用 flac 文件。是否有任何开源项目可以从浏览器中记录 flacfiles(与此 API 兼容 - 那里有许多 github 项目,但想知道是否有官方项目)?
我想使用 Google Speech API 的异步转录服务。我已将我的音频文件上传到 Google 存储桶,并尝试将其与以下代码一起使用(我已从命令中删除了我的密钥和文件名,其他所有内容都已复制)。
curl -H "Content-Type: application/json"
--data '{"audio":{"uri":"https://storage.cloud.google.com/<mybucketname>/<filename>"},
"config":{"encoding":"FLAC","sample_rate_hertz":"16000","language_code":"en_US"}}'
https://speech.googleapis.com/v1/speech:longrunningrecognize?key=<mykey>
Run Code Online (Sandbox Code Playgroud)
我收到 400 INVALID_ARGUMENT 错误,告诉我“请求包含无效参数”。我在 curl 请求中做错了什么?
我正在尝试使用 google-speech2text api 但是,即使我已将代码设置为通过所有可用的编码器,我仍然不断收到“指定 MP3 编码以匹配音频文件”。
这是我正在尝试使用的文件
我必须补充一点,如果我将文件上传到他们的 UI 上,我可以获得输出。所以我假设源文件中没有任何问题。
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
client = speech.SpeechClient.from_service_account_json('gcp_credentials.json')
speech_file = 'chunk7.mp3'
import io
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
with io.open(speech_file, 'rb') as audio_file:
content = audio_file.read()
audio = types.RecognitionAudio(content=content)
import wave
ENCODING = [enums.RecognitionConfig.AudioEncoding.LINEAR16,
enums.RecognitionConfig.AudioEncoding.FLAC,
enums.RecognitionConfig.AudioEncoding.MULAW,
enums.RecognitionConfig.AudioEncoding.AMR,
enums.RecognitionConfig.AudioEncoding.AMR_WB,
enums.RecognitionConfig.AudioEncoding.OGG_OPUS,
enums.RecognitionConfig.AudioEncoding.SPEEX_WITH_HEADER_BYTE]
SAMPLE_RATE_HERTZ = [8000, 12000, 16000, 24000, 48000]
for enco in ENCODING:
for rate …Run Code Online (Sandbox Code Playgroud)